devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Unable to find libclang

Open emlautarom1 opened this issue 1 year ago • 2 comments

What happened?

Currently I'm working on a Rust project that uses librocksdb-sys as a dependency and I'm unable to build the package when working inside a devbox shell though I can build it outside.

Steps to reproduce

  1. Get a Rust project with librocksdb-sys as a dependency
  2. Add [email protected] and [email protected] to your devbox.json file
  3. Try to build the project using cargo build

Command

No response

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.10.6/.schema/devbox.schema.json",
  "packages": [
    "[email protected]",
    "[email protected]",
    "[email protected]",
    "[email protected]",
    "[email protected]",
    "[email protected]",
    "[email protected]",
    "[email protected]",
  ],
  "env": {
    "NIX_HARDENING_ENABLE": ""
  },
  "include": [
    "github:jetify-com/devbox-plugins?dir=rabbitmq"
  ],
  "shell": {
    "init_hook": [
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.10.7

Nix version

nix (Nix) 2.18.1

What system does this bug occur on?

Linux (x86-64)

Debug logs

Relevant parts only:

  thread 'main' panicked at /home/emlautarom1/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.65.1/lib.rs:603:31:
  Unable to find libclang: "the `libclang` shared library at /usr/lib64/libclang.so.17.0.6 could not be opened: libLLVM-17.so: cannot open shared object file: No such file or directory"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

emlautarom1 avatar May 27 '24 18:05 emlautarom1

Note that /usr/lib64/libclang.so.17.0.6 exists and it's a proper shared object. The issue seems to be when trying to use it from the devbox shell. What I don't understand is why is it picking up the native one instead of the one stored in the Nix store.

emlautarom1 avatar May 27 '24 19:05 emlautarom1

Also having this issue.

Apparently there's a nix hook rustPlatform.bindgenHook but its not clear how to instruct devbox to use hooks.

Worse than that, now my environment outside of devbox also fails until I restart my shell

croots avatar Jun 25 '24 18:06 croots