달력

52024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'Linux System Programming'에 해당되는 글 1건

  1. 2015.08.07 so loading 오류 문제

컴파일이후에 실행할 때 아래와 비슷하게 특정 so 파일을 찾을수 없다는 에러가 발생하는 문제의 해결

error while loading shared libraries: libwolfssl.so.0.16: cannot open shared object file: No such file or directory

 

1. 문제원인 : runtime에 해당 so파일을 찾지 못해서 발생한다.

 

2. ldd 명령어로 확인하기

ldd 실행파일  과 같이 입력하면 해당 실행파일에서 참조하는 so 들을 볼수 있는데 아래와 같이 libwolfssl.so.0는 찾을수 없다.

swmobile@swmobile-laptop$ ldd echoserver
 linux-gate.so.1 =>  (0x00ca9000)
 libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00d2e000)
 libwolfssl.so.0 => not found
 libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00dce000)
 /lib/ld-linux.so.2 (0x00287000)

3. so 파일의 경로를 등록

 

리눅스 Kernel 2.6 이전 /etc/ld.so.conf 파일에 경로를 등록해주면 된다.

ex) # vi /etc/ld.so.conf
/lib
/usr/lib
/usr/local/lib
/usr/X11R6/lib

리눅스 Kernel 2.6 이후 부터

/etc/ld.so.conf.d 디렉토리에 *.conf 파일 형식으로 설정할 수 있다.

 

문제 해결을 위해서 아래와 같이 경로를 등록했다...

swmobile@swmobile-laptop:~$ cat /etc/ld.so.conf.d/libwolfssl.conf
/usr/local/lib

 

등록 결과 조회...

swmobile@swmobile-laptop:~$ ls -al /etc/ld.so.conf.d
합계 32
drwxr-xr-x   2 root root  4096 2015-08-07 12:08 .
drwxr-xr-x 129 root root 12288 2015-08-07 12:20 ..
lrwxrwxrwx   1 root root    25 2011-08-19 19:25 GL.conf -> /etc/alternatives/gl_conf
-rw-r--r--   1 root root    64 2010-04-23 01:58 i486-linux-gnu.conf
-rw-r--r--   1 root root    18 2010-04-09 19:10 libasound2.conf
-rw-r--r--   1 root root    44 2010-04-22 23:04 libc.conf
-rw-r--r--   1 root root    15 2015-08-07 12:08 libwolfssl.conf


사실 2.6 이전과 동일하다고 볼수 있다.

/etc/ld.so.conf 파일에서 /etc/ld.so.conf.d 의 모든 conf 파일을 include 하고 있다..

 

swmobile@swmobile-laptop:~$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

 

4. ldconfig를 실행

/etc/ld.so.conf 설정된 동적 라이브러리 정보를 /etc/ld.so.cache 파일로 만들어 주는 일을 한다. 이로서 로더는 ld.so.cache 정보를 기반으로 보다 빠르게 라이브러리를 찾아 낼 수 가 있다. ld.so.conf 설정을 변경하면 반드시 ldconfig 명령을 수행하여 cache 를 갱신해 주어야 한다.

 

5. 갱신여부 확인

 

$ ldd echoserver

           linux-gate.so.1 =>  (0x00a12000)

           libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00e19000)

           libwolfssl.so.0 => /usr/local/lib/libwolfssl.so.0 (0x0048c000)

           libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00ae4000)

           /lib/ld-linux.so.2 (0x00823000)

           libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x009a7000)

 

6. 참고

http://blog.daum.net/mzinboy/3

http://whiterussian.tistory.com/entry/error-while-loading-shared-libraries-libmysqlclientso16-cannot-open-shared-object-file-No-such-file-or-directory

 

 

 

Posted by 행복한삶~!!
|