Because I want to use C++20 standard, I need to use GCC12, but the default compiler of Ubuntu20 is GCC9, so I have to compile and install a GCC trunk by myself.
I didn’t expect to have so many problems doing something that sounds so simple, so I’ll write a little bit of text to document it.
Download source code
Wait patiently for the compilation to complete, depending on the performance of the machine.
After installing gcc, I don’t know why it reports an error when compiling LLVM.
strings /lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX you can see that there is indeed no
ls -al /lib/x86_64-linux-gnu/libstdc++.so.6 you can see that this is a soft link
Obviously this is still an old version of
libstdc++, and I’m not sure why it’s doing this -_-
The solution is straightforward, just re-link
libstdc++.so.6 to our newly compiled version: