c++ 如何让ld在conda中找到libs

ss2ws0br  于 2023-03-05  发布在  其他
关注(0)|答案(1)|浏览(183)

我试图编译minimap 2(在这个repo https://github.com/lh3/minimap2.git)从源代码下的conda环境,c编译器也安装了conda.和它未能链接到zlib:

<conda_path>/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status

只需运行“<conda_path>/bin/x86_64-conda_cos6-linux-gnu-cc -lz”即可重现此错误
但如果运行“ld-lz--verbose”,它将工作

$ which ld
/usr/bin/ld
$ ld -lz --verbose
(sth not useful)
===
attempt to open //usr/x86_64-redhat-linux/lib64/libz.so failed
attempt to open //usr/x86_64-redhat-linux/lib64/libz.a failed
attempt to open //usr/lib64/libz.so succeeded
-lz (//usr/lib64/libz.so)
libc.so.6 needed by //usr/lib64/libz.so
found libc.so.6 at /usr/lib64//libc.so.6
ld-linux-x86-64.so.2 needed by /usr/lib64//libc.so.6
found ld-linux-x86-64.so.2 at /usr/lib64//ld-linux-x86-64.so.2
ld: warning: cannot find entry symbol _start; not setting start address

我已经将/usr/lib 64/添加到LIBRARY_PATH和LD_LIBRARY_PATH中,但没有任何更改,因此如何解决此问题?如有任何帮助,我们将不胜感激

mkshixfv

mkshixfv1#

我有类似的问题,下面可以解决它:

快速解决方案
cd /path/to/your/conda/env/compiler_compat/ && mv ld ld.bak
# or just remove it if you don't care.
推荐?
conda install -c conda-forge ld_impl_linux-64  # Modify the suffix to correspond with your platform

相关问题