Linux/Ubuntu2012. 6. 2. 21:55
so(shared object) 파일을 찾을수 없을때 발생하는 녀석으로 해결책은 두가지가 존재한다.

1. 사용자 별로 설정
$ vi ~/.bashrc
export LD_LIBRARY_PATH=[so 파일경로]
$ source ~/.bashrc  

2. 전체 시스템 설정
$ sudo vi /etc/ld.so.conf/user.conf
[so 파일경로]
$ sudo ldconfig   


'Linux > Ubuntu' 카테고리의 다른 글

rutorrent on ubuntu 12.04 LTS  (0) 2012.06.07
ubuntu 12.10 에서 모니터 없이 부팅시키기  (0) 2012.06.02
cuda 4.2 linux  (0) 2012.06.02
grub loader 날리기  (0) 2012.04.29
ubuntu 12.04 LTS released  (0) 2012.04.28
Posted by 구차니
부제 : /sbin/ldconfig 와 /etc/ld.so.conf 그리고 LD_LIBRARY_PATH

python을 하는데 so 파일을 쓰도록 했음에도 불구하고
제대로 설치되지 않는 문제가 있었다.
일단 실행을 하려니 libpython2.6.so 을 찾을수 없다는 건데

./configure --enable-shared
make
make install
로 했음에도 불구하고 안된다.

# vi Makefile
 745 # Install everything
 746 install:         altinstall bininstall maninstall
 747
 748 # Install almost everything without disturbing previous versions
 749 altinstall:      altbininstall libinstall inclinstall libainstall \
 750                 sharedinstall oldsharedinstall

위에 내용으로 봐서는, make install 하면은 알아서 sharedinstall 까지 하므로 이상은 없다.

하지만
/sbin/ldconfig -p | grep python
으로 하면
구버전인 2.4만 나온다.

# /sbin/ldconfig -p | grep python
        libpython2.4.so.1.0 (libc6) => /usr/lib/libpython2.4.so.1.0
        libpython2.4.so (libc6) => /usr/lib/libpython2.4.so
        libboost_python.so.2 (libc6) => /usr/lib/libboost_python.so.2
        libboost_python.so (libc6) => /usr/lib/libboost_python.so

파일을 검색해보니
# find /usr -name "libpython*"
/usr/lib/libpython2.4.so
/usr/lib/python2.4/config/libpython2.4.a
/usr/lib/libpython2.4.so.1.0
/usr/lib/gnome-vfs-2.0/modules/libpythonmethod.so
/usr/local/lib/python2.6/config/libpython2.6.a
/usr/local/lib/libpython2.6.so.1.0
/usr/local/lib/libpython2.6.a
/usr/local/lib/libpython2.6.so

/usr/lib에 복사하지 않고
/usr/local/lib 에 복사가 된다.

그런 이유로, 강제로 /usr/local/lib를 참조하도록 해주어야 하는데
LD_LIBRARY_PATH 를 해주어도 반응이 없었다.(뭥미?!)

/etc/ld.so.config 파일을 열어보면(FC6 기준)
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
이런 내용 뿐인데

마지막 줄에
/usr/local/lib/
를 추가해준다.

그리고
/sbin/ldconfig 를 해주고 나서, 다시
/sbin/ldconfig  -p | grep python
를 해주면

# /sbin/ldconfig -p | grep python
        libpython2.6.so.1.0 (libc6) => /usr/local/lib/libpython2.6.so.1.0
        libpython2.6.so (libc6) => /usr/local/lib/libpython2.6.so
        libpython2.4.so.1.0 (libc6) => /usr/lib/libpython2.4.so.1.0
        libpython2.4.so (libc6) => /usr/lib/libpython2.4.so
        libboost_python.so.2 (libc6) => /usr/lib/libboost_python.so.2
        libboost_python.so (libc6) => /usr/lib/libboost_python.so

추가가 된다.
그럼 all right~!


