ld 找不到库,即使使用 ldconfig,甚至 ld -L -lmylib 也打不开
Ld cannot find libraries, even with ldconfig, and even ld -L -lmylib doesn't open
我得到了一个新系统,Ubuntu 18.04.4。
我正在尝试安装我的环境来编译 nvcc,我需要 glew glfw 等。
在这里,我试图通过 运行 make 文件为该程序安装 glew 1.10.0,我得到以下信息(其他安装过程中其他库也会失败):
$ make
cc -shared -Wl,-soname=libGLEW.so.1.10 -o lib/libGLEW.so.1.10.0 tmp/linux/default/shared/glew.o -L/usr/lib -lXmu -lXi -lGL -lXext -lX11
/usr/bin/ld: cannot find -lXmu
/usr/bin/ld: cannot find -lXi
collect2: error: ld returned 1 exit status
Makefile:108: recipe for target 'lib/libGLEW.so.1.10.0' failed
make: *** [lib/libGLEW.so.1.10.0] Error 1
之后sudo ldconfig
上面也没有变化
我什至尝试了以下
$ sudo ld -verbose -L/usr/lib/x86_64-linux-gnu -lXmu
GNU ld (GNU Binutils for Ubuntu) 2.30
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
elf_iamcu
i386linux
elf_l1om
elf_k1om
i386pep
i386pe
using internal linker script:
...省略一些终端输出
==================================================
attempt to open //usr/local/lib/x86_64-linux-gnu/libXmu.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libXmu.a failed
attempt to open //lib/x86_64-linux-gnu/libXmu.so failed
attempt to open //lib/x86_64-linux-gnu/libXmu.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libXmu.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libXmu.a failed
attempt to open //usr/lib/x86_64-linux-gnu64/libXmu.so failed
attempt to open //usr/lib/x86_64-linux-gnu64/libXmu.a failed
attempt to open //usr/local/lib64/libXmu.so failed
attempt to open //usr/local/lib64/libXmu.a failed
attempt to open //lib64/libXmu.so failed
attempt to open //lib64/libXmu.a failed
attempt to open //usr/lib64/libXmu.so failed
attempt to open //usr/lib64/libXmu.a failed
attempt to open //usr/local/lib/libXmu.so failed
attempt to open //usr/local/lib/libXmu.a failed
attempt to open //lib/libXmu.so failed
attempt to open //lib/libXmu.a failed
attempt to open //usr/lib/libXmu.so failed
attempt to open //usr/lib/libXmu.a failed
attempt to open //usr/x86_64-linux-gnu/lib64/libXmu.so failed
attempt to open //usr/x86_64-linux-gnu/lib64/libXmu.a failed
attempt to open //usr/x86_64-linux-gnu/lib/libXmu.so failed
attempt to open //usr/x86_64-linux-gnu/lib/libXmu.a failed
ld: cannot find -lXmu
我真的很困惑,我不知道如何从这一点开始。我是否必须为每个库创建链接器,或者有更简单更正确的方法来执行此操作。
只是为了确认
locate libXmu
/usr/lib/x86_64-linux-gnu/libXmu.so.6
/usr/lib/x86_64-linux-gnu/libXmu.so.6.2.0
/usr/lib/x86_64-linux-gnu/libXmuu.so.1
/usr/lib/x86_64-linux-gnu/libXmuu.so.1.0.0
我相信尽管我已经在 linux 工作了 2 年,但我仍然是一个新手。
我只是
sudo apt-get install libxmu-dev
&
sudo apt-get install libxi-dev
安装成功。
我得到了一个新系统,Ubuntu 18.04.4。 我正在尝试安装我的环境来编译 nvcc,我需要 glew glfw 等。 在这里,我试图通过 运行 make 文件为该程序安装 glew 1.10.0,我得到以下信息(其他安装过程中其他库也会失败):
$ make
cc -shared -Wl,-soname=libGLEW.so.1.10 -o lib/libGLEW.so.1.10.0 tmp/linux/default/shared/glew.o -L/usr/lib -lXmu -lXi -lGL -lXext -lX11
/usr/bin/ld: cannot find -lXmu
/usr/bin/ld: cannot find -lXi
collect2: error: ld returned 1 exit status
Makefile:108: recipe for target 'lib/libGLEW.so.1.10.0' failed
make: *** [lib/libGLEW.so.1.10.0] Error 1
之后sudo ldconfig
上面也没有变化
我什至尝试了以下
$ sudo ld -verbose -L/usr/lib/x86_64-linux-gnu -lXmu
GNU ld (GNU Binutils for Ubuntu) 2.30
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
elf_iamcu
i386linux
elf_l1om
elf_k1om
i386pep
i386pe
using internal linker script:
...省略一些终端输出
==================================================
attempt to open //usr/local/lib/x86_64-linux-gnu/libXmu.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libXmu.a failed
attempt to open //lib/x86_64-linux-gnu/libXmu.so failed
attempt to open //lib/x86_64-linux-gnu/libXmu.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libXmu.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libXmu.a failed
attempt to open //usr/lib/x86_64-linux-gnu64/libXmu.so failed
attempt to open //usr/lib/x86_64-linux-gnu64/libXmu.a failed
attempt to open //usr/local/lib64/libXmu.so failed
attempt to open //usr/local/lib64/libXmu.a failed
attempt to open //lib64/libXmu.so failed
attempt to open //lib64/libXmu.a failed
attempt to open //usr/lib64/libXmu.so failed
attempt to open //usr/lib64/libXmu.a failed
attempt to open //usr/local/lib/libXmu.so failed
attempt to open //usr/local/lib/libXmu.a failed
attempt to open //lib/libXmu.so failed
attempt to open //lib/libXmu.a failed
attempt to open //usr/lib/libXmu.so failed
attempt to open //usr/lib/libXmu.a failed
attempt to open //usr/x86_64-linux-gnu/lib64/libXmu.so failed
attempt to open //usr/x86_64-linux-gnu/lib64/libXmu.a failed
attempt to open //usr/x86_64-linux-gnu/lib/libXmu.so failed
attempt to open //usr/x86_64-linux-gnu/lib/libXmu.a failed
ld: cannot find -lXmu
我真的很困惑,我不知道如何从这一点开始。我是否必须为每个库创建链接器,或者有更简单更正确的方法来执行此操作。 只是为了确认
locate libXmu
/usr/lib/x86_64-linux-gnu/libXmu.so.6
/usr/lib/x86_64-linux-gnu/libXmu.so.6.2.0
/usr/lib/x86_64-linux-gnu/libXmuu.so.1
/usr/lib/x86_64-linux-gnu/libXmuu.so.1.0.0
我相信尽管我已经在 linux 工作了 2 年,但我仍然是一个新手。
我只是
sudo apt-get install libxmu-dev
&
sudo apt-get install libxi-dev
安装成功。