2012-07-05 4 views
1

저는 Ubuntu를 처음 사용하고 있으며 Amazon EC2 클라우드에서 Ubuntu를 실행 중입니다.우분투 EC2 인스턴스에서 libdl.so를 찾을 수 없습니다.

나는 우분투 상자 (i386amd64)에 cppunit를 컴파일하려고하고 libdl.so이 존재하고 올바른으로는 이해가 안 이제 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' 

에 연결되지 않습니다

[email protected]:~/cppunit$ whereis libdl 
libdl: 
:
[email protected]:~/cppunit$ ls /lib/i386-linux-gnu/libdl* 
/lib/i386-linux-gnu/libdl-2.15.so /lib/i386-linux-gnu/libdl.so.2 

그러나 whereis는 아무 상관이 없다

libc6가 설치됩니다

[email protected]:~/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

입니다 페도라에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이 합리적인 것 같다

[email protected]:~$ 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 

답변

3

가 나는 또한 64 비트 우분투, GCC 4.6.3에서이 우연히 내 직감이 링크 LIB의 순서였다. 그러나 같은 것은 32 비트를 기반으로합니다. 링크 명령 끝에 -ldl을 추가했는데 링커가 링커 문제와 비슷한 것처럼 보입니다. 또한 env var : LIBS = -ldl을 쉘에서 설정할 수 있으며 빌드됩니다.

+0

이것은 정확히 우리가 발견 한 것입니다. 32 비트에서 작동하지만 64 비트에서 작동한다는 것은 매우 이상합니다. –

1

ld.so.conf는 동적 링커를위한 것이므로 post-assembly 링커, ld (1)가 아닙니다. 누군가이 새로운 경로를 만들었지 만 링커에서 검색하는 디렉토리는 업데이트하지 않았습니다. libdl에 대한/lib64 또는/usr/lib64 또는 링커가 64 비트 객체를 연결하기 위해 검색하는 경로 중 하나에 링크가 있어야합니다.

이 새로운 경로는 결과 나 기록을 완전히 이해하지 않고 다양한 Linux 배포판이 만드는 임의의 변경 사항을 보여주는 나의 예입니다.

관련 문제