2012-01-30 51 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

相關問題