diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 07ce345345..185d5c0783 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -304,6 +304,10 @@ if (NOT MSVC AND NOT onnxruntime_ENABLE_BITCODE) string(APPEND CMAKE_C_FLAGS " -ffunction-sections -fdata-sections") endif() +if (onnxruntime_ENABLE_EAGER_MODE) + string(APPEND CMAKE_CXX_FLAGS " -D_GLIBCXX_USE_CXX11_ABI=${_GLIBCXX_USE_CXX11_ABI}") +endif() + if (onnxruntime_BUILD_WEBASSEMBLY) # Enable LTO for release single-thread build if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT onnxruntime_ENABLE_WEBASSEMBLY_THREADS) diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 56272d448a..e4d3375587 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -1080,6 +1080,7 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home if args.build_eager_mode: import torch cmake_args += ["-Donnxruntime_PREBUILT_PYTORCH_PATH=%s" % os.path.dirname(torch.__file__)] + cmake_args += ['-D_GLIBCXX_USE_CXX11_ABI=' + str(int(torch._C._GLIBCXX_USE_CXX11_ABI))] cmake_args += ["-D{}".format(define) for define in cmake_extra_defines]