-
Notifications
You must be signed in to change notification settings - Fork 785
Description
I'm trying to build an app that needs to make use of libftdi, this makes use of bindgen to build the external library which is then static linked into the app, making it portable.
I am forced to use msys2/gnu rather than msvc.
I get the obscure error "Unable to find libclang: "the libclang shared library at C:\msys64\clang64\bin\libclang.dll could not be opened: LoadLibraryExW failed" But no indication what the cause of the failure actually is.
The file DOES exist in the location shown.
Directory: C:\msys64\clang64\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 04/12/2025 01:22 33602560 libclang.dll
My Cargo.toml contains
libftd2xx-ffi = { version = "~0.8.7", features = ["bindgen"] }
libftd2xx = { version = "0.33.1", features = ["static"] }At first I got errors that bindgen could not find libclang.dll I fixed that by setting an environment variable in config.toml
I added LIBCLANG_PATH to my .cargo/config.toml
[target.x86_64-pc-windows-gnu]
linker = "C:\\msys64\\mingw64\\bin\\gcc.exe"
ar = "C:\\msys64\\mingw64\\bin\\ar.exe"
[env]
LIBCLANG_PATH = "C:\\msys64\\clang64\\bin"The only other mentions I can find of this error are related to an embedded Rust project for ESP32. esp-rs/rust-build#282, and they solve that by 'downgrading'.