프로그램 컴파일 후 실행하는 중 "error while loading shared libraries: " 를 만난 경우

Error Message
--------------------------------------------------------------------------------------------
./실행파일명: error while loading shared libraries: 라이브러리 명: cannot open shared object file: No such file or directory


Why this error occurs
--------------------------------------------------------------------------------------------
.so 같은 동적 라이브러리 같은경우

이런 경우 동적 라이브러리 경로가 환경변수로 등록이 되어있어야

실행시 참조를 할 수 있다.


How to register library path
--------------------------------------------------------------------------------------------

등록하는 방법이 몇가지 있는데 2개만 소개한다.

1. 환경변수 LD_LIBRARY_PATH 에 추가하기 (루트 계정이 필요없고 간편하니 추천!!)

      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:추가할 라이브러리 경로

2. /etc/ld/so/conf 에 해당 디렉토리를 등록 (루트 계정으로 로그인후 파일을 수정한다!!)

3. /etc/ld.so.conf 에 추가하고 싶은 라이브러리가 있는 디렉토리를 지정하고 ldconfig -v 명령어로
   적용시킨다.

출처: https://finsternis.tistory.com/182 [Finsternis]

댓글

이 블로그의 인기 게시물

[라즈베리파이] Openssl 설치 1.0.1

OpenPose를 이용한 사람의 움직임 감지(Human Pose Estimation)

라즈베리파이-QT5 설치