试图更新Windows机器上的一些宝石,我不断获得没有预编译二进制文件的宝石的错误输出:
提供的配置选项:
Run Code Online (Sandbox Code Playgroud)--with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --srcdir=. --curdir --ruby=c:/server/ruby/bin/ruby
这些是在安装gem期间提供给extconf.rb ruby文件的配置选项.
我安装了MinGW,所以我应该拥有安装,制作和编译这些宝石所需的一切.
但是,我不知道如何更改RubyGems的配置,以便在调用extconf.rb时它包含指向MinGW include目录的相应选项.
我正在写一个包含C扩展的gem.通常当我写一个gem时,我会遵循TDD的过程,在那里我将编写一个失败的规范,然后处理代码直到它通过等等......
使用我在"ext/mygem/mygem.c"中的C扩展和在gemspec的"扩展"中配置的有效extconf.rb,如何运行我的规范并仍然加载了我的C扩展?当我更改C代码时,我需要采取哪些步骤来重新编译代码?
这可能是一个愚蠢的问题,但是从我的gem的开发源代码树里面输入'bundle install'并没有构建任何原生扩展.当我手动运行时,ruby ext/mygem/extconf.rb我得到一个Makefile(在整个项目的根目录中),当我运行时make,我确实得到了一个共享对象(同样,在整个项目的根目录中).我必须遵循错误的工作流程,因为我知道.so应该放在lib /下.除非我只是想在开发过程中手工做到这一点?
我已尝试过在此处发布的类似问题提供的多种解决方案,但似乎没有任何效果.我无法安装Rails.错误信息如下.另外,Wwen我试着通过使用安装Xcode xcode-select --install,它给我一个网络安装cannot download due to network请指教.我是Ruby的新手,所以非常感谢任何帮助.干杯.
nmacaule-mn1:~ nmacaule$ gem install rails --no-ri --no-rdoc
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/nmacaule/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150209-56320-1m9byas.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
-----
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools …Run Code Online (Sandbox Code Playgroud) 我安装了大约40个其他宝石,但是由于这个错误,这个宝石无法安装:
使用本机扩展安装rmagick(2.13.1)Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展.
/Users/durrantm/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
Run Code Online (Sandbox Code Playgroud)
检查Ruby的版本> = 1.8.5 ...是检查/usr/bin/gcc-4.2 ...是对Magick,配置检查...没有无法安装RMagick 2.13.1.在/Users/durrantm/.rvm/gems/ruby-1.9.2-p290@ruby1.9.2_Abroad101/bin:/Users/durrantm/.rvm/gems/ruby-1.9.2-p290找不到Magick-config @全球/斌:/Users/durrantm/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/durrantm/.rvm/bin:/Library/PostgreSQL/9.1/bin:在/ usr/local/bin目录:/Library/PostreSQL/9.1/bin:在/ usr/bin中:/ bin中:/ usr/sbin目录:/ sbin目录:在/ usr/local/bin目录:在/ usr/X11/bin中:在/ usr/local/sbin中:在/ usr /本地/ MySQL的/斌:/Users/durrantm/.rvm/bin
*extconf.rb失败* 由于某些原因无法创建Makefile,可能缺少必要的库和/或标头.检查mkmf.log文件以获取更多详细信息.您可能需要配置选项.
提供的配置选项: - with-opt-dir --with-opt-include --without-opt-include = $ {opt-dir}/include --with-opt-lib --without-opt-lib = $ {opt-dir}/lib --with-make-prog --without-make-prog --srcdir =.--curdir --ruby =/Users/durrantm/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
Gem文件将保留在/Users/durrantm/.rvm/gems/ruby-1.9.2-p290@ruby1.9.2_Abroad101/gems/rmagick-2.13.1中进行检查.结果登录到/Users/durrantm/.rvm/gems/ruby-1.9.2-p290@ruby1.9.2_Abroad101/gems/rmagick-2.13.1/ext/RMagick/gem_make.out安装rmagick时发生错误(2.13. 1),而Bundler无法继续.gem install rmagick -v '2.13.1'在捆绑之前确保成功.
我尝试了这个链接 https://github.com/maddox/magick-installer,
但它在最后出错:
/ usr/bin/install -c -m 644 ./builds/unix/freetype2.pc\/ usr/local/lib/pkgconfig/freetype2.pc tar:无法识别的存档格式tar:从先前错误延迟的错误退出.
现在我正在尝试Veraticus的解决方案,如果有必要我会尝试Peters.