Builds onnxruntime + eager mode with the same value for _GLIBCXX_USE_CXX11_ABI as pytorch (#10114)

* add _GLIBCXX_USE_CXX11_ABI
* restrict to eager mode
This commit is contained in:
Xavier Dupré 2022-01-25 11:25:31 +01:00 committed by GitHub
parent 790c3be7e9
commit 6e95c0316d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -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)

View file

@ -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]