2012-01-30 52 views
1

当我使用gcc构建项目时,我可以使用非常有用的-I标志来指定其他包含目录。有时,宝石需要编译代码,但我不能使用-I标志。具体来说,我不能在我的机器上建立RMagick,因为它未能对MagickWand步:什么是Rubygem的'-I'标志的等价物?

checking for wand/MagickWand.h... no 

我知道确切位置MagickWand.h是。我如何告诉宝石在哪里可以找到它?

UPDATE: 我有ImageMagick的两个版本我的系统(工作)和宝石上抛出这个错误:

Warning: Found more than one ImageMagick installation. This could cause problems at runtime. 
    /a/Magick-config reports version 6.5.8 Q8 is installed in [a] 
    /b/Magick-config reports version 6.6.4 Q16 is installed in [b] 
Using 6.5.8 Q8 from [a]. 

宝石使用的版本[a],而我希望它使用版本[b] ..但我找不到任何方法让它切换到[b]。据我所知,宝石不会咨询我的$PATH

回答

0

guides表明,一样可以通过编译选项

If an extension fails to compile during gem installation the gem specification is not written out, but the gem remains unpacked in the repository. You may need to specify the path to the library’s headers and libraries to continue. You can do this by adding a – between RubyGems’ options and the extension’s build options:

$ gem install some_extension_gem 
[build fails] 
Gem files will remain installed in /path/to/gems/some_extension_gem-1.0 for inspection. 
Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out 
$ gem install some_extension_gem -- --with-extension-lib=/path/to/lib 
[build succeeds] 
$ gem list some_extension_gem 

*** LOCAL GEMS *** 

some_extension_gem (1.0) 
$ 

对你来说,这听起来像gem install rmagick -- -I /path/to/MagickWand.h,但我真的不知道如何尝试一下来验证。

+0

这并没有做到这一点不幸的是......宝石抛出相同的错误。 – 2012-01-31 02:28:17

相关问题