ld 找不到 .so 库
ld cannot find .so libraries
在尝试设置 Python 程序包 (mlabwrap) 时,我收到以下 link 错误:
/usr/bin/ld: cannot find -leng
/usr/bin/ld: cannot find -lmx
/usr/bin/ld: cannot find -lmat
/usr/bin/ld: cannot find -lut
构建命令如下所示:
c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/mlabraw.o -L/usr/local/MATLAB/R2015a/bin/glnx86 -Wl,-R/usr/local/MATLAB/R2015a/bin/glnx86 -leng -lmx -lmat -lut -lstdc++ -o build/lib.linux-x86_64-2.7/mlabrawmodule.so
指定目录的 grep 显示所有必需的共享对象库都存在:
ls /usr/local/MATLAB/R2015a/bin/glnxa64/ | grep "libeng.so\|libmx.so\|libmat.so\|libut.so"
libeng.so
libmat.so
libmx.so
libut.so
有没有人知道为什么 linker 无法识别必要的库?有没有更好的方法来调试 linker 以查看它在哪里寻找这些库?
据我所知,编译字符串的 -L/usr/local/MATLAB/R2015a/bin/glnx86
部分应该将 linker 引导至该文件夹。
/usr/local/MATLAB/R2015a/bin/glnx86
不是
/usr/local/MATLAB/R2015a/bin/glnxa64/
注意 glnxa64
中的 a
。
在尝试设置 Python 程序包 (mlabwrap) 时,我收到以下 link 错误:
/usr/bin/ld: cannot find -leng
/usr/bin/ld: cannot find -lmx
/usr/bin/ld: cannot find -lmat
/usr/bin/ld: cannot find -lut
构建命令如下所示:
c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/mlabraw.o -L/usr/local/MATLAB/R2015a/bin/glnx86 -Wl,-R/usr/local/MATLAB/R2015a/bin/glnx86 -leng -lmx -lmat -lut -lstdc++ -o build/lib.linux-x86_64-2.7/mlabrawmodule.so
指定目录的 grep 显示所有必需的共享对象库都存在:
ls /usr/local/MATLAB/R2015a/bin/glnxa64/ | grep "libeng.so\|libmx.so\|libmat.so\|libut.so"
libeng.so
libmat.so
libmx.so
libut.so
有没有人知道为什么 linker 无法识别必要的库?有没有更好的方法来调试 linker 以查看它在哪里寻找这些库?
据我所知,编译字符串的 -L/usr/local/MATLAB/R2015a/bin/glnx86
部分应该将 linker 引导至该文件夹。
/usr/local/MATLAB/R2015a/bin/glnx86
不是
/usr/local/MATLAB/R2015a/bin/glnxa64/
注意 glnxa64
中的 a
。