godot-rust / gdnative

Rust bindings for Godot 3
https://godot-rust.github.io
MIT License
3.61k stars 210 forks source link

Libclang on m1 mac #763

Closed bayou-brogrammer closed 2 years ago

bayou-brogrammer commented 3 years ago

I am using a m1 mac and I am getting a weird issue with libclang. If I run clang -v I get:

Homebrew clang version 12.0.1
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

but running cargo build It fails on gdnative-sys v0.9.3

error: failed to run custom build command for `gdnative-sys v0.9.3`

Caused by:
  process didn't exit successfully: `/Users/jlecoq/projects/rust/godot/rpg-tutorial-rust/scripts/target/debug/build/gdnative-sys-e00466714c237275/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/local/Cellar/llvm/12.0.1/lib/libclang.dylib could not be opened: dlopen(/usr/local/Cellar/llvm/12.0.1/lib/libclang.dylib, 5): no suitable image found.  Did find:\n\t/usr/local/Cellar/llvm/12.0.1/lib/libclang.dylib: mach-o, but wrong architecture\n\t/usr/local/Cellar/llvm/12.0.1/lib/libclang.dylib: stat() failed with errno=20"', /Users/jlecoq/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.56.0/src/lib.rs:1922:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

It says it found libclang, but in a different arch

Bromeon commented 3 years ago

Possibly related: #742

Hexorg commented 2 years ago

Not sure if libraries got updates since this was reported, but my standard rust environment (rustup) was enough to build and run Godot-rust just fine on M1:

cargo 1.61.0 (a028ae42f 2022-04-29)
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Bromeon commented 2 years ago

Thanks a lot for checking @Hexorg!

I'll close this issue then -- if more problems appear, we can reopen it.