4

我正在尝试在 Blue Gene 超级计算机上构建 Google Protocolbuffers 和 Kyotocabinet,这是一台基于 PowerPC64 的机器,运行 Suse Linux,gcc 4.1.2。

当我编译我的代码时,Google Protocolbuffers 和 Kyotocabinet 都给出了“跳过不兼容”错误。编译命令行:

g++ -g -Xlinker -zmuldefs -I/some_path/include $sourceFile -o $fileName -L/some_path/lib -lkyotocabinet -lz -lstdc++ -lrt -lpthread -lm -lc -lprotobuf -lprotoc meta.pb.cc

然后我更改了它们的安装,通过使用./configure --host=powerpc-bgp-linux,Google Protocolbuffers 这次可以工作,但 Kyotocabinet 仍然给出如下错误:

/usr/bin/ld: skipping incompatible /some_path/lib/libkyotocabinet.so when searching for -lkyotocabinet
/usr/bin/ld: skipping incompatible /some_path/lib/libkyotocabinet.a when searching for -lkyotocabinet
/usr/bin/ld: cannot find -lkyotocabinet
collect2: ld returned 1 exit status

我检查config.status了他们,谷歌协议缓冲区有这样的东西

sys_lib_search_path_spec='/usr/lib/gcc/powerpc64-suse-linux/4.1.2 /usr/powerpc64-suse-linux/lib /usr/lib /lib'

显然它知道如何找到合适的东西来使用。但是Kyotocabinet 在config.status 中没有这种设置。希望这个提示会有所帮助。

有什么解决方案可以让我在 BlueGene 上使用 Kyotocabinet 吗?或者我可以像上面提到的那样添加一些行来告诉 Kyotocabinet 在哪里可以找到正确的库?或者你能推荐一些快速键值存储吗?

4

1 回答 1

2

Your problem is not in finding Kyotocabinet. Your problem is that the library you are pointing at: /some_path/lib/libkyotocabinet.so is built for incompatible architecture (most linkely ppc32).

Do file -L /some_path/lib/libkyotocabinet.so and see what it says. You must rebuilt it for the same architecture as what gcc produces by default.

Update: file says ELF 64-bit MSB shared object, 64-bit PowerPC. But does that match what your g++ outputs by default? What is the output from:

echo "int foo() { return 0; }" | g++ -xc++ - -c -o foo.o &&
file foo.o

I bet above will print 32-bit PowerPC, in which case you need to add -m64 to your command line.

Update 2:

Any idea for this problem??

You should not be so helpless. You understand that the problem is mis-matched libraries, so go and fix it.

  1. Decide whether you want the final binary to run in 32-bit or 64-bit mode
  2. Obtain or rebuild all the libraries your need in the bitness you desire
  3. Build the final binary
  4. Profit!
于 2011-10-26T05:32:08.007 回答