我正在尝试用gcc 4.2.0在AIX6.1上编译omniORB。
初始化不起作用,因为它正在拾取非pthreaded库。
如果我将LIBPATH设置为/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/,omniNames将无法工作,因为streams接口会给出一个异常。
将LIBPATH设置为/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/pthread似乎是可行的,但是其他非pthreaded程序将获得pthreaded lib,这可能会导致问题...
链接如下所示:
g++ -o omniNames -O2 -Wall -Wno-unused -fexceptions -Wl,-brtl -Wl,-blibpath:/lib:/usr/lib:/opt/dbx/omniORB-4/lib -L../../../lib -L../../../../lib omniNames.o NamingContext_i.o log.o omniNamesWin.o -lomniORB4-ar -lomnithread34 -lpthreads我如何解决这个问题??
请注意,我曾尝试使用配置参数更改libpath,但没有成功。
发布于 2010-12-21 18:46:22
通过正确设置LIBPATH的包装器脚本启动可能是最简单的。
还有ELF的RUNPATH/RPATH特性,它允许在可执行文件中嵌入动态库的搜索路径;但是我不知道AIX是否实现了它。如果是这样,并使用与Linux和Solaris相同的参数进行设置,则DT_RUNPATH为-Wl,--enable-new-dtags -Wl,-R$(RUNPATH),DT_RPATH为-Wl,--disable-new-dtags -Wl,-R$(RPATH);您可能还想简单地测试-Wl,-R$(RPATH) (这可能会设置DT_RPATH)。
发布于 2010-12-21 18:52:28
每个操作系统都使用自己独特的一组环境变量来决定在何处搜索共享库。
大多数类UNIX系统都使用LD_LIBRARY_PATH (但它有所不同)。
我发现找到要使用的环境变量的最有效方法是在您要构建的平台上查看dlopen()的手册页。
编辑的:还要注意,这些变量的作用类似于PATH环境变量,因为它们是以':‘分隔的路径列表。所以你能不能不这样设置环境:
# Using tcsh syntax for setting environment. Your shell may very.
setenv LIBPATH "/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/:/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/pthread"发布于 2011-01-04 00:11:06
AIX ld手册页说明:
Note: If you specify a shared object, or an archive file containing a
shared object, with an absolute or relative path name, instead of with
the -lName flag, the path name is included in the import file ID string
in the loader section of the output file. You can override this
behavior with the -bnoipath option.因此,只需指定/my/path/to/libfoo.so而不是-lfoo,就可以得到您想要的行为。
https://stackoverflow.com/questions/4498331
复制相似问题