LIBCLANG_PATH and Rust bindgen in nixpkgs unstable

I have this

# Needed if using bindgen to wrap C libraries in Rust
LIBCLANG_PATH = "${pkgs.llvmPackages_11.libclang}/lib";

in a shell.nix for a Rust project that uses bindgen. It works in nixpkgs 20.09, but when I switch to unstable, the bindgen component fails with

Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\', \'libclang-*.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found

and the lib subdirectory is missing in the resulting LIBCLANG_PATH.

How can this be made to work again in unstable?

1 Like

We recently changed the llvm derivations to have multiple outputs. I think this should work now:

LIBCLANG_PATH = "${pkgs.llvmPackages_11.libclang.lib}/lib";

(First result from grep LIBCLANG_PATH ~/nixpkgs.)

4 Likes