rust-lang / rust-lang/rust-bindgen

Wrong libclang on double arch machines

Open
#1,322 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

bindgen may found wrong libclang and then fail to open it. For example, on x86_64 arch it may found libclang.so in /usr/lib for i686 arch and then fails.

To test, install clang for both i686 and x86_64 on same machine. It expected, that bindgen is able to compile code for both i686 target and x86_64 target. In reality, bindgen fails when it founds library for wrong architecture.

--- stdout
cargo:rustc-link-search=native=/usr/local/lib64

--- stderr
thread 'main' panicked at 'Unable to find libclang: "the libclang shared library could not be opened: /usr/lib/libclang.so"', libcore/result.rs:945:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by installing i686 and x86_64 clang packages and testing bindgen for both targets. Start with bindgen's libclang discovery and loading path; done means it selects a library compatible with the requested architecture instead of opening the wrong /usr/lib/libclang.so.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.