When executing a compiled file in Linux (. /configure) with collect2: fatal error: cannot find ‘ld’, which is also preceded by gcc: error: unrecognized command line option -V and configure: error: C compiler cannot create executables. When you find that your gcc and the corresponding dependency packages are installed, you still get the error. At this point you look under /usr/bin/ to see if there is an ld. which ld is not found, but you find a file called ld.gold under /usr/bin by running ls -l |grep ld.
Solution:
Copy ld.gold under /usr/bin/ (do not delete the original file) and rename it to ld. You can also create a soft connection.
Re-execute the compilation
Problem found solved!
Brief description.
gcc compiles the source code to .o, then linker links the .o to .so or executable, linker can use ld.bfd, ld.gold or lld.
Read More:
- [Solved] /usr/bin/ld: cannot find crti.o: No such file or directory & /usr/bin/ld: cannot find -lc
- [Solved] Nvml compilation official use case error: collect2: error: ld returned 1 exit status
- [Solved] ERROR: ld.so: object ‘/$LIB/libonion.so‘ from /etc/ld.so.preload
- [Solved] Find command error: find: missing “- exec” parameter solution
- C++ Compile Error: ld returned 1 exit status [How to Solve]
- ./ungrib.exe Start Error: Could not Fould libpng16.so.16 (/etc/ld.so.conf and ldconfig)
- ./configure Command Execute error (Centos7 Install erlang)
- Centos7 Error: initramfs not found
- [Solved] Exception in replication between CentOS virtual machine and host
- Solutions to errors in installing xunsearch engine in centos8.0
- CentOS 8: No URLs in mirrorlist error [How to Solve]
- CentOS/RHEL 7: How to Reinstall GRUB2 from Rescue Mode (EFI)
- [Solved] Virtual Machine Centos7 Startup Error: Entering emergency mode
- [Solved] C++: fatal error: Killed signal terminated program cc1plus
- [Solved] CentOS Use Yum to install dependency: error: rpmdb open failed
- [Solved] CentOS7 python import docker Error: No module named selectors
- [Solved] CentOS Network Card startup error: RTNETLINK answers: File exist
- [Solved] Centos8 openssh Compile Error: error while loading shared libraries
- Error report when executing ifconfig under centos7
- After Centos installation is complete, ifconfig: command not found