我正在尝试在我的Ubuntu 16.04系统上编译第三方软件包,以便在Anaconda中使用它,这是默认的Python环境。当我运行make
时,编译停止并出现以下错误:
/home/myname/anaconda3/compiler_compat/ld: cannot find -lfftw3_omp
/home/myname/anaconda3/compiler_compat/ld: cannot find -lm
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Makefile:109: recipe for target '_shtns.so' failed
make: *** [_shtns.so] Error 1
似乎Anaconda无法访问错误消息中提到的两个库。库fftw3_omp.so肯定存在于文件夹/home/myname/usr/lib
中。不过,我不确定-lm
是什么。如何正确链接缺少的库?
我得到了类似的错误:
/ home / sfchen / anaconda3 / envs / dlpy2 / compiler_compat / ld:找不到-lpthread / home / sfchen / anaconda3 / envs / dlpy2 / compiler_compat / ld:找不到-lc
并通过以下步骤解决。
输出如下:
attempt to open //usr/local/lib/x86_64-linux-gnu/libpthread.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libpthread.a failed
attempt to open //lib/x86_64-linux-gnu/libpthread.so failed
attempt to open //lib/x86_64-linux-gnu/libpthread.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libpthread.so succeeded
opened script file //usr/lib/x86_64-linux-gnu/libpthread.so
opened script file //usr/lib/x86_64-linux-gnu/libpthread.so
attempt to open /lib/x86_64-linux-gnu/libpthread.so.0 succeeded
/lib/x86_64-linux-gnu/libpthread.so.0
attempt to open /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a succeeded
libc.so.6 needed by /lib/x86_64-linux-gnu/libpthread.so.0
found libc.so.6 at //lib/x86_64-linux-gnu/libc.so.6
ld-linux-x86-64.so.2 needed by /lib/x86_64-linux-gnu/libpthread.so.0
found ld-linux-x86-64.so.2 at //lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
ld: warning: cannot find entry symbol _start; not setting start address
attempt to open //usr/lib/x86_64-linux-gnu/libpthread.so succeeded
得到路径1 = /usr/lib/x86_64-linux-gnu/libpthread.so
/home/sfchen/anaconda3/envs/dlpy2/compiler_compat/ld: cannot find -lpthread
得到path2 = /home/sfchen/anaconda3/envs/dlpy2/compiler_compat/
特别,
ln -s /usr/lib/x86_64-linux-gnu/libpthread.so /home/sfchen/anaconda3/envs/dlpy2/compiler_compat/
这就是全部,希望它可能会有所帮助!