我是Ubuntu的新手,在亚马逊的EC2云中运行Ubuntu。
我试图在Ubuntu (i386和amd64)上编译amd64,它不会链接到libdl
g++ -g -O2 -o .libs/DllPlugInTester DllPlugInTester.o CommandLineParser.o -ldl ../../src/cppunit/.libs/libcppunit.so -lm -Wl,--rpath -Wl,/home/ubuntu/cppunit/lib
../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlsym'
../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlopen'
../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlclose'现在我不明白了,因为libdl.so存在并正确地存在于:
ubuntu@domU-12-31-39-0A-98-1A:~/cppunit$ ls /lib/i386-linux-gnu/libdl*
/lib/i386-linux-gnu/libdl-2.15.so /lib/i386-linux-gnu/libdl.so.2但是whereis什么都没有:
ubuntu@domU-12-31-39-0A-98-1A:~/cppunit$ whereis libdl
libdl:安装了libc6:
ubuntu@domU-12-31-39-0A-98-1A:~/cppunit$ sudo apt-get install libc6
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.那为什么我的建筑找不到呢?
uname -r是3.2.0-25-virtual
Fedora上的“普通”whereis如下所示:
[matt cppunit] whereis libdl
libdl: /lib/libdl.so /usr/lib/libdl.so /lib64/libdl.so /usr/lib64/libdl.so有什么想法吗?
编辑:我的/etc/ld.so.conf.d/*.conf似乎是明智的:
ubuntu@domU-12-31-39-0A-98-1A:~$ cat /etc/ld.so.conf.d/*.conf
/usr/lib/i386-linux-gnu/mesa
# Multiarch support
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
/lib/i686-linux-gnu
/usr/lib/i686-linux-gnu
# libc default configuration
/usr/local/lib
# This directive teaches ldconfig to search in nosegneg subdirectories
# and cache the DSOs there with extra bit 1 set in their hwcap match
# fields. In Xen guest kernels, the vDSO tells the dynamic linker to
# search in nosegneg subdirectories and to match this extra hwcap bit
# in the ld.so.cache file.
hwcap 1 nosegneg发布于 2012-07-25 16:46:46
我也碰到了这个64位的ubuntu,gcc 4.6.3,我的预感是链接库的顺序。然而,同样的事情建立在32位之上。我在链接命令的末尾添加了-ldl,并将其链接起来,所以看起来像是链接器问题。您还可以从shell中设置env : LIBS=-ldl,它将生成。
发布于 2013-01-28 21:18:35
因为ld.so.conf用于动态链接器,而不是组装后链接器,因此ld(1)。有人创建了这个新路径,但是没有更新链接器搜索的目录。/lib64或/usr/ libdl 64中应该有用于libdl的链接,或者链接器搜索链接64位对象的路径之一。
这(新路径)是另一个例子,从我的PoV,各种Linux发行版的随机变化,没有充分了解后果或历史。
https://stackoverflow.com/questions/11352991
复制相似问题