3

我已经设置了一个 rails 应用程序,但是当我进行捆绑安装时,我收到一个错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb 
checking for curl-config... no
checking for main() in -lcurl... 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=/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:18:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.

extconf failed, exit code 1

Gem files will remain installed in /home/kelvin/.rvm/gems/ruby-2.1.1/gems/curb-0.8.5 for inspection.
Results logged to /home/kelvin/.rvm/gems/ruby-2.1.1/extensions/x86-linux/2.1.0/curb-0.8.5/gem_make.out
An error occurred while installing curb (0.8.5), and Bundler cannot continue.

gem install curb -v '0.8.5'在捆绑之前确保成功。

所以我做了

gem install curb -v '0.8.5

但我不断收到此错误:

ERROR:  Error installing curb:
ERROR: Failed to build gem native extension.

/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for curl-config... no
checking for main() in -lcurl... 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=/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:18:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.

extconf failed, exit code 1

Gem files will remain installed in /home/kelvin/.rvm/gems/ruby-2.1.1/gems/curb-0.8.5 for inspection.
Results logged to /home/kelvin/.rvm/gems/ruby-2.1.1/extensions/x86-linux/2.1.0/curb-0.8.5/gem_make.out

然后我用谷歌搜索错误并得到了这个然后导致我这个

当我在我的 gem 主目录 (~/.rvm/gems/ruby-2.1.1) 中执行ls -ladg curl-*时,我收到以下错误

ls: cannot access curb-*: No such file or directory

请就如何修复 gem install 路边提出建议

4

1 回答 1

6

尝试安装libcurl4-openssl-dev,然后再次安装遏制(sudo如果再次失败,也尝试一下)

于 2014-05-05T07:51:04.680 回答