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

Header search path failure on 1.8.2 (works in 1.8.1) related to clang executable search order changes #181

Open
jbg opened this issue May 30, 2024 · 5 comments

Comments

@jbg
Copy link

jbg commented May 30, 2024

I'm using autocxx to generate some bindings to a C++ library. autocxx enables the runtime feature of this crate unconditionally, something which will hopefully be improved.

As of this change, released in 1.8.2, my bindings always fail to generate unless I set CLANG_PATH=$(which clang) to override the above search order, because the bundled libclang fails to find some macOS system headers.

$ cargo update --precise 1.8.1 clang-sys
$ cargo check
...
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 02s

$ cargo update --precise 1.8.2 clang-sys
$ cargo check
...
  process didn't exit successfully: `/Users/.../build-script-build` (exit status: 1)
  --- stderr
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found

I'm not sure if this is something to be fixed here or not, as I don't fully understand why the bundled libclang doesn't work. But I suspect this problem affects others on macOS too.

@feifeigood
Copy link

I'm encountered same issue on MacOS

`
$ cargo update --precise 1.8.2 clang-sys
$ cargo build
...

--- stderr
wrapper.h:1:10: fatal error: 'sys/param.h' file not found
...
Unable to generate bindings: ClangDiagnostic("wrapper.h:1:10: fatal error: 'sys/param.h' file not found\n")
`

@ianks
Copy link

ianks commented May 30, 2024

Looks like include headers that were previously found are no longer in the search path, which is breaking things on GHA too. For those looking for a hotfix:

echo BINDGEN_EXTRA_CLANG_ARGS_aarch64-apple-darwin="-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" >> $GITHUB_ENV

@westy92
Copy link

westy92 commented May 30, 2024

I have the same issue.

error: failed to run custom build command for `timelib v0.3.4`

Caused by:
  process didn't exit successfully: `/Users/user/Source/my-api-rust/target/llvm-cov-target/debug/build/timelib-9d2eb476496a3c91/build-script-build` (exit status: 101)
  --- stderr
  shim/../ext/timelib/timelib.h:37:10: fatal error: 'stdlib.h' file not found
  thread 'main' panicked at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/timelib-0.3.4/build.rs:29:10:
  failed to run bindgen: ClangDiagnostic("shim/../ext/timelib/timelib.h:37:10: fatal error: 'stdlib.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: command `/Users/user/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo test --no-run --message-format json-render-diagnostics --target-dir /Users/user/Source/my-api-rust/target/llvm-cov-target` exited with code 101
error: process didn't exit successfully: `/Users/user/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo nextest run --manifest-path /Users/user/Source/my-api-rust/Cargo.toml --target-dir /Users/user/Source/my-api-rust/target/llvm-cov-target` (exit status: 101)

@KyleMayes
Copy link
Owner

One day I'll learn my lesson and stop trying to make this crate better...
I've yanked v1.8.2 and will release the non-broken changes later.

@jqnatividad
Copy link

Thanks for the quick action @KyleMayes !

Hopefully, it doesn't dissuade you from improving the crate...

P.S.
You may want to remove 1.8.2 from releases too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants