From 14f8425ce62fde83735f9504d9966e628e5b43b8 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 10 Nov 2024 15:27:14 -0800 Subject: [PATCH 01/26] THIS IS JUST A START: First attempt to combine information from PR #4953 and PR #5437 --- .../pybind11/conduit/pybind11_platform_abi_id.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index a7733bcf5c..f1179e69a0 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -54,9 +54,7 @@ #endif #ifndef PYBIND11_BUILD_ABI -# if defined(__GXX_ABI_VERSION) // Linux/OSX. -# define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_PLATFORM_ABI_ID_TOSTRING(__GXX_ABI_VERSION) -# elif defined(_MSC_VER) // See PR #4953. +# if defined(_MSC_VER) // See PR #4953. # if defined(_MT) && defined(_DLL) // Corresponding to CL command line options /MD or /MDd. # if (_MSC_VER) / 100 == 19 # define PYBIND11_BUILD_ABI "_md_mscver19" @@ -72,8 +70,17 @@ # error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." # endif # endif -# elif defined(__NVCOMPILER) // NVHPC (PGI-based). -# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB? +# elif defined(__NVCOMPILER) // NVHPC (PGI-based). +# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB? +# elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html +# define PYBIND11_BUILD_ABI "_libcpp" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION) +# elif defined(__GXX_ABI_VERSION) +# if __GXX_ABI_VERSION >= 1002 && defined(_GLIBCXX_USE_CXX11_ABI) +# define PYBIND11_BUILD_ABI \ + "_usecxx11" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) +# else +# error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE." +# endif # else # error "Unknown platform or compiler: PLEASE REVISE THIS CODE." # endif From b72c42d489c46db317c23c1af6c1065585cf1996 Mon Sep 17 00:00:00 2001 From: "Marcus D. Hanwell" Date: Wed, 20 Nov 2024 16:37:16 -0500 Subject: [PATCH 02/26] Include GXX_ABI and USE_CXX in the identifier Further constrain to GXX_ABI 1002 or greater and less than 2000, hopefully future proof by summarizing that as `1` along with CXX11 on or off. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index f1179e69a0..30743e1121 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -75,9 +75,9 @@ # elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html # define PYBIND11_BUILD_ABI "_libcpp" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION) # elif defined(__GXX_ABI_VERSION) -# if __GXX_ABI_VERSION >= 1002 && defined(_GLIBCXX_USE_CXX11_ABI) +# if __GXX_ABI_VERSION >= 1002 && __GXX_ABI_VERSION < 2000 && defined(_GLIBCXX_USE_CXX11_ABI) # define PYBIND11_BUILD_ABI \ - "_usecxx11" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) + "_gxx_abi_1_usecxx11_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) # else # error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE." # endif From 8369fdce4ba1c338bc2d5eb57238e2215dc2905d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:39:53 +0000 Subject: [PATCH 03/26] style: pre-commit fixes --- include/pybind11/conduit/pybind11_platform_abi_id.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 30743e1121..54c8097535 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -75,7 +75,8 @@ # elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html # define PYBIND11_BUILD_ABI "_libcpp" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION) # elif defined(__GXX_ABI_VERSION) -# if __GXX_ABI_VERSION >= 1002 && __GXX_ABI_VERSION < 2000 && defined(_GLIBCXX_USE_CXX11_ABI) +# if __GXX_ABI_VERSION >= 1002 && __GXX_ABI_VERSION < 2000 \ + && defined(_GLIBCXX_USE_CXX11_ABI) # define PYBIND11_BUILD_ABI \ "_gxx_abi_1_usecxx11_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) # else From 476c322fec2f2136b498229ec75b8f4b7a139bce Mon Sep 17 00:00:00 2001 From: "Marcus D. Hanwell" Date: Wed, 20 Nov 2024 19:44:36 -0500 Subject: [PATCH 04/26] Use `gxx_abi_1xxx` and simplify the Clang string After discussions with Ralf Grosse-Kunstleve we think these would make good identifiers that are concise and clear. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 54c8097535..9f173c91d0 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -73,12 +73,12 @@ # elif defined(__NVCOMPILER) // NVHPC (PGI-based). # define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB? # elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html -# define PYBIND11_BUILD_ABI "_libcpp" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION) +# 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 \ && defined(_GLIBCXX_USE_CXX11_ABI) # define PYBIND11_BUILD_ABI \ - "_gxx_abi_1_usecxx11_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) + "_gxx_abi_1xxx_usecxx11_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) # else # error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE." # endif From 271720fde97f72d0c0002619114bd9edea5bc95f Mon Sep 17 00:00:00 2001 From: "Marcus D. Hanwell" Date: Wed, 20 Nov 2024 20:10:08 -0500 Subject: [PATCH 05/26] Error if `_GLIBCXX_USE_CXX11_ABI` is not defined Within the `__GXX_ABI_VERSION` block this should always be defined, guard against unexpected defines and make the error obvious. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 9f173c91d0..7e9b801d32 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -75,8 +75,10 @@ # 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 \ - && defined(_GLIBCXX_USE_CXX11_ABI) +# if __GXX_ABI_VERSION >= 1002 && __GXX_ABI_VERSION < 2000 +# if !defined(_GLIBCXX_USE_CXX11_ABI) +# error "UNEXPECTED: _GLIBCXX_USE_CXX11_ABI not defined" +# endif # define PYBIND11_BUILD_ABI \ "_gxx_abi_1xxx_usecxx11_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) # else From 28081fc8c8e861477b83cddd145ab32299acf344 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 24 Nov 2024 12:45:11 -0800 Subject: [PATCH 06/26] Change `usecxx11` to `use_cxx11_abi` for correspondence with `_GLIBCXX_USE_CXX11_ABI` (similarly to `gxx_abi` for `__GXX_ABI_VERSION`). --- include/pybind11/conduit/pybind11_platform_abi_id.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 7e9b801d32..d7c0168925 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -77,10 +77,11 @@ # 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" +# error "UNEXPECTED: _GLIBCXX_USE_CXX11_ABI not defined: PLEASE REVISE THIS CODE." # endif # define PYBIND11_BUILD_ABI \ - "_gxx_abi_1xxx_usecxx11_" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_GLIBCXX_USE_CXX11_ABI) + "_gxx_abi_1xxx_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING( \ + _GLIBCXX_USE_CXX11_ABI) # else # error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE." # endif From fe2dbcbb59a16554ad0c40cceb3f85f63282a274 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 24 Nov 2024 13:05:16 -0800 Subject: [PATCH 07/26] `PYBIND11_COMPILER_TYPE` overhaul, mainly: replace `_icc`, `_clang`, `_gcc` with `_system` --- .../conduit/pybind11_platform_abi_id.h | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index d7c0168925..1481d6e4d2 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -23,22 +23,18 @@ // A user can manually set this string if they know their // compiler is compatible. #ifndef PYBIND11_COMPILER_TYPE -# if defined(_MSC_VER) -# define PYBIND11_COMPILER_TYPE "_msvc" -# elif defined(__INTEL_COMPILER) -# define PYBIND11_COMPILER_TYPE "_icc" -# elif defined(__clang__) -# define PYBIND11_COMPILER_TYPE "_clang" -# elif defined(__PGI) -# define PYBIND11_COMPILER_TYPE "_pgi" -# elif defined(__MINGW32__) +# if defined(__MINGW32__) # define PYBIND11_COMPILER_TYPE "_mingw" # elif defined(__CYGWIN__) # define PYBIND11_COMPILER_TYPE "_gcc_cygwin" -# elif defined(__GNUC__) -# define PYBIND11_COMPILER_TYPE "_gcc" +# 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 -# define PYBIND11_COMPILER_TYPE "_unknown" +# error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." # endif #endif From 9fc951588594c48d4bfd440cd985ffee7be57ae4 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 25 Nov 2024 11:33:41 -0800 Subject: [PATCH 08/26] Add NVHPC (__PGI) to the list of compilers compatible with system compiler. See comment by @robertmaynard: https://github.com/pybind/pybind11/pull/5439#issuecomment-2498839010 --- include/pybind11/conduit/pybind11_platform_abi_id.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 1481d6e4d2..d1f22329ad 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -29,9 +29,7 @@ # 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__) +# elif defined(__INTEL_COMPILER) || defined(__PGI) || defined(__clang__) || defined(__GNUC__) # define PYBIND11_COMPILER_TYPE "_system" // Assumed compatible with system compiler. # else # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." From d412303e727923571bfd9b907809b1d73a045b34 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 25 Nov 2024 13:24:43 -0800 Subject: [PATCH 09/26] Fix oversight: remove __NVCOMPILER elif branch in PYBIND11_BUILD_ABI block. Also add comment pointing to this PR (#5439). --- include/pybind11/conduit/pybind11_platform_abi_id.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index d1f22329ad..f1ab740d62 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -64,11 +64,9 @@ # error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." # endif # endif -# elif defined(__NVCOMPILER) // NVHPC (PGI-based). -# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB? # 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) +# elif defined(__GXX_ABI_VERSION) // See PR #5439. # 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." From b6ccce35e69f1f14da4ed7116c79a2ce43c019b2 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 26 Nov 2024 00:07:02 -0800 Subject: [PATCH 10/26] Revert "Fix oversight: remove __NVCOMPILER elif branch in PYBIND11_BUILD_ABI block." This reverts commit d412303e727923571bfd9b907809b1d73a045b34. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index f1ab740d62..d1f22329ad 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -64,9 +64,11 @@ # error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." # endif # endif +# elif defined(__NVCOMPILER) // NVHPC (PGI-based). +# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB? # 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) // See PR #5439. +# 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." From a58439866de86b14544bbb37ee159028742ca40c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 26 Nov 2024 00:07:06 -0800 Subject: [PATCH 11/26] Revert "Add NVHPC (__PGI) to the list of compilers compatible with system compiler." This reverts commit 9fc951588594c48d4bfd440cd985ffee7be57ae4. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index d1f22329ad..1481d6e4d2 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -29,7 +29,9 @@ # define PYBIND11_COMPILER_TYPE "_gcc_cygwin" # elif defined(_MSC_VER) # define PYBIND11_COMPILER_TYPE "_msvc" -# elif defined(__INTEL_COMPILER) || defined(__PGI) || defined(__clang__) || defined(__GNUC__) +# 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 # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." From 23a5f2b6f8e3762a3993b52933a44029c8f5dbba Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 26 Nov 2024 00:22:43 -0800 Subject: [PATCH 12/26] Define NVHPC PYBIND11_BUILD_ABI using __GNUC__, __GNUC_MINOR__, _GLIBCXX_USE_CXX11_ABI --- include/pybind11/conduit/pybind11_platform_abi_id.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 1481d6e4d2..f108192d51 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -66,8 +66,10 @@ # error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE." # endif # endif -# elif defined(__NVCOMPILER) // NVHPC (PGI-based). -# define PYBIND11_BUILD_ABI "" // TODO: What should be here, to prevent UB? +# 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) 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 13/26] 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 From 02daf15b74e7b22c563ed77113c1993af59b3cb8 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 26 Nov 2024 14:40:21 -0800 Subject: [PATCH 14/26] Enhance NVHPC comment and limited future proofing. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index e5f83d155c..af9a68ff01 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -67,11 +67,17 @@ # 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(_GLIBCXX_USE_CXX11_ABI) // See PR #5439. +# if defined(__NVCOMPILER) +// // Assume that NVHPC is in the 1xxx ABI family. +// // THIS ASSUMPTION IS NOT FUTURE PROOF but apparently the best we can do. +// // Please let us know if there is a way to validate the assumption here. +# elif !defined(__GXX_ABI_VERSION) +# error \ + "Unknown platform or compiler (_GLIBCXX_USE_CXX11_ABI): PLEASE REVISE THIS CODE." +# endif # 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) From 3f90808a59a6fdb8a5e6f016f30a2dc257b47b18 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 1 Dec 2024 11:27:28 -0800 Subject: [PATCH 15/26] The `PYBIND11_STDLIB` is obsolete but kept around to maintain backward compatibility. --- .../pybind11/conduit/pybind11_platform_abi_id.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index af9a68ff01..d3786f5e11 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -36,15 +36,10 @@ # endif #endif -// Also standard libs +// PR #5439 made this macro obsolete. However, there are many manipulations of this macro in the +// wild. Therefore, to maintain backward compatibility, it is kept around. #ifndef PYBIND11_STDLIB -# if defined(_LIBCPP_VERSION) -# define PYBIND11_STDLIB "_libcpp" -# elif defined(__GLIBCXX__) || defined(__GLIBCPP__) -# define PYBIND11_STDLIB "_libstdcpp" -# else -# define PYBIND11_STDLIB "" -# endif +# define PYBIND11_STDLIB "" #endif #ifndef PYBIND11_BUILD_ABI @@ -65,7 +60,8 @@ # endif # endif # 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) +# define PYBIND11_BUILD_ABI \ + "_libcpp_abi" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION) # elif defined(_GLIBCXX_USE_CXX11_ABI) // See PR #5439. # if defined(__NVCOMPILER) // // Assume that NVHPC is in the 1xxx ABI family. @@ -79,7 +75,7 @@ # error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE." # endif # define PYBIND11_BUILD_ABI \ - "_gxx_abi_1xxx_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING( \ + "_libstdcpp_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." From b47be2d359f57d00b658a71952c9ef6555057c6c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 1 Dec 2024 11:46:51 -0800 Subject: [PATCH 16/26] Move `PYBIND11_BUILD_TYPE` down in the file, so that the order of macro definitions is the same as in the list defining `PYBIND11_PLATFORM_ABI_ID` --- .../pybind11/conduit/pybind11_platform_abi_id.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index d3786f5e11..267e2db3d1 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -12,13 +12,6 @@ #define PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x) #x #define PYBIND11_PLATFORM_ABI_ID_TOSTRING(x) PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x) -// On MSVC, debug and release builds are not ABI-compatible! -#if defined(_MSC_VER) && defined(_DEBUG) -# define PYBIND11_BUILD_TYPE "_debug" -#else -# define PYBIND11_BUILD_TYPE "" -#endif - // Let's assume that different compilers are ABI-incompatible. // A user can manually set this string if they know their // compiler is compatible. @@ -82,6 +75,14 @@ # endif #endif +// On MSVC, debug and release builds are not ABI-compatible! +#if defined(_MSC_VER) && defined(_DEBUG) +# define PYBIND11_BUILD_TYPE "_debug" +#else +# define PYBIND11_BUILD_TYPE "" +#endif + +// Obsolete and slated for removal. DO NOT USE! #ifndef PYBIND11_INTERNALS_KIND # define PYBIND11_INTERNALS_KIND "" #endif From e071edc7d67596bbd2cc031b0ac84ab4d77b285b Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 2 Dec 2024 12:38:42 -0800 Subject: [PATCH 17/26] Introduce `PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE`: This makes it possible to achieve these two goals: * Avoid the leading underscore in `PYBIND11_PLATFORM_ABI_ID` (see https://github.com/pybind/pybind11/pull/5439#issuecomment-2503762161) * Maintain backward compatibility for use cases as reported under https://github.com/pybind/pybind11/pull/5439#issuecomment-2510212677 `PYBIND11_INTERNALS_KIND` is removed in this commit to ensure that `PYBIND11_COMPILER_TYPE` is the first element of the `PYBIND11_PLATFORM_ABI_ID`, so that `PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE` can meaningfully be used as a prefix for `PYBIND11_PLATFORM_ABI_ID` in pybind11/detail/internals.h. --- .../conduit/pybind11_platform_abi_id.h | 25 ++++++++----------- include/pybind11/detail/internals.h | 4 +-- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 267e2db3d1..30c47750df 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -12,18 +12,19 @@ #define PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x) #x #define PYBIND11_PLATFORM_ABI_ID_TOSTRING(x) PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x) -// Let's assume that different compilers are ABI-incompatible. -// A user can manually set this string if they know their -// compiler is compatible. -#ifndef PYBIND11_COMPILER_TYPE +#ifdef PYBIND11_COMPILER_TYPE +// // To maintain backward compatibility (see PR #5439). +# define PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE "" +#else +# define PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE "_" # if defined(__MINGW32__) -# define PYBIND11_COMPILER_TYPE "_mingw" +# define PYBIND11_COMPILER_TYPE "mingw" # elif defined(__CYGWIN__) -# define PYBIND11_COMPILER_TYPE "_gcc_cygwin" +# define PYBIND11_COMPILER_TYPE "gcc_cygwin" # elif defined(_MSC_VER) -# define PYBIND11_COMPILER_TYPE "_msvc" +# define PYBIND11_COMPILER_TYPE "msvc" # elif defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__) -# define PYBIND11_COMPILER_TYPE "_system" // Assumed compatible with system compiler. +# define PYBIND11_COMPILER_TYPE "system" // Assumed compatible with system compiler. # else # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." # endif @@ -82,11 +83,5 @@ # define PYBIND11_BUILD_TYPE "" #endif -// Obsolete and slated for removal. DO NOT USE! -#ifndef PYBIND11_INTERNALS_KIND -# define PYBIND11_INTERNALS_KIND "" -#endif - #define PYBIND11_PLATFORM_ABI_ID \ - PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI \ - PYBIND11_BUILD_TYPE + PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 278f35bbaa..5fcaf9b9c1 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -272,11 +272,11 @@ struct type_info { #define PYBIND11_INTERNALS_ID \ "__pybind11_internals_v" PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) \ - PYBIND11_PLATFORM_ABI_ID "__" + PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE PYBIND11_PLATFORM_ABI_ID "__" #define PYBIND11_MODULE_LOCAL_ID \ "__pybind11_module_local_v" PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) \ - PYBIND11_PLATFORM_ABI_ID "__" + PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE PYBIND11_PLATFORM_ABI_ID "__" /// Each module locally stores a pointer to the `internals` data. The data /// itself is shared among modules with the same `PYBIND11_INTERNALS_ID`. From ca9e6990deb9a57f21cba0879499600addeadf06 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 3 Dec 2024 10:47:55 -0800 Subject: [PATCH 18/26] Apply suggestion by @isuruf, with revised comments (code is as suggested). --- include/pybind11/conduit/pybind11_platform_abi_id.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 30c47750df..0c5a26b50c 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -23,8 +23,14 @@ # define PYBIND11_COMPILER_TYPE "gcc_cygwin" # elif defined(_MSC_VER) # define PYBIND11_COMPILER_TYPE "msvc" -# elif defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__) -# define PYBIND11_COMPILER_TYPE "system" // Assumed compatible with system compiler. +# elif defined(__GLIBC__) \ + && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) +// // Compatibility is determined based on libstdc++ or libc++ ABI version (below). +# define PYBIND11_COMPILER_TYPE "glibc" +# elif defined(__APPLE__) \ + && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) +// // Compatibility is (usually) determined based on libc++ ABI version (below). +# define PYBIND11_COMPILER_TYPE "macos" # else # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." # endif From 41daaa41fadd03ede9bdd9479c8ddf4d143330bf Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 3 Dec 2024 11:40:28 -0800 Subject: [PATCH 19/26] Make determination of `PYBIND11_COMPILER_TYPE` `"macos"` or `"glibc"` more general. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main motivation is to resolve these "Manylinux on 🐍 3.13t • GIL" and "Pyodide wheel" failures: ``` /__w/pybind11/pybind11/include/pybind11/conduit/pybind11_platform_abi_id.h:35:10: error: #error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." 35 | # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." | ^~~~~ ``` (All other CI jobs succeeded.) Further thought: Essentially, under Linux and macOS the `PYBIND11_COMPILER_TYPE` is only for informational purposes. ABI compatibility is determined by the libstdc++ or libc++ ABI version. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 0c5a26b50c..69492b48ce 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -23,14 +23,10 @@ # define PYBIND11_COMPILER_TYPE "gcc_cygwin" # elif defined(_MSC_VER) # define PYBIND11_COMPILER_TYPE "msvc" -# elif defined(__GLIBC__) \ - && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) -// // Compatibility is determined based on libstdc++ or libc++ ABI version (below). -# define PYBIND11_COMPILER_TYPE "glibc" -# elif defined(__APPLE__) \ - && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) -// // Compatibility is (usually) determined based on libc++ ABI version (below). +# elif defined(__APPLE__) # define PYBIND11_COMPILER_TYPE "macos" +# elif defined(__GLIBC__) || defined(_GLIBCXX_USE_CXX11_ABI) +# define PYBIND11_COMPILER_TYPE "glibc" # else # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." # endif From e34dc8b511d9f4dba0d128f9cf043f23fd155894 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 5 Dec 2024 16:13:38 -0800 Subject: [PATCH 20/26] Add `PYBIND11_COMPILER_TYPE` `emscripten` --- include/pybind11/conduit/pybind11_platform_abi_id.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 69492b48ce..35524d9d89 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -25,6 +25,8 @@ # define PYBIND11_COMPILER_TYPE "msvc" # elif defined(__APPLE__) # define PYBIND11_COMPILER_TYPE "macos" +# elif defined(__EMSCRIPTEN__) +# define PYBIND11_COMPILER_TYPE "emscripten" # elif defined(__GLIBC__) || defined(_GLIBCXX_USE_CXX11_ABI) # define PYBIND11_COMPILER_TYPE "glibc" # else From 75da5fbfd95cb6f431123a92d9fb5885e6c71fc2 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 5 Dec 2024 16:53:57 -0800 Subject: [PATCH 21/26] Add `PYBIND11_COMPILER_TYPE` `graalvm` --- include/pybind11/conduit/pybind11_platform_abi_id.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 35524d9d89..6b5ad3fdfd 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -27,6 +27,8 @@ # define PYBIND11_COMPILER_TYPE "macos" # elif defined(__EMSCRIPTEN__) # define PYBIND11_COMPILER_TYPE "emscripten" +# elif defined(GRAALVM_PYTHON) +# define PYBIND11_COMPILER_TYPE "graalvm" # elif defined(__GLIBC__) || defined(_GLIBCXX_USE_CXX11_ABI) # define PYBIND11_COMPILER_TYPE "glibc" # else From fb38f03e8516fa0ebef627b6367af21ca20e57f8 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Dec 2024 06:56:32 -0800 Subject: [PATCH 22/26] Revert "Add `PYBIND11_COMPILER_TYPE` `graalvm`" This reverts commit 75da5fbfd95cb6f431123a92d9fb5885e6c71fc2. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 6b5ad3fdfd..35524d9d89 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -27,8 +27,6 @@ # define PYBIND11_COMPILER_TYPE "macos" # elif defined(__EMSCRIPTEN__) # define PYBIND11_COMPILER_TYPE "emscripten" -# elif defined(GRAALVM_PYTHON) -# define PYBIND11_COMPILER_TYPE "graalvm" # elif defined(__GLIBC__) || defined(_GLIBCXX_USE_CXX11_ABI) # define PYBIND11_COMPILER_TYPE "glibc" # else From 09131c5dc89b35409b56d6922e8ac18e897bd1d3 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Dec 2024 06:56:36 -0800 Subject: [PATCH 23/26] Revert "Add `PYBIND11_COMPILER_TYPE` `emscripten`" This reverts commit e34dc8b511d9f4dba0d128f9cf043f23fd155894. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 35524d9d89..69492b48ce 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -25,8 +25,6 @@ # define PYBIND11_COMPILER_TYPE "msvc" # elif defined(__APPLE__) # define PYBIND11_COMPILER_TYPE "macos" -# elif defined(__EMSCRIPTEN__) -# define PYBIND11_COMPILER_TYPE "emscripten" # elif defined(__GLIBC__) || defined(_GLIBCXX_USE_CXX11_ABI) # define PYBIND11_COMPILER_TYPE "glibc" # else From d05ea53990dc6d3ced57f916230d8763a6dfbceb Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Dec 2024 06:56:37 -0800 Subject: [PATCH 24/26] Revert "Make determination of `PYBIND11_COMPILER_TYPE` `"macos"` or `"glibc"` more general." This reverts commit 41daaa41fadd03ede9bdd9479c8ddf4d143330bf. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 69492b48ce..0c5a26b50c 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -23,10 +23,14 @@ # define PYBIND11_COMPILER_TYPE "gcc_cygwin" # elif defined(_MSC_VER) # define PYBIND11_COMPILER_TYPE "msvc" -# elif defined(__APPLE__) -# define PYBIND11_COMPILER_TYPE "macos" -# elif defined(__GLIBC__) || defined(_GLIBCXX_USE_CXX11_ABI) +# elif defined(__GLIBC__) \ + && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) +// // Compatibility is determined based on libstdc++ or libc++ ABI version (below). # define PYBIND11_COMPILER_TYPE "glibc" +# elif defined(__APPLE__) \ + && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) +// // Compatibility is (usually) determined based on libc++ ABI version (below). +# define PYBIND11_COMPILER_TYPE "macos" # else # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." # endif From 776d1635c6c5d74e13b621d7f49a12b40d9ac9bc Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Dec 2024 06:56:38 -0800 Subject: [PATCH 25/26] Revert "Apply suggestion by @isuruf, with revised comments (code is as suggested)." This reverts commit ca9e6990deb9a57f21cba0879499600addeadf06. --- include/pybind11/conduit/pybind11_platform_abi_id.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 0c5a26b50c..30c47750df 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -23,14 +23,8 @@ # define PYBIND11_COMPILER_TYPE "gcc_cygwin" # elif defined(_MSC_VER) # define PYBIND11_COMPILER_TYPE "msvc" -# elif defined(__GLIBC__) \ - && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) -// // Compatibility is determined based on libstdc++ or libc++ ABI version (below). -# define PYBIND11_COMPILER_TYPE "glibc" -# elif defined(__APPLE__) \ - && (defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__)) -// // Compatibility is (usually) determined based on libc++ ABI version (below). -# define PYBIND11_COMPILER_TYPE "macos" +# elif defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__) +# define PYBIND11_COMPILER_TYPE "system" // Assumed compatible with system compiler. # else # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE." # endif From 738b7ec16f5fdb6220c93da73090fad5b009ce98 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 19 Dec 2024 12:36:35 -0800 Subject: [PATCH 26/26] Remove `defined(__INTEL_COMPILER)` as suggested by @hpkfft under https://github.com/pybind/pybind11/pull/5439#discussion_r1889156543 --- include/pybind11/conduit/pybind11_platform_abi_id.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/conduit/pybind11_platform_abi_id.h b/include/pybind11/conduit/pybind11_platform_abi_id.h index 30c47750df..d21fdc56d8 100644 --- a/include/pybind11/conduit/pybind11_platform_abi_id.h +++ b/include/pybind11/conduit/pybind11_platform_abi_id.h @@ -23,7 +23,7 @@ # define PYBIND11_COMPILER_TYPE "gcc_cygwin" # elif defined(_MSC_VER) # define PYBIND11_COMPILER_TYPE "msvc" -# elif defined(__INTEL_COMPILER) || defined(__clang__) || defined(__GNUC__) +# elif defined(__clang__) || defined(__GNUC__) # define PYBIND11_COMPILER_TYPE "system" // Assumed compatible with system compiler. # else # error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE."