Error building, external library required.
sweglord227
TRIALOP

2 years ago

I'm trying to build a backend api with an embedded database. I understand now this may be a little unorthodox, but this is my first attempt at building a website. The database I'm using requires the libclang library, and I have found no way in the past hour of searching to add an external library to the build process. Is this possible? or will I have to remake my api?

full error:

#12 20.86 --- stderr

#12 20.86 thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.65.1/lib.rs:603:31:

#12 20.86 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 (invalid: [])"

#12 20.86 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

#12 20.86 warning: build failed, waiting for other jobs to finish...

Solved

5 Replies

2 years ago

You can try to install the nix libclang package.

Add this nixpacks.toml file to your project -

[phases.setup]
    nixPkgs = ['...', 'libclang']

sweglord227
TRIALOP

2 years ago

Unfortunately this did not work. I see libclang in the setup box now, but it still fails to build for the same reason


2 years ago

You can try installing it as an apt package instead -

[phases.setup]
    aptPkgs = ['...', 'libclang-17-dev']

If this still doesn't work you will need to move to a Dockerfile based build.


sweglord227
TRIALOP

2 years ago

build still failed. i'm probably just going to split the database and backend apart using an existing template. thanks for your help none the less


2 years ago

No problem!


Status changed to Solved brody over 1 year ago


Loading...