Skip to content

Problems bulding with msys2 #3334

@the-moog

Description

@the-moog

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'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions