KyleMayes / clang-sys

Rust bindings for libclang.
Apache License 2.0
128 stars 65 forks source link

OpenBSD: shared library could not be opened #180

Open niko-ng opened 1 month ago

niko-ng commented 1 month ago

Hello, Since OpenBSD 7.4 the libclang path has changed. users have to make sure they install the port of llvm by running pkg_add llvm. And then, depending on the version that was chosen for install, the path for the dynamic library varies. by example, for the 17 version, it should be

LIBCLANG_PATH=/usr/local/llvm17/lib this is the solution for all users encountering the error :

Unable to find libclang: "the `libclang` shared library at /usr/local/lib/libclang.so.8.2 could not be opened: Cannot load specified object"

in fact, llvm-config --libdir should return the right path and clang-sys should be able to find the lib without the need for the env var LIBCLANG_PATH. But something is wrong in the setup, at least on my machine, as it looks like there are 2 competing llvm-config on the machine. the old one and the newer one. Seems like an OpenBSD issue too.

I leave this here. Hopefully someone will sort it out. The issue was first reported in rust-bindgen https://github.com/rust-lang/rust-bindgen/issues/2838