From 8fa10bfd2bfccd928e9432a88997afdf7af14e19 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 26 Nov 2024 13:08:50 -0800 Subject: [PATCH] Use _GLIBCXX_USE_CXX11_ABI to detect libstdc++, then assume that NVHPC is always in the 1xxx ABI family. --- .../conduit/pybind11_platform_abi_id.h | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index f108192d51..e5f83d155c 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -29,8 +29,6 @@ # define PYBIND11_COMPILER_TYPE "_gcc_cygwin" # elif defined(_MSC_VER) # define PYBIND11_COMPILER_TYPE "_msvc" -# elif defined(__PGI) -# define PYBIND11_COMPILER_TYPE "_pgi" # elif defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__) # define PYBIND11_COMPILER_TYPE "_system" // Assumed compatible with system compiler. # else @@ -66,23 +64,17 @@ # error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." # endif # endif -# elif defined(__NVCOMPILER) // NVHPC (PGI-based). -# define PYBIND11_BUILD_ABI \ - "_gnuc_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(__GNUC__) "_" PYBIND11_PLATFORM_ABI_ID_TOSTRING( \ - __GNUC_MINOR__) "_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) # elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html # define PYBIND11_BUILD_ABI "_abi" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION) -# elif defined(__GXX_ABI_VERSION) -# if __GXX_ABI_VERSION >= 1002 && __GXX_ABI_VERSION < 2000 -# if !defined(_GLIBCXX_USE_CXX11_ABI) -# error "UNEXPECTED: _GLIBCXX_USE_CXX11_ABI not defined: PLEASE REVISE THIS CODE." -# endif -# define PYBIND11_BUILD_ABI \ - "_gxx_abi_1xxx_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING( \ - _GLIBCXX_USE_CXX11_ABI) -# else +# elif defined(_GLIBCXX_USE_CXX11_ABI) // See PR #5439. +# if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION < 1002 || __GXX_ABI_VERSION >= 2000 # error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE." # endif +// // Assume NVHPC it is in the 1xxx ABI family. THIS ASSUMPTION IS NOT FUTURE PROOF, +// // but on balance the best we can do. +# define PYBIND11_BUILD_ABI \ + "_gxx_abi_1xxx_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING( \ + _GLIBCXX_USE_CXX11_ABI) # else # error "Unknown platform or compiler: PLEASE REVISE THIS CODE." # endif