'ld -v leads to segmentation fault in WSL2

I am getting segmentation faults while compiling a project with gcc on a WSL2 Ubuntu 20.04 installation.

I narrowed the problem down to the linker in my opinion:

> ld -v
Segmentation fault

The system information from uname -a is Linux Spectre 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

The install is fresh for this project.

What could cause this problem? Thanks in advance.



Solution 1:[1]

You always find the solution just after you ask.

If you just reinstall build-essentials it wont work.

Thus remove binutils and make. Then install again. Ie:

sudo apt purge binutils
sudo apt remove make
sudo apt autoremove
sudo apt install build-essential

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 NosLegends