安装gcc 4.9时报错,错误提示Libraries have been installed in: /usr/local/lib/../lib64 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' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages.
时间: 2024-02-14 09:03:33 浏览: 549
runtime library [libssl.so.1.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:/home/
这个错误信息是在安装 gcc 4.9 的过程中出现的,它提示你安装了一些库文件,并给出了一些链接库的建议。
一般来说,正确的解决方法是将 `/usr/local/lib/../lib64` 目录加入到系统的动态链接库搜索路径中。可以通过以下几种方式实现:
1. 使用 `LD_LIBRARY_PATH` 环境变量。可以将以下命令添加到 shell 配置文件(如 ~/.bashrc)中,使其永久生效:
```
export LD_LIBRARY_PATH=/usr/local/lib/../lib64:$LD_LIBRARY_PATH
```
2. 使用 `LD_RUN_PATH` 环境变量。可以将以下命令添加到 shell 配置文件中,使其永久生效:
```
export LD_RUN_PATH=/usr/local/lib/../lib64:$LD_RUN_PATH
```
3. 使用 `-Wl,-rpath` 链接选项。在编译链接时,可以使用以下命令:
```
gcc -o target target.c -L/usr/local/lib/../lib64 -Wl,-rpath=/usr/local/lib/../lib64
```
4. 将 `/usr/local/lib/../lib64` 目录添加到 `/etc/ld.so.conf` 配置文件中,并执行 `ldconfig` 命令更新动态链接库缓存:
```
echo "/usr/local/lib/../lib64" | sudo tee -a /etc/ld.so.conf
sudo ldconfig
```
以上几种方法中,第四种方法是最常用的。你可以先尝试这个方法来解决问题。
阅读全文