我经常从源代码构建各种库以供使用,例如 gmp-6.1.2、mpfr-4.0.1 和 gcc-7.x。这样做时,我更喜欢使用,--prefix=/usr/local/gcc-7.2.0
所以我确切地知道它的安装位置并且不会弄乱现有的库。然后我基本上只知道最后make install
告诉我的是更新或设置LD_LIBRARY_PATH
,有时但不总是LD_RUN_PATH
。
大多数情况下,我只是LD_LIBRARY_PATH
稍后根据需要手动设置,或者以类似的方式全局设置它/etc/bash.bashrc.local
并且有效。
这make install
就是说:
Libraries have been installed in:
/usr/local/mfprtest/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 variable …
Run Code Online (Sandbox Code Playgroud)