我正在使用 Amazon Linux AMI,并且正在尝试运行我的捆绑安装,但出现以下错误:
使用本机扩展安装 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]
有任何想法吗?
多谢你们
/克里斯