2013-04-06 102 views
1

這是試圖安裝時的結果 - > extconf失敗:需要的libm安裝的libxml

[email protected] ~ $ 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

其包含兩個錯誤10

  • conftest.c:3:錯誤: 'ATAN' 未聲明(第一在此函數使用)

  • 的/ usr /斌/勞工處:找不到-lruby靜電

的第一個錯誤「反正切」很容易解決,但第二個真的不知道,如果一個庫丟失,或者如果是一個更大的問題開始克中這

+0

之前有所有這些我建議你嘗試通過'sudo易於升級到'1.9.2' - 安裝ruby1.9.1' – 2013-04-06 14:22:09

+0

忘了提及,我也安裝了導軌,不會惹惱我已經在ruby 1.8.7上運行的項目? – athospy 2013-04-06 15:22:15

回答

0

https://github.com/xml4r/libxml-ruby#requirements

libxml-ruby requires Ruby 1.8.4 or higher. It is dependent on the following libraries to function properly:
- libm (math routines: very standard)
- libz (zlib)
- libiconv
- libxml2
If you are running Linux or Unix you’ll need a C compiler so the extension can be compiled when it is installed.

確保您構建寶石

+0

我一直在嘗試安裝通過5個小時的libm,仍然沒有運氣 – athospy 2013-04-06 16:33:57

+0

@Santiago Morel Berni,'libm'應該已經安裝好了,你可以在'/ usr/lib /'文件夾中查找'libm'文件。確保libxml2已安裝 – ted 2013-04-06 17:46:31

0
sudo apt-get install libxslt-dev libxml2-dev 

sudo gem install libxml-ruby 
+0

這是什麼?你能解釋這是如何回答這個問題的嗎? – Huangism 2014-09-22 13:16:46