"Library runpath" is missing on x86_64-linux artifact

Hi everyone,

I’ve run into a little issue with my Rust flake. It seems that the x86_64-linux artifact, created by GitHub Actions and my Rosetta 2-emulated NixOS VM, is missing the “Library runpath.” Here’s what I’m seeing when I check the artifact:

$ readelf -d result/bin/dbrunner 
Dynamic section at offset 0x520b18 contains 32 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: []
 0x0000000000000001 (NEEDED)             Shared library: [libsqlite3.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]

This missing runpath causes issues with locating dynamic libraries like SQLite, resulting in the following error:

error while loading shared libraries: libsqlite3.so.0: cannot open shared object file: No such file or directory

On the other hand, the aarch64-linux artifact does include the runpath:

$ readelf -d result/bin/dbrunner 
 0x0000000000000001 (NEEDED)             Shared library: [libsqlite3.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-aarch64.so.1]
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/pdj1kvhxj6p3lgz0x9lcs94d9zsv3cgw-sqlite-3.46.0/lib:/nix/store/r9vrnc05rrhr0hz9wm325sgczv0r4xs9-glibc-2.39-52/lib:/nix/store/yw3ac09cs8p2bagsl8ijq5fnxs3mzwma-gcc-13.3.0-lib/lib]

Unfortunately, I haven’t been able to find a solution for this issue. I did come across a similar discussion on NixOS Discourse, but it hasn’t received any responses yet.

The aarch64-darwin and aarch64-linux artifacts work fine, but only the x86_64-linux one seems to be problematic. I am currently working around this by linking everything statically, though it may not be possible for some libraries :cry:

You can check out the flake on my GitHub repository, and see the CI error here. I would really appreciate any help in resolving this issue. CI is enabled on the pull request, so feel free to open a PR to test your changes :smile:

Thanks a lot!

Perhaps sqlite needs to be in the checkInputs, as well?

Tried. Not working: nix-test · database-playground/dbrunner-rs@2e774b6 · GitHub (nix-attempt: checkInputs · database-playground/dbrunner-rs@2e774b6 · GitHub)