Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: MacMini M4 clang does not properly support pybind11 #5455

Open
3 tasks done
bgold04 opened this issue Nov 28, 2024 · 0 comments
Open
3 tasks done

[BUG]: MacMini M4 clang does not properly support pybind11 #5455

bgold04 opened this issue Nov 28, 2024 · 0 comments
Labels
triage New bug, unverified

Comments

@bgold04
Copy link

bgold04 commented Nov 28, 2024

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

pybind11-2.13.6

Problem description

#macOS version (macOS 15.1.1).
#Python version (Python 3.10.0).
#pybind11 version (pybind11-2.13.6 installed via pip).
#Apple clang version 16.0.0 (clang-1600.0.26.4)
#Target: arm64-apple-darwin24.1.0

The code below tests clang for a pybind11 requiring compilation on the system described above using example.cpp as target. The expectation is that example.so will be created. That example is not created and instead results in an error message having to do with an inavailability of pybind11.h Several compile attempts were made using different parameters.

Reproducible example code

#macOS version (macOS 15.1.1).
#Python version (Python 3.10.0).
#pybind11 version (pybind11-2.13.6 installed via pip).
#Apple clang version 16.0.0 (clang-1600.0.26.4)
#Target: arm64-apple-darwin24.1.0

example.cpp

include <pybind11/pybind11.h>

namespace py = pybind11;

int add(int i, int j) {
    return i + j;
}

PYBIND11_MODULE(example, m) {
    m.def("add", &add, "A function which adds two numbers");
}

______________________

clang++ -std=c++11 -shared -fPIC `python3 -m pybind11 --includes` example.cpp -o example.so

Also tried

clang++ -std=c++11 -shared -fPIC $(python3-config --includes) example.cpp -L$(python3-config --libdir) -lpython3.10 -o example.so

_________________________

example.so is expected but none is found.  Error message is:
Usage: /Users/bgold/.pyenv/versions/3.10.0/bin/python3-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed]
example.cpp:1:10: fatal error: 'pybind11/pybind11.h' file not found
    1 | #include <pybind11/pybind11.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
1 error generated.

________________________________________

NB: ls -l env/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h
-rw-r--r--  1 user  staff  129898 Nov 28 08:09 env/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h

Is this a regression? Put the last known working version here if it is.

Not a regression

@bgold04 bgold04 added the triage New bug, unverified label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New bug, unverified
Projects
None yet
Development

No branches or pull requests

1 participant