这是尝试安装时的结果-> extconf 失败:需要 libm
virtualrails@jay ~ $ sudo gem install libxml-ruby
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
/opt/rubystack-2.0-0/ruby/bin/ruby extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... no
checking for atan() in -lm... no
*** 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
--without-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=/opt/rubystack-2.0-0/ruby/bin/ruby
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-socketlib
--without-socketlib
--with-nsllib
--without-nsllib
--with-mlib
--without-mlib
--with-mlib
--without-mlib
extconf failure: need libm
Gem files will remain installed in /opt/rubystack-2.0-0/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-2.6.0 for inspection.
Results logged to /opt/rubystack-2.0-0/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-2.6.0/ext/libxml/gem_make.out
这是 mkmf.log 的输出:
have_library: checking for atan() in -lm... -------------------- no
"gcc -o conftest -I. -I/opt/rubystack-2.0-0/ruby/lib/ruby/1.8/i686-linux -I. -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -D_FILE_OFFSET_BITS=64 -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -g -Os -fno-strict-aliasing -L/opt/rubystack-2.0-0/common/lib -fno-builtin conftest.c -L. -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L. -L/opt/rubystack-2.0-0/common/lib -ltcmalloc_minimal -rdynamic -Wl,-export-dynamic -lruby-static -lm -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘atan’ undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))atan; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/rubystack-2.0-0/ruby/lib/ruby/1.8/i686-linux -I. -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -D_FILE_OFFSET_BITS=64 -DAI_ADDRCONFIG=0 -I/opt/rubystack-2.0-0/common/include -g -Os -fno-strict-aliasing -L/opt/rubystack-2.0-0/common/lib -fno-builtin conftest.c -L. -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L/opt/rubystack-2.0-0/ruby/lib -Wl,-R/opt/rubystack-2.0-0/ruby/lib -L. -L/opt/rubystack-2.0-0/common/lib -ltcmalloc_minimal -rdynamic -Wl,-export-dynamic -lruby-static -lm -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lruby-static
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { atan(); return 0; }
/* end */
我在 virtualbox 4.2.8 中使用http://sourceforge.net/projects/virtualrails/
使用宝石 1.3.5
它包含两个错误:
conftest.c:3: error: 'atan' undeclared (第一次在这个函数中使用)
/usr/bin/ld: 找不到 -lruby-static
第一个错误“atan”很容易解决,但第二个错误并不确定是否缺少一个库或者这是一个更大的问题