https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58638
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- I think the right fix is --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -120,6 +120,11 @@ if test "$enable_shared" = yes; then glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX" glibcxx_compiler_shared_flag="-D_GLIBCXX_SHARED" +else if test "${with_pic+set}" = set; then + glibcxx_lt_pic_flag="-prefer-pic" + glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX" + glibcxx_compiler_shared_flag= + else glibcxx_lt_pic_flag= glibcxx_compiler_pic_flag= Otherwise we define _GLIBCXX_SHARED for non-shared builds and get unwanted (and useless) symbols in the static lib.