-
Notifications
You must be signed in to change notification settings - Fork 672
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
c++ constexpr breaks with Mac OS native clang #1948
Comments
Hmm, this is interesting, thanks for filing. Of the recently-landed commits on LLVM, llvm/llvm-project-staging@7213142 looks the most suspect, but it needs to be double-checked / bisected to be sure. It'd be great if I can get to this before LLVM12 is released, but if someone can tackle this it'd be awesome. |
I haven't been able to reproduce this error when building clang myself. I tried clang built from https://github.com/llvm/llvm-project/tree/llvmorg-11.0.0, https://github.com/llvm/llvm-project/tree/llvmorg-12-init and master (llvm/llvm-project@164bcbd). I tried llvm/llvm-project-staging@7213142 and staging/apple (llvm/llvm-project-staging@8e505ae). Maybe this means other distributions of clang 12 won't have the problem. And when Apple next updates clang their version might not have the problem either? Is there a way to find out what commit Apple built |
Update: still having this issue with clang 13 as distributed with Xcode 13. Quite frustrating. |
It seems really to be a apple clang specific problem, because with a brew install of $ clang --version
Homebrew clang version 13.0.0
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/13.0.0_2/bin
$ bindgen --version
bindgen 0.59.2 $ echo 'constexpr int test = 1;' > test.hpp
$ bindgen test.hpp
/* automatically generated by rust-bindgen 0.59.2 */
pub const test: ::std::os::raw::c_int = 1; However, when using the build in clang (Apple clang version 13.0.0 (clang-1300.0.29.30)) so the same major version, it fails: $ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ bindgen test.hpp
test.hpp:1:1: error: unknown type name 'constexpr'
test.hpp:1:1: error: unknown type name 'constexpr', err: true
thread 'main' panicked at 'Unable to generate bindings: ()', /Users/d34dl0ck/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/main.rs:52:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
The native Clang (
Apple clang version 12.0.0 (clang-1200.0.32.28)
) on Macs (Mac OS 10.15.7 anyway), seems to break bindgen's support for c++ header files. c header files seem fine. In particular, it seems to break theconstexpr
keyword.Clang 12 hasn't yet been released. So it's odd that it's the version Apple is shipping. And it's not reasonable for bindgen to support a prerelease version.
I wanted to raise an issue:
ccouzens/tesseract-sys#4
The text was updated successfully, but these errors were encountered: