我有一个远程linux服务器,它没有互联网及其防火墙。它没有gcc编译器。所以我无法安装或编译。
linux服务器已经安装了ruby 1.9.3的rvm
通常,我会在我的本地Mac OSX上安装gem,然后将gems复制到linux服务器,即(来自缓存目录的xxxx.gem文件和来自ruby的gem目录的xxx文件夹)。到目前为止它一直很好。作为新测试的一部分,我安装了sqlite3 gem并将其.gem文件复制到linux服务器并在linux服务器上安装了gem install sqlite。它确实有效并得到了以下错误
gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
checking for sqlite3.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--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=/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:34:in `<main>'
Gem files will remain installed in /ngs/app/athenat/.rvm/gems/ruby-1.9.3-p374@11.4.0-1/gems/sqlite3-1.3.8 for inspection.
Results logged to /ngs/app/athenat/.rvm/gems/ruby-1.9.3-p374@11.4.0-1/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out
我google了,看到很多人建议安装apt-get install libsqlite3-dev。我无法在远程linux服务器上执行此操作。
任何人都可以建议如何解决此问题。
我跟随了以下帖子中发布的一些建议,但它没有奏效。 Problem installing sqlite3-ruby! sqlite3 gem fails to install
答案 0 :(得分:0)
没有编译器会使这种事情几乎不可能。
你不能只为OS X编译并将这些二进制文件转移到Linux上。它们的格式不同。
您可能能够使用VMWare Fusion或VirtualBox中的虚拟环境创建与Linux目标兼容的环境,例如在使用Vagrant时,为您的目标操作系统进行编译,架构和他们运送这些二进制文件。这通常是最后的手段,因为您必须链接到远程系统上可用的完全相同的库。要做到这一点,可能需要花费很多时间。