首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

【linux编译】/usr/bin/ld: .异常

2012-03-20 
【linux编译】/usr/bin/ld: ...错误编译出错:/usr/bin/ld: skipping incompatible ./xerces-c-src2_1_0/lib/

【linux编译】/usr/bin/ld: ...错误
编译出错:
/usr/bin/ld: skipping incompatible ./xerces-c-src2_1_0/lib/libxerces-c.so when searching for -lxerces-c
/usr/bin/ld: cannot find -lxerces-c
collect2: ld returned 1 exit status
make: *** [h2482] Error 1

找这个文件
file ./xerces-c-src2_1_0/lib/libxerces-c.so

./xerces-c-src2_1_0/lib/libxerces-c.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

然后
uname -a
Linux ubuntu 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux

在能编译过的机器上输入同样的命令
发现
uname -a
Linux localhost.localdomain 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

我郁闷了。64位和32位系统。

我这个错误是不是由于系统原因引起的。是的话怎么决绝
求教



[解决办法]
libxerces-c.so不是系统自带的吧?
32位和64位不能链接的
要么把你装个64位系统
要么搞64位的交叉编译
要么把libxerces-c源码在32位下重编
[解决办法]
你的系统支持64位的,但你编译器可能是32位的
gcc -v看一下
可能的问题是你用32的gcc,而库libxerces-c.so是64位的
如果gcc是32位的.
ls /usr/bin/*gcc* 看下有没有64位的gcc

[解决办法]
没有安装libxerces,或者路径不对。

参见: http://xerces.apache.org/xerces-c/ 安装

热点排行