rust-lang / rust-lang/rust-bindgen
Compilation fails on MacOS M1
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
I'm building a project integrating rust-bindgen and doing cargo build --target=aarch64-apple-darwin and still I get this error, where it tries to check for an x86 lib instead of the (existing) arm64 one
Unable to find libclang: "the `libclang` shared library at /opt/homebrew/Cellar/llvm/19.1.7/lib/libclang.dylib could not be opened: dlopen(/opt/homebrew/Cellar/llvm/19.1.7/lib/libclang.dylib, 0x0005): tried: '/Users/primet/.wasmedge/lib/libclang.dylib' (no such file), '/opt/homebrew/Cellar/llvm/19.1.7/lib/libclang.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/llvm/19.1.7/lib/libclang.dylib' (no such file), '/opt/homebrew/Cellar/llvm/19.1.7/lib/libclang.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported cargo build --target=aarch64-apple-darwin command and read the libclang loading error. Investigate how the build selects libclang and target architecture on macOS M1. Done means the existing arm64 libclang loads successfully for the requested target without attempting to use an x86_64 library.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100