|
发表于 2006-5-3 17:48:23
|
显示全部楼层
从"Advanced Linux Programming"上抄来的:
When you link a program with a shared library, the linker does not put the full path to the shared library in the resulting executable. Instead, it places only the name of the shared library. When the program is actually run, the system searches for the shared library and loads it. The system searches only /lib and /usr/lib, by default. If a shared library that is linked into your program is installed outside those directories, it will not be found, and the system will refuse to run the program.
One solution to this problem is to use the -Wl, -rpath option when linking the program.
Another solution to this problem is to set the LD_LIBRARY_PATH environment variable when running the program. |
|