Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find libclang: "the libclang shared library #2360

Closed
hyper-boy opened this issue Nov 24, 2022 · 8 comments · Fixed by #2368
Closed

Unable to find libclang: "the libclang shared library #2360

hyper-boy opened this issue Nov 24, 2022 · 8 comments · Fixed by #2368

Comments

@hyper-boy
Copy link

apk info clang-dev
clang15-dev-15.0.5-r0 description:
A C language family front-end for LLVM (development files)

clang15-dev-15.0.5-r0 webpage:
https://llvm.org/

clang15-dev-15.0.5-r0 installed size:
21 MiB

cat /etc/alpine-release
3.15.1

--- stderr
thread 'main' panicked at 'Unable to find libclang: "the libclang shared library at /usr/lib/libclang.so.15.0.5 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/bindgen-0.60.1/src/lib.rs:2172:31

@pvdrz
Copy link
Contributor

pvdrz commented Nov 24, 2022

well this says that dynamic loading is not supported, what happens if you use the static feature of bindgen?

EDIT: the runtime feature is enabled by default so you have to disable default features first. See https://docs.rs/crate/bindgen/0.60.1/features

@pvdrz
Copy link
Contributor

pvdrz commented Dec 6, 2022

A similar (but not exactly the same) issue happens here Rust-for-Linux/linux#934 and I suspect it is because the clang-sys version we use does not support clang 15.

We will update the clang-sys version and do a new release as soon as possible.

@Karrq
Copy link

Karrq commented Jun 17, 2023

Hello, I have the same issue but I'm using the latest version of bindgen (tried a couple of older versions too) and clang 12 with alpine 3.15.8

Unable to find libclang: "the `libclang` shared library at /usr/lib/libclang.so.12 could not be opened: Dynamic loading not supported

@pvdrz
Copy link
Contributor

pvdrz commented Jun 18, 2023

@Karrq have you tried this?

well this says that dynamic loading is not supported, what happens if you use the static feature of bindgen?

EDIT: the runtime feature is enabled by default so you have to disable default features first. See https://docs.rs/crate/bindgen/0.60.1/features

@Karrq
Copy link

Karrq commented Jun 18, 2023

@pvdrz I did, but then this is the error #2333

@Karrq
Copy link

Karrq commented Jun 19, 2023

I found the root cause: rust-lang/cargo#4423

I'm in a cross-compilation environment, thus RUSTFLAGS are ignored. The only sensible workaround (that I found for now) is using the host-config unstable feature

@quadroli
Copy link

Helloo 👋🏼
I'm getting the same same issue as well while trying to build wl-screenrec
I'm on Alpine Linux 3.19, and trying to use libclang16

Exact error message: Unable to find libclang: "the `libclang` shared library at /usr/lib/llvm16/lib/libclang.so.16.0.6 could not be opened: Dynamic loading not supported"

@quadroli
Copy link

How did you all work your way around this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants