This is encountered when compiling llvm-gcc-4.2 (yeah, it’s deprecated, but still want to play with it :)).
I compiled an old gcc(4.2.1) in my home directory and set the bin to PATH to work with it.
llvm-gcc compilation failed with the following:
llvm-gcc/obj/./gcc/cc1: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9’ not found.
So seems it didn’t try to search the library directory in the newly installed gcc path, which
I exported LD_LIBRARY_PATH to point to.
This machine uses even older gcc(4.1), and I don’t have permission to create symlink in
/usr/lib(lib64). If there a way to let the search start from the newly installed GCC path?