Closed
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
git master
Problem description
On macOS, by default, pybind11 currently unconditionally passes the compiler flag -stdlib=libc++
regardless of which compiler is used, as indicated by the source code. This flag is invalid on GCC. If GCC is used, it causes compilation failures in all Python projects that use pybind11, with the error message arm64-apple-darwin22-gcc: error: unrecognized command-line option -stdlib=libc++
.
This is not a new problem. Both x86_64 and ARM64 are affected. See How to tell which specific compiler will be invoked for a Python C extension: GCC or Clang? for a similar case from 8 years ago.
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
Not a regression