使用Bundler for cups gem后,宝石安装失败

时间:2015-05-18 06:57:30

标签: ruby-on-rails ruby gem bundler rbenv

所以我目前正在一个涉及打印服务器的Linux环境中使用RoR进行项目。我们正在使用CUPS(请参阅http://cups.org)。我试图捆绑我使用的所有各种宝石,但这是唯一不起作用的宝石。

我从下面的安装中输入命令提示输出和mkmf.log,删除绝对文件扩展名并用" ***"替换中间位。我使用rbenv,因此文件路径应该是显而易见的。

命令提示

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

checking for main() in -lcups... 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/***/2.0.0-p481/bin/ruby
--with-cupslib
--without-cupslib

Couldn't find CUPS libraries on your system. Check they're installed and in your path.

mkmf.log

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

"gcc -o conftest -I/home/***/ruby-2.0.0/x86_64-linux -I/home/***/ruby-2.0.0/ruby/backward -I/home/***/ruby-2.0.0 -I. -I/home/***/2.0.0-p481/include     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -L/home/***/2.0.0-p481/lib -Wl,-R/home/***/2.0.0-p481/lib -L. -L/home/***/2.0.0-p481/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R -Wl,/home/***/2.0.0-p481/lib -L/home/***/2.0.0-p481/lib -lruby-static  -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/home/***/ruby-2.0.0/x86_64-linux -I/home/***/ruby-2.0.0/ruby/backward -I/home/***/ruby-2.0.0 -I. -I/home/***/2.0.0-p481/include     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -L/home/***/2.0.0-p481/lib -Wl,-R/home/***/2.0.0-p481/lib -L. -L/home/***/2.0.0-p481/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R -Wl,/home/***/2.0.0-p481/lib -L/home/***/2.0.0-p481/lib -lruby-static -lcups  -lpthread -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:5:57: error: ‘main’ undeclared (first use in this function)
 int t(void) { void ((*volatile p)()); p strong text= (void ((*)()))main; return 0; }
                                                         ^
conftest.c:5:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:5:32: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
 int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
                                ^
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
 6: int main(int argc, char **argv)
 7: {
 8:   if (argc > 1000000) {
 9:     printf("%p", &t);
10:   }
11: 
12:   return 0;
13: }
/* end */

"gcc -o conftest -I/home/***/ruby-2.0.0/x86_64-linux -I/home/***/ruby-2.0.0/ruby/backward -I/home/***/ruby-2.0.0 -I. -I/home/***/2.0.0-p481/include     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -L/home/***/2.0.0-p481/lib -Wl,-R/home/***/2.0.0-p481/lib -L. -L/home/***/2.0.0-p481/lib  -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-R -Wl,/home/***/2.0.0-p481/lib -L/home/***/2.0.0-p481/lib -lruby-static -lcups  -lpthread -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:5:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
 int t(void) { main(); return 0; }
 ^
/usr/bin/ld: cannot find -lcups
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int t(void) { main(); return 0; }
 6: int main(int argc, char **argv)
 7: {
 8:   if (argc > 1000000) {
 9:     printf("%p", &t);
10:   }
11: 
12:   return 0;
13: }
/* end */

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

提前感谢您提供任何帮助

大多数其他答案似乎要么涵盖rvm,要么是无关紧要的问题,更多地关注 bundle gem 之间的区别

2 个答案:

答案 0 :(得分:2)

你回答的是第一个日志:Couldn't find CUPS libraries on your system. Check they're installed and in your path

如果您看到gem源here,则在gem构建器检查依赖项时会显示该消息。

根据gem's documentation您需要安装这些软件包:

sudo apt-get install libcupsys2-dev

或等效物,具体取决于您的系统。

OBS:正如@errata指出的那样,检查一下你是否正确安装了gcc工具。

答案 1 :(得分:0)

您需要安装杯子库

sudo apt-get install libcupsys2-dev

还有更多的图书馆 https://wiki.qt.io/Compile_Qt_4.7_on_Ubuntu_10.10