[Linux]Linux的运行库

1.在编译时使用 -L/user_library_path 制定运行库

2.运行时需要设置 LD_LIBRARY_PATH  环境变量制定动态库所在目录

3.将动态库复制到 /usr/lib 或 /usr/local/lib ,并运行 ldconfig 更新动态库搜索目录

4.在 /edt/ld.so.config.d 中新建一个文件指示新动态库的目录,并运行 ldconfig

5. nm libmpg123.so | grep "mpg123_encsize"  观察 libmpg123.so 是否存在 mpg123_encsize这个函数

6.使用 apt-get install 安装的新动态库也需要运行 ldconfig跟新搜索目录


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 variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'


你可能感兴趣的:([Linux]Linux的运行库)