Compilation fails on MacOS M1
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'))"
What do you mean by "still"? Is there another issue open?
No I mean, that's the error I'm getting
seems to be because it's confused and trying to use x86_64 instead of amd64
@maelp did you ever find a solution to this?
Also getting this error on Mac M1
Could you check cargo --version --verbose, and verify that the host is aarch64-apple-darwin? Sometimes, I've seen people use x86_64-apple-darwin host tooling on their Aarch64 machine.
@madsmtm this was indeed the issue for me. Thanks!
After running cargo --version --verbose it seemed that I was indeed running the x86_64-apple-darwin host tooling.
Running the following installed the correct toolchain for me:
rustup default stable-aarch64-apple-darwin