我相信conftest缺少正确的标志,但是我无法弄清楚mkmf.log的内容,这些内容包含在下面。 任何想法都会受到赞赏!
have_library: checking for main() in -lidn... -------------------- no
"i486-linux-gnu-gcc -o conftest -I /backfire/staging_dir/host/include/ruby-1.9.1/i486-linux -I /backfire/staging_dir/host/include/ruby-1.9.1/ruby/backward -I /backfire/staging_dir/host/include/ruby-1.9.1 -I. -O2 -I /backfire/staging_dir/host/include -D_FILE_OFFSET_BITS=64 -O2 -I /backfire/staging_dir/host/include -O2 -I /backfire/staging_dir/host/include conftest.c -L. -L /backfire/staging_dir/host/lib -Wl,-R /backfire/staging_dir/host/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl, /backfire/staging_dir/host/lib -L /backfire/staging_dir/host/lib -lruby-static -lpthread -lrt -ldl -lcrypt -lm -lc"
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: int main() {return 0;}
/ end */
"i486-linux-gnu-gcc -o conftest -I /backfire/staging_dir/host/include/ruby-1.9.1/i486-linux -I /backfire/staging_dir/host/include/ruby-1.9.1/ruby/backward -I /backfire/staging_dir/host/include/ruby-1.9.1 -I. -O2 -I /backfire/staging_dir/host/include -D_FILE_OFFSET_BITS=64 -O2 -I /backfire/staging_dir/host/include -O2 -I /backfire/staging_dir/host/include conftest.c -L. -L /backfire/staging_dir/host/lib -Wl,-R /backfire/staging_dir/host/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl, /backfire/staging_dir/host/lib -L /backfire/staging_dir/host/lib -lruby-static -lidn -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.so when searching for -lidn
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.a when searching for -lidn
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.so when searching for -lidn
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.a when searching for -lidn
/usr/bin/ld: cannot find -lidn
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /top/
4: int main() {return 0;}
5: int t() { void ((volatile p)()); p = (void (()()))main; return 0; }
/* end */
"i486-linux-gnu-gcc -o conftest -I /backfire/staging_dir/host/include/ruby-1.9.1/i486-linux -I /backfire/staging_dir/host/include/ruby-1.9.1/ruby/backward -I /backfire/staging_dir/host/include/ruby-1.9.1 -I. -O2 -I /backfire/staging_dir/host/include -D_FILE_OFFSET_BITS=64 -O2 -I /backfire/staging_dir/host/include -O2 -I /backfire/staging_dir/host/include conftest.c -L. -L /backfire/staging_dir/host/lib -Wl,-R /backfire/staging_dir/host/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl, /backfire/staging_dir/host/lib -L /backfire/staging_dir/host/lib -lruby-static -lidn -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.so when searching for -lidn
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.a when searching for -lidn
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.so when searching for -lidn
/usr/bin/ld: skipping incompatible /backfire/staging_dir/host/lib/libidn.a when searching for -lidn
/usr/bin/ld: cannot find -lidn
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /top/
4: int main() {return 0;}
5: int t() { main(); return 0; }
/* end */
答案 0 :(得分:1)
Ruby的mkmf.rb正在使用本机编译器来测试libidn,但由于你的目标是MIPS,它需要使用交叉编译器。我假设您的mkmf.log中列出的libidn.so和libidn.a文件是为MIPS构建的。由于本机i486编译器需要i486库,因此在遇到MIPS文件时会报告“跳过不兼容”错误。
我认为您需要修改extconf.rb文件以指向交叉编译器。类似的东西:
require 'mkmf'
CONFIG['CC'] = '/path/to/mips-gcc'
此外,您可能需要将mkmf.rb指向MIPS的Ruby头文件。我不确定需要设置什么,但我猜至少应该在extconf.rb文件中覆盖CONFIG['arch']
和CONFIG['archdir']
。