【问题标题】:Why do I get an error installing bson_ext?为什么我在安装 bson_ext 时会出错?
【发布时间】:2012-05-17 08:26:03
【问题描述】:

当我在 Rails 项目文件夹中执行以下命令时:

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,它给了我上面的错误。

谁能告诉我是什么问题?

【问题讨论】:

  • which install 说什么? /usr/bin/安装? --echo $PATH呢?
  • yes...which install 给了我你所说的....并且 echo $PATH 给了:/home/absolute/.rvm/gems/ruby-1.9.3-p0/bin:/ home/absolute/.rvm/gems/ruby-1.9.3-p0@global/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/分贝/bin

标签: ruby-on-rails ruby ruby-on-rails-3.1 mongoid bson


【解决方案1】:

如果您使用的是捆绑安装,则需要运行

bundle config build.bson_ext --with-cflags="-Wno-error=implicit-function-declaration"

【讨论】:

    【解决方案2】:

    不知道为什么您的make 没有使用正确的install。但是快速修复很容易:

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

    这会将现有安装链接到/bin,并应使make 能够继续。

    【讨论】:

      猜你喜欢
      • 2010-10-12
      • 1970-01-01
      • 2022-11-20
      • 2021-09-08
      • 2020-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-02
      相关资源
      最近更新 更多