无法在Linux Mint中安装遏制宝石

问题描述:

我在安装路边时遇到问题。当我在控制台输入:无法在Linux Mint中安装遏制宝石

sudo gem install curb 

它返回我以下错误:

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 

我没有任何想法如何解决这个问题。我在谷歌寻找一些解决方案,但没有找到任何有助于我解决这个问题的方法。请帮忙...

编辑:

这里是mkmf.log文件。也许这将是有益的调试运行:

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 */ 

-------------------- 
+1

'curb'需要'libcurl-dev'软件包。尝试安装此软件包,然后重试安装'路边' – Robin 2015-03-19 08:27:53

+1

@Robin发布答案我想upvote它是正确的方向。顺便说一下,在这个宝石的README中有很好的解释。 – 2015-03-19 08:28:33

+1

@Зелёный:只有正确的方向。我不知道薄荷包装的确切名称:-) – Robin 2015-03-19 08:39:27

如果你是在Ubuntu上,然后再继续这样做:

:从这里

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

或者其他操作系统上安装,下载包中选择您的操作系统后,

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

+0

非常感谢。现在一切都很好:) – 2015-03-19 08:36:46

+0

很高兴能帮到:) – shivam 2015-03-19 08:37:24

您的Mint安装可能缺少卷曲开发库。从以前的答案

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

sudo apt-get install libcurl4-openssl-dev 

使用命令有时薄荷不能因为一个错误的安装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. 

在我来说,我已经与下一个命令解决它:

sudo aptitude install libldap2-dev

起初,它建议什么都不做,我已经没有选择的话,就建议我降级当前安装到适当的版本。我选择了“是”。然后像往常一样安装libcurl4-openssl-dev