Skip to content

Commit 9675d79

Browse files
committed
Use _GLIBCXX_USE_CXX11_ABI flag in conda builds, Add _PYBIND11_BUILD_ABI test for compatibility gcc7 vs gcc9, (pytorch#1083)
* Add _PYBIND11_BUILD_ABI test for compatibility gcc7 vs gcc9 * Using _GLIBCXX_USE_CXX11_ABI in Linux conda builds
1 parent 17b5066 commit 9675d79

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

check_binary.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,12 @@ except RuntimeError as e:
404404
exit 1
405405
fi
406406
fi
407+
408+
###############################################################################
409+
# Check for C++ ABI compatibility between gcc7 and gcc9 compiled binaries
410+
###############################################################################
411+
if [[ "$(uname)" == 'Linux' and ("$PACKAGE_TYPE" == 'conda' or "$PACKAGE_TYPE" == 'manywheel') ]]; then
412+
pushd /tmp
413+
python -c "import torch; exit(0 if torch._C._PYBIND11_BUILD_ABI == '_cxxabi1011' else 1)"
414+
popd
415+
fi

conda/build_pytorch.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ fi
301301
# Build PyTorch with Gloo's TCP_TLS transport
302302
if [[ "$(uname)" == 'Linux' ]]; then
303303
export USE_GLOO_WITH_OPENSSL=1
304+
305+
# Defining and Setting _GLIBCXX_USE_CXX11_ABI flag in order to make sure we are setting
306+
# -fabi-version=11 flag in the pytorch CMake lists
307+
export _GLIBCXX_USE_CXX11_ABI=0
304308
fi
305309

306310
# Loop through all Python versions to build a package for each

conda/pytorch-nightly/meta.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ requirements:
1414
- {{ compiler('c') }} # [win]
1515
- pkg-config # [unix]
1616
- libuv # [unix]
17-
17+
1818
host:
1919
- python
2020
- setuptools
@@ -80,6 +80,7 @@ build:
8080
- BUILD_TEST # [unix]
8181
- USE_PYTORCH_METAL_EXPORT # [osx]
8282
- USE_COREML_DELEGATE # [osx]
83+
- _GLIBCXX_USE_CXX11_ABI # [unix]
8384

8485
test:
8586
imports:

0 commit comments

Comments
 (0)