diff --git a/python/paddle/utils/cpp_extension/cpp_extension.py b/python/paddle/utils/cpp_extension/cpp_extension.py index 6045ac7d1e7274dc283206c5533b46170c05a621..8eefe548b6c6c26af8500e865e1c76a933bee45c 100644 --- a/python/paddle/utils/cpp_extension/cpp_extension.py +++ b/python/paddle/utils/cpp_extension/cpp_extension.py @@ -427,6 +427,12 @@ class BuildExtension(build_ext, object): elif isinstance(cflags, dict): cflags = cflags['cxx'] + # NOTE(Aurelius84): Since Paddle 2.0, we require gcc version > 5.x, + # so we add this flag to ensure the symbol names from user compiled + # shared library have same ABI suffix with core_(no)avx.so. + # See https://stackoverflow.com/questions/34571583/understanding-gcc-5s-glibcxx-use-cxx11-abi-or-the-new-abi + add_compile_flag(['-D_GLIBCXX_USE_CXX11_ABI=1'], cflags) + add_std_without_repeat( cflags, self.compiler.compiler_type, use_std14=False) original_compile(obj, src, ext, cc_args, cflags, pp_opts)