[Soldier] fatal error: cannot find 'ld' When Building with GCC 9
I was attempting to build with the provided gcc 9 in the soldier docker image (registry.gitlab.steamos.cloud/steamrt/soldier/sdk:0.20210906.1) due to issues with gcc 8 with the particular project.
I ran the following commands to attempt to set gcc 9 as the default, which has worked with similar systems in the past:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
sudo update-alternatives --set gcc "/usr/bin/gcc-9"
sudo update-alternatives --set g++ "/usr/bin/g++-9"
export CXX='g++-9'
export CC='gcc-9'
It seems to have been failing at the linking stage, with this error below:
/usr/bin/g++-9 -Werror=delete-non-virtual-dtor -Wno-conversion-null -fuse-ld=lld -Werror=delete-non-virtual-dtor -Wno-conversion-null -fuse-ld=lld -O2 -ftree-vectorize -ffast-math Source/XPrm/CMakeFiles/XPrm.dir/StdAfx.cpp.o Source/XPrm/CMakeFiles/XPrm.dir/Token.cpp.o Source/XPrm/CMakeFiles/XPrm.dir/XPrm.cpp.o -o Source/XPrm/XPrm Source/XTool/libXTool.a /usr/lib/x86_64-linux-gnu/libSDL2.so -lpthread Source/Exodus/libExodus.a -ldl && :
collect2: fatal error: cannot find 'ld'
compilation terminated.
This was an attempt to build this project: https://github.com/KranX/Perimeter
GCC 8 had issues completing the build of dxvk-native
Also, there was another build for another project that I needed gcc 9 for that when I used the gcc 9 commands above, it complained about missing libgcc_s libraries. I was able to work around it with this, but it seems strange:
cp -rfv /usr/lib/gcc/x86_64-linux-gnu/8/libgcc*.so* /usr/lib/gcc-9/lib/