我正在使用Amazon Linux AMI而我正在尝试使用此错误运行我的bundle install:
使用原生扩展安装therubyracer 0.12.2
Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。
/usr/bin/ruby2.0 -r ./siteconf20150914-12081-ne1jzf.rb extconf.rb
在-lpthread中检查main()...是的 * extconf.rb失败* 由于某些原因无法创建Makefile,可能缺少必要的 库和/或标题。检查mkmf.log文件以获取更多详细信息。你可以 需要配置选项。
... ...
Gem文件将保留在//gems/therubyracer-0.12.2中进行检查。
结果登录到//.gem/ruby/2.0/extensions/x86_64-linux/2.0/therubyracer-0.12.2/gem_make.out
安装therubyracer(0.12.2)时发生错误,Bundler无法继续。
在捆绑之前确保gem install therubyracer -v '0.12.2'
成功。
但是'gem install therubyracer -v'0.12.2'既不起作用(同样的错误)。
在文件中:.gem / ruby / 2.0 / extensions / x86_64-linux / 2.0 / therubyracer-0.12.2 / mkmf.log
have_library: checking for main() in -lpthread... -------------------- yes
"gcc -o conftest -I/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC conftest.c -L. -L/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -L/usr/lib64/ruby/2.0 -lruby -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/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC conftest.c -L. -L/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -L/usr/lib64/ruby/2.0 -lruby -lpthread -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 = (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/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC conftest.c -L. -L/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -L/usr/lib64/ruby/2.0 -lruby -lpthread -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; }
^
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 */
我的版本:
gem -v
2.4.8
rails -v
Rails 4.2.4
ruby -v
ruby 2.0.0p647 (2015-08-18) [x86_64-linux]
有什么想法吗?
谢谢你们
/克里斯