我正在尝试使用 gcc 编译一些代码。抛出以下错误:
/usr/bin/ld: cannot find -latomic: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [Vmk_scalar_mult.mk:66: Vmk_scalar_mult] Error 1
rm Vmk_scalar_mult__ALL.verilator_deplist.tmp
make[1]: Leaving directory '/home/.../obj_dir'
make: *** [Makefile:41: link_verilator] Error 2
为了提供有关我的系统的更多信息,我做了ld -latomic --verbose
以下操作,输出如下:
GNU ld (GNU Binutils) 2.38
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
elf_iamcu
elf_l1om
elf_k1om
i386pep
i386pe
elf64bpf
using internal linker script:
==================================================
...
==================================================
ld: mode elf_x86_64
attempt to open /usr/x86_64-pc-linux-gnu/lib64/libatomic.so failed
attempt to open /usr/x86_64-pc-linux-gnu/lib64/libatomic.a failed
attempt to open /usr/lib/libatomic.so succeeded
/usr/lib/libatomic.so
libc.so.6 needed by /usr/lib/libatomic.so
attempt to open /usr/lib/libfakeroot/libc.so.6 failed
attempt to open /opt/intel/mkl/lib/intel64/libc.so.6 failed
attempt to open /opt/intel/mkl/lib/intel64_lin/libc.so.6 failed
attempt to open /usr/lib/openmpi/libc.so.6 failed
attempt to open /usr/x86_64-pc-linux-gnu/lib64/libc.so.6 failed
attempt to open /usr/local/lib/libc.so.6 failed
attempt to open /usr/x86_64-pc-linux-gnu/lib/libc.so.6 failed
attempt to open /usr/lib/libfakeroot/libc.so.6 failed
attempt to open /opt/intel/mkl/lib/intel64/libc.so.6 failed
attempt to open /opt/intel/mkl/lib/intel64_lin/libc.so.6 failed
attempt to open /usr/lib/openmpi/libc.so.6 failed
attempt to open /usr/x86_64-pc-linux-gnu/lib64/libc.so.6 failed
found libc.so.6 at /usr/lib/libc.so.6
ld-linux-x86-64.so.2 needed by /usr/lib/libc.so.6
attempt to open /usr/lib/libfakeroot/ld-linux-x86-64.so.2 failed
attempt to open /opt/intel/mkl/lib/intel64/ld-linux-x86-64.so.2 failed
attempt to open /opt/intel/mkl/lib/intel64_lin/ld-linux-x86-64.so.2 failed
attempt to open /usr/lib32/ld-linux-x86-64.so.2 failed
attempt to open /usr/lib/openmpi/ld-linux-x86-64.so.2 failed
attempt to open /usr/x86_64-pc-linux-gnu/lib64/ld-linux-x86-64.so.2 failed
found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2
ld: warning: cannot find entry symbol _start; not setting start address
以下是有关我当前操作系统的一些信息:
$ uname -a
Linux wishbringer 5.15.41-1-MANJARO #1 SMP PREEMPT Wed May 18 09:20:01 UTC 2022 x86_64 GNU/Linux
我该如何解决上述问题?我已经尝试libatomic_ops 7.6.12-1
从安装https://github.com/ivmai/libatomic_ops
提前致谢!