2012-05-17 106 views
2

當我在Rails項目的目錄執行以下命令:爲什麼安裝bson_ext時出現錯誤?

gem install bson_ext 

我得到這個錯誤:

#result 
Building native extensions. This could take a while... 
ERROR: Error installing bson_ext: 
    ERROR: Failed to build gem native extension. 

    /home/absolute/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb 
checking for asprintf()... yes 
checking for ruby/st.h... yes 
checking for ruby/regex.h... yes 
checking for ruby/encoding.h... yes 
creating Makefile 

make 
compiling bson_buffer.c 
compiling cbson.c 
cbson.c: In function ‘write_element’: 
cbson.c:439:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration- after-statement] 
cbson.c: In function ‘write_doc’: 
cbson.c:608:5: warning: implicit declaration of function ‘bson_buffer_get_max_size’  [-Wimplicit-function-declaration] 
cbson.c: In function ‘objectid_generate’: 
cbson.c:911:9: warning: implicit declaration of function ‘htonl’ [-Wimplicit-function-declaration] 
cbson.c:919:5: warning: implicit declaration of function ‘htons’ [-Wimplicit-function-declaration] 
compiling encoding_helpers.c 
linking shared-object bson_ext/cbson.so 

make install 
/bin/install -c -m 0755 cbson.so /home/absolute/.rvm/gems/ruby-1.9.3-p0/gems/bson_ext-1.6.2/ext/bson_ext 
make: /bin/install: Command not found 
make: *** [/home/absolute/.rvm/gems/ruby-1.9.3-p0/gems/bson_ext-1.6.2/ext/bson_ext/cbson.so] Error 127 


Gem files will remain installed in /home/absolute/.rvm/gems/ruby-1.9.3- p0/gems/bson_ext-1.6.2 for inspection. 
Results logged to /home/absolute/.rvm/gems/ruby-1.9.3-p0/gems/bson_ext-1.6.2/ext/cbson/gem_make.out 

在我的Rails項目我使用mongoid。安裝bson_ext gem,它給了我上面的錯誤。

有人可以告訴我是什麼問題?

+0

'哪個安裝'說什麼? *在/ usr/bin中/安裝*? - echo $ PATH呢? –

+0

是的......哪個安裝給了我你所說的......和echo $ PATH給出:/home/absolute/.rvm/gems/ruby-1.9.3-p0/bin:/home/absolute/.rvm/ gems/[email protected]/bin:/home/absolute/.rvm/rubies/ruby-1.9.3-p0/bin:/home/absolute/.rvm/bin:在/ usr/local/bin目錄:/ usr/bin:/ bin:/ usr/local/sbin:/ usr/sbin:/ sbin:/ usr/bin/core_perl:/ opt/java/bin:/ opt/java/db/bin –

回答

1

不確定爲什麼你的make沒有使用正確的install。但它很容易做到速戰速決:

sudo ln -s /usr/bin/install /bin/install 

這將連接現有的安裝爲/bin,並應使make繼續。

+0

tht solve the問題... thnx很多! –