【问题标题】:Gem installation fails after use of Bundler for cups gem使用 Bundler for cups gem 后,Gem 安装失败
【发布时间】:2015-05-18 06:57:29
【问题描述】:

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

我已经 cp'd 命令提示符输出和下面安装的 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,要么是更多关注 bundlegem

之间区别的无关问题

【问题讨论】:

  • 你确定你的c编译器工具链是完整的吗?你有没有安装 os x 命令行工具或者你也在 linux 上开发?

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


【解决方案1】:

您的答案在第一个日志中: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 工具。

【讨论】:

  • 非常感谢。作为旁注,文档似乎不正确。依赖于 libcups-dev 包。他们列出的那个不存在,这非常有帮助。
【解决方案2】:

您需要安装 cups 库

sudo apt-get install libcupsys2-dev

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

【讨论】:

    猜你喜欢
    • 2014-04-02
    • 1970-01-01
    • 1970-01-01
    • 2011-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-02
    • 2013-02-24
    相关资源
    最近更新 更多