Issue with building vendored dependencies for rust project

Hello there in my project I have rocksdb as a dependency using this branch of rust-rocksdb the problem I’m having is when trying to build with nix there is this compilation error which claims there is a missing file to build here’s the error.

thread 'main' panicked at 'Command failed with error: No such file or directory (os error 2)', /sources/librocksdb-sys-0.7.0+7.1.2-transaction/build.rs:346:19

now librocksdb-sys is the c bindings for rocksdb but I’m not sure how nixos file system works so it might have trouble with finding the files. Locally i had a similar error when building which i solved by installing clang so i included clang-tools in my shell.nix but it still fails. Any help is appreciated.

@Mo0nbase, the failure appears to be in a rust function update_submodules() which is trying to execute git submodule update --init.

Unfortunately I do not know nix or rust well enough yet to offer a solution. Does the environment building librocksdb-sys have git? Does the build environment pull sources in a way that can update submodules (git clone)?

Hopefully someone with more nix knowledge can help. I’m curious about how nix works with submodules.

if you’re using fetchFromGithub to grab the src, you can just add fetchSubmodules = true; and you’re done.

1 Like

The crates build.rs script is trying to write to it’s source folder by cloning git submodules but the source is in the nix-store and thus read only. But even cargo guidelines state that build.rs scripts aren’t supposed to modify the source dir, therfore I would file this bug on github.

1 Like