Link against MacPorts Ruby instead of system Ruby

Christopher Jones jonesc at hep.phy.cam.ac.uk
Sat Apr 26 11:00:42 PDT 2014


Hi,

( Why do you have -I/opt/local/include/ruby-2.1.0/ twice ? )

Looking at

MacBookPro /opt/local/include/ruby-2.1.0 > ls
ruby		ruby.h		x86_64-darwin13

I see there is a ruby.h there. This file sets various things then includes <ruby/ruby.h>

I not a user of ruby, so I am guessing here, but what happens if you include

#include <ruby.h>

instead, to pick up /opt/local/include/ruby-2.1.0/ruby.h

?

Chris




On 26 Apr 2014, at 5:59pm, Kevin Walzer <kw at codebykevin.com> wrote:

> On 4/26/14, 12:27 PM, Chris Jones wrote:
>> Do you not include any ruby headers in your code ? If you do, you should make sure to pick those matching the library you are using. It might well work without, but that will be just by pure chance..
> 
> Just this:
> 
> #include <ruby/ruby.h>
> 
> If I use the "-I" flag, like so:
> 
> gcc -Wall -v -o run run.c -L/opt/local/lib -lruby.2.1 -I/opt/local/include/ruby-2.1.0/ -I/opt/local/include/ruby-2.1.0/
> 
> then it fails to compile, with this error:
> 
> #include <...> search starts here:
> /opt/local/include/ruby-2.1.0
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks (framework directory)
> End of search list.
> In file included from run.c:1:
> /opt/local/include/ruby-2.1.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h'
>      file not found
> #include "ruby/config.h"
>         ^
> 
> Ruby seems to have a convoluted batch of headers; multiple versions of "ruby.h" are located in the tree for reasons unknown to me. I've seen this error before when trying to compile against MacPorts Ruby and trying to guess at the include path.
> 
> Any suggestions, especially when the other invocation works as expected?
> 
> --Kevin
> 
> -- 
> Kevin Walzer
> Code by Kevin/Mobile Code by Kevin
> http://www.codebykevin.com
> http://www.wtmobilesoftware.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2030 bytes
Desc: not available
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20140426/fcd47d0d/attachment.p7s>


More information about the macports-users mailing list