[링크 : http://linux.die.net/man/8/ldconfig]
[링크 : http://seungyeop.kr/blog/textyle/809]
Posted by 구차니
Linux2010. 1. 14. 14:14
우분투에는 /etc/ld.so.conf.d 로 존재한다.
다른 배포판에서는 /etc/ld.so.conf 로 존재하는듯 하다.

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variableduring execution
   - add LIBDIR to the `LD_RUN_PATH' environment variableduring linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

autoconf 에서 출력되는 ld 관련 메시지



3.3. 환경 변수들

여러가지 환경변수는 이 과정을 제어할 수 있다. 그리고 이 과정을 오버라이드하는 환경변수들이 존재한다.
3.3.1. LD_LIBRARY_PATH

이 특별한 실행을 위해 당신은 일시적으로 다른 라이브러리를 대체할 수 있다. 리눅스에서, 환경변수 LD_LIBRARY_PATH는 표준의 디렉토리들을 찾기전에 찾아보게되는 라이브러리의 디렉토리들의 콜론으로 구분되는 셋이다; 이것은 새 라이브러리나 특별히 제작한 표준이 아닌 라이브러리를 디버깅할때 유용하다. 환경변수 LD_PRELOAD는 /etc/ld.so.preload가 하는 것처럼 표준 셋을 오버라이드하는 공유 라이브러리를 함수와 함께 나열한다. 이것들은 /lib/ld-linux.so라는 로더에 의해 구현된다. LD_LIBRARY_PATH가 많은 유닉스 시스템에서 작동하는 반면 모든 시스템에서 작동하지 않는다는 것을 말하고 싶다; 예를들어, HU-UX에서는 이 기능이 환경변수 SHLIB_PATH에 의해서 가능하고, AIX에서는 LIBPATH에 의해 가능하다(같은 문법과, 콜론으로 구분되는 리스트로 가능하다).

LD_LIBRARY_PATH는 개발과 검사를 위해 편리하다. 그러나 보통의 유저의 보통의 사용을 위해서 설치 과정에서 변경되면 안된다; 왜 그런지는 http://www.visi.com/~barr/ldpath.html의 ``Why LD_LIBRARY_PATH is Bad''에서 찾아보라. 하지만, 이 기능은 여전히 개발과 검사를 위해 유용하고, 다른방식으로 해결하지 못하는 것을 해결하는데 유용하다. 만약 당신이 환경변수 LD_LIBRARY_PATH를 설정하고 싶지 않다면, 리눅스에서 당신은 프로그램 로더를 직접 불러서 인자를 넘겨줄수도 있다. 예를들어, 다음은 환경변수 LD_LIBRARY_PATH의 경로 이외의 주어진 PATH를 사용할 것이고, 실행가능 프로그램을 돌릴 것이다.

  /lib/ld-linux.so.2 --library-path PATH EXECUTABLE

인자없이 ld-linux.so를 돌리는 것은 당신이 이렇게 사용하는데에 도움을 줄 것이다. 하지만, 이것을 보통의 용도로 사용하지 마라. 이것들은 디버깅용이다.

[링크 : http://wiki.kldp.org/HOWTO/html/Program-Library-HOWTO/shared-libraries.html]

/sbin/ldconfig - configure dynamic linker run time bindings

Files
/lib/ld.so                run-time linker/loader
/etc/ld.so.conf        File containing a list of colon, space, tab, newline, or comma-separated directories in which to search for libraries.
/etc/ld.so.cache    File containing an ordered list of libraries found in the directories specified in /etc/ld.so.conf.

[링크 : http://linux.die.net/man/8/ldconfig]

pkg-config - Return metainformation about installed libraries

PKG_CONFIG_PATH
    A colon-separated (on Windows, semicolon-separated) list of directories to search for .pc files. The default directory will always be searched after searching the path; the default is libdir/pkgconfig:datadir/pkgconfig where libdir is the libdir where pkg-config and datadir is the datadir where pkg-config was installed.
[링크 : http://linux.die.net/man/1/pkg-config]

[링크 : http://kldp.org/node/71409]
[링크 : http://kldp.org/node/64845]
Posted by 구차니