首页 > 解决方案 > Bindgen 似乎无法在 OSX 上找到 clang

问题描述

虽然我确定我做错了什么,但我似乎找不到它。我正在使用bindgen = "0.55.1"并尝试生成pjsip绑定,尽管问题似乎早在此之前。这是构建的输出:

error: failed to run custom build command for `test-pjsip v0.1.0 (/Users/bruce/Projects/rust/examples/test-pjsip)`

Caused by:
  process didn't exit successfully: `/Users/bruce/Projects/rust/examples/test-pjsip/target/debug/build/test-pjsip-b32f0a4a7fbb2d3e/build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-link-lib=pjsip
  cargo:rustc-link-lib=pjsua

  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/local/opt/llvm@11/lib/libclang.dylib could not be opened: dlopen(/usr/local/opt/llvm@11/lib/libclang.dylib, 2): Symbol not found: __ZTIN4llvm13ErrorInfoBaseE\n  Referenced from: /usr/local/opt/llvm@11/lib/libclang.dylib\n  Expected in: /Users/bruce/.rustup/toolchains/stable-x86_64-apple-darwin/lib/libLLVM.dylib\n in /usr/local/opt/llvm@11/lib/libclang.dylib"', /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.55.1/src/lib.rs:1896:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

我通过on的bindgen推荐安装了 clang 。我已经验证 /usr/local/opt/llvm@11/lib/libclang.dylib 确实存在。我怀疑符号不存在是问题所在。我应该安装不同(旧)版本的 clang,如果是,是什么版本?brew install llvmmacOS

标签: rustrust-bindgen

解决方案


好吧,我决定brew uninstall llvm作为最后的绝望行动。这似乎已经解决了这个问题。现在,我只是在处理链接错误,这更有意义。


推荐阅读