简体   繁体   English

无法在Linux Mint中安装路缘宝石

[英]Can't install curb gem in Linux Mint

I have a problem with installing curb. 我在安装路缘石时遇到问题。 When I type in my console: 当我在控制台中键入时:

 sudo gem install curb

It returns me following error: 它返回以下错误:

Fetching: curb-0.8.6.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing curb:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 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=/usr/bin/ruby1.9.1
    --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:23: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.


Gem files will remain installed in /var/lib/gems/1.9.1/gems/curb-0.8.6 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/curb-0.8.6/ext/gem_make.out

I don't have any idea how to solve this problem. 我不知道如何解决这个问题。 I was looking for some solution in Google but not find anything that will help me to solve this problem. 我一直在寻找Google的解决方案,但找不到任何可以帮助我解决此问题的方法。 Please help... 请帮忙...

EDIT: 编辑:

Here is mkmf.log file. 这是mkmf.log文件。 Maybe it will be helpfull in debuging: 也许对调试很有帮助:

find_executable: checking for curl-config... -------------------- no

--------------------

have_library: checking for main() in -lcurl... -------------------- no

"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_FORTIFY_SOURCE=2  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC conftest.c  -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic     -lruby-1.9.1  -lpthread -lrt -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_FORTIFY_SOURCE=2  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC conftest.c  -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic     -lruby-1.9.1 -lcurl  -lpthread -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:4:53: error: ‘main’ undeclared (first use in this function)
 int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
                                                     ^
conftest.c:4:53: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:4:28: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
 int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
                            ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
/* end */

"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_FORTIFY_SOURCE=2  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC conftest.c  -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic     -lruby-1.9.1 -lcurl  -lpthread -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:4:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
 int t() { main(); return 0; }
 ^
/usr/bin/ld: cannot find -lcurl
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: int t() { main(); return 0; }
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
/* end */

--------------------

If you are on Ubuntu do this before proceeding: 如果您使用的是Ubuntu,请先执行以下操作:

sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev

Alternatively for other OS install, download package from here after selecting your OS: 或者,对于其他操作系统安装,请在选择操作系统后从此处下载软件包:

http://curl.haxx.se/dlwiz/?type=devel http://curl.haxx.se/dlwiz/?type=devel

Your Mint installation is probably missing the curl dev libraries. 您的Mint安装可能缺少curl开发库。

Try this on the command line: 在命令行上尝试:

sudo apt-get install libcurl4-openssl-dev

Use command from previous answer 使用上一个答案中的命令

sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev

Sometimes Mint can't install libcurl4-openssl-dev because of next error. 有时由于下一个错误,Mint无法安装libcurl4-openssl-dev

The following packages have unmet dependencies:
 libldap2-dev : Depends: libldap-2.4-2 (= 2.4.31-1+nmu2ubuntu8.2) but 2.4.31-1+nmu2ubuntu8.3 is to be installed
E: Unable to correct problems, you have held broken packages.

In my case I've resolved it with next command: 就我而言,我已经用下一条命令解决了:

sudo aptitude install libldap2-dev

At first it suggested to do nothing, I've selected No, then it suggested to downgrade my current install to proper version. 首先,它建议不执行任何操作,我选择了“否”,然后建议将当前安装降级为正确的版本。 I've selected Yes. 我选择了是。 Then I was able to install libcurl4-openssl-dev as usual 然后我能够像往常一样安装libcurl4-openssl-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM