【linux编译】/usr/bin/ld: ...错误

chen16501560 2011-12-07 07:06:24
编译出错:
/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位系统。

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

...全文
679 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lida2003 2011-12-08
  • 打赏
  • 举报
回复 1
没有安装libxerces,或者路径不对。

参见: http://xerces.apache.org/xerces-c/ 安装
chen16501560 2011-12-08
  • 打赏
  • 举报
回复
g++ -fPIC -DLINUX -D_REENTRANT -c -I/include -g -O2 -o /obj/LINUX/Base64.o Base64.cpp
Base64.cpp:94:35: fatal error: xercesc/util/Base64.hpp: No such file or directory

重新编译这个库。出现错误。少个文件。是不是这个库不能在32下编译。还是要改什么配置文件

ls *gcc*
libstlport_gcc.so.4.6 libuno_purpenvhelpergcc3.so.3
libuno_cppuhelpergcc3.so.3 libuno_salhelpergcc3.so.3

gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
chen16501560 2011-12-07
  • 打赏
  • 举报
回复
在另外个32linux系统试了下。
ls *gcc*
i586-redhat-linux
没有64位的。
这个系统
uname -a
Linux localhost.localdomain 2.6.29.4-167.fc11.i686.PAE #1 SMP Wed May 27 17:28:22 EDT 2009 i686 athlon i386 GNU/Linux

gcc -v
Target: i586-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i586 --build=i586-redhat-linux
Thread model: posix
gcc version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC)

能在32位gcc编译64位的么。
我看到过这个参数 -m32 -m64
不过貌似不能用
柯本 2011-12-07
  • 打赏
  • 举报
回复
你的系统支持64位的,但你编译器可能是32位的
gcc -v看一下
可能的问题是你用32的gcc,而库libxerces-c.so是64位的
如果gcc是32位的.
ls /usr/bin/*gcc* 看下有没有64位的gcc
chen16501560 2011-12-07
  • 打赏
  • 举报
回复
不是系统自带的。
daviddb7 2011-12-07
  • 打赏
  • 举报
回复
libxerces-c.so不是系统自带的吧?
32位和64位不能链接的
要么把你装个64位系统
要么搞64位的交叉编译
要么把libxerces-c源码在32位下重编

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