Gem 使用 Bundler for cups 后安装失败 gem
Gem installation fails after use of Bundler for cups gem
所以我目前正在一个涉及打印服务器的 linux 环境中使用 RoR 进行项目。我们正在使用 CUPS(参见 http://cups.org)。我正在尝试捆绑我正在使用的所有各种 gem,但这是唯一一个不起作用的。
我已经从下面的安装中复制了命令提示符输出和 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[=33= 之间的区别]
您的答案在第一个日志中: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 工具。
您需要安装 cups 库
sudo apt-get install libcupsys2-dev
所以我目前正在一个涉及打印服务器的 linux 环境中使用 RoR 进行项目。我们正在使用 CUPS(参见 http://cups.org)。我正在尝试捆绑我正在使用的所有各种 gem,但这是唯一一个不起作用的。
我已经从下面的安装中复制了命令提示符输出和 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[=33= 之间的区别]
您的答案在第一个日志中: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 工具。
您需要安装 cups 库
sudo apt-get install libcupsys2-dev