ICE-3.3.1在AS4上编译时会报告一个错:
g++ -Wall ... -L/usr/lib -lIce -lIceUtil ...
/usr/lib/libIceUtil.so: undefined reference to `pthread_condattr_setclock'
collect2: ld returned 1 exit status
这是因为系统中有两个线程库提供了libpthread.so
一个是/usr/lib64/libpthread.so
另外一个是/usr/nptl/libpthread.so
pthread_condattr_setclock在nptl的库中实现了,但是在系统的/usr/lib64/libpthread.so中却是没有实现的。
而ICE的Makefile在这条编译命令中把前者路径写在前面了,这样写:
- c++ -Wl,--enable-new-dtags -Wl,-rpath,/opt/Ice-3.3/lib64 -m64 -ftemplate-depth-128 -Wall -D_REENTRANT -I/usr/include/nptl -fPIC -g -L../../lib -o ../../bin/icegridnode Internal.o DescriptorParser.o DescriptorBuilder.o TraceLevels.o FileCache.o PlatformInfo.o NodeI.o NodeServerAdminRouter.o ServerI.o ServerAdapterI.o Activator.o NodeSessionManager.o AdminCallbackRouter.o RegistryI.o RegistryServerAdminRouter.o InternalRegistryI.o StringApplicationInfoDict.o IdentityObjectInfoDict.o StringAdapterInfoDict.o Database.o Allocatable.o AdapterCache.o ObjectCache.o AllocatableObjectCache.o ServerCache.o NodeCache.o ReplicaCache.o LocatorI.o LocatorRegistryI.o AdminI.o Util.o DescriptorHelper.o NodeSessionI.o ReplicaSessionI.o ReapThread.o SessionI.o AdminSessionI.o SessionServantManager.o Topics.o QueryI.o FileUserAccountMapperI.o ReplicaSessionManager.o WellKnownObjectsManager.o IceGridNode.o -lIceGrid -lIceStormService -lIceBox -lGlacier2 -lIcePatch2 -Wl,-rpath-link,/usr/local/lib64 -lFreeze -Wl,-rpath-link,/usr/local/lib64 -lIceXML -lIceSSL -L/usr/lib64 -lssl -lcrypto -L/usr/lib64 -lIce -lIceUtil -L/usr/lib64/nptl -lpthread -lrt
可以手动执行这条链接语句,把-L/user/lib64去掉就OK了。
关于这个问题,在这里也有说法:
linking error /usr/lib/libIceUtil.so: undefined reference to `pthread_condattr_setclo
Hi,
I am trying to build a project on RHEL4 using GCC 3.4.6 and Ice 3.3.1. Compilation works no problem, but on linking I get the following.
g++ -Wall ... -L/usr/lib -lIce -lIceUtil ...
/usr/lib/libIceUtil.so: undefined reference to `pthread_condattr_setclock'
collect2: ld returned 1 exit status
Perhaps I need to link some other libs as well or install some dependency? The same slice definitions and code build with no warnings/errors using Ice 3.2.0.
Any help greatly appreciated!
阅读(6045) | 评论(2) | 转发(0) |