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] 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 0c5a26b50..69492b48c 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