LTDL_LIBRARY_PATH 和 LD_LIBRARY_PATH 有什么区别?

What is the difference betweend LTDL_LIBRARY_PATH and LD_LIBRARY_PATH?

在编译和链接CC++代码时,LTDL_LIBRARY_PATHLD_LIBRARY_PATH环境变量的作用是什么?另外它们有什么区别呢?

谢谢

LTDL_LIBRARY_PATHlibtool library 设置库搜索路径,helper/portability 库用于使用共享库。该库将在搜索 LD_LIBRARY_PATH 之前搜索此路径中的目录,这是一个为系统的共享库加载程序设置搜索路径的环境变量。

来自libtool documentation

If libltdl cannot find the library and the file name filename does not have a directory component it will additionally look in the following search paths for the module (in the following order):

  • user-defined search path: This search path can be changed by the program using the functions lt_dlsetsearchpath, lt_dladdsearchdir and lt_dlinsertsearchdir.
  • libltdl’s search path: This search path is the value of the environment variable LTDL_LIBRARY_PATH.
  • system library search path: The system dependent library search path (e.g. on GNU/Linux it is LD_LIBRARY_PATH)

如上所述,LD_LIBRARY_PATH is an environment variable that the system will use 搜索共享库。