问题
I actually can not compile a simple "helloworld" in C. When I type "gcc hello.c" the output is: collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
Have someone an idea?
I tried to reinstall gcc,g++,make,cmake,binutils. None of this things worked. When I type just "ld" in the terminal the output is: "Segmentation Fault"
回答1:
I could solve it with
sudo apt purge binutils sudo apt remove make sudo apt autoremove sudo apt install build-essential
I don't know why it works with build-essential...
回答2:
Have you updated any of your library? I think there might be some library missing in this case. Try doing the following :
which gcc
You will get output as :
/usr/bin/gcc
Then check the library using :
ldd /usr/bin/gcc
This will give you the library as well as its shared object. Check if all are available.
Also check gcc version to check if 'gcc' binary is working.
gcc --version
回答3:
You may be hitting this old issue. https://bugzilla.redhat.com/show_bug.cgi?id=1557346 (from March 2018, and binutils 2.25, 2.27).
Update your binutils.
For example:
# yum groupinstall Development Tools
or
# apt-get install build-essential
and Install Kernel Source
# apt-get install linux-headers-$(uname -r)
来源:https://stackoverflow.com/questions/57051568/collect2-fatal-error-ld-terminated-with-signal-11-segmentation-fault