Skip to content

cargo install fails when installing a program with a dylib dependency #17055

@rdrpenguin04

Description

@rdrpenguin04

Problem

If an executable crate depends on a dylib crate, the dylib will be compiled (and the std dylib will be linked), but it won't be installed to a location the executable can find. Tested on Linux.

Steps

  1. cargo install cargo_install_dylib_bug (a crate I just published)
  2. Run cargo_install_dylib_bug

Error on my machine:

$ cargo_install_dylib_bug 
cargo_install_dylib_bug: error while loading shared libraries: libstd-1ee7395f7ada8841.so: cannot open shared object file: No such file or directory
$ ldd $(which cargo_install_dylib_bug)
        linux-vdso.so.1 (0x00007f56a0079000)
        libstd-1ee7395f7ada8841.so => not found
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f569fe00000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f56a007b000)

Possible Solution(s)

Installing built dylibs and cdylibs to ~/.cargo/bin alongside the executables would likely be a stopgap fix if executables can include it on their library search path.

Notes

This was originally observed attempting to install the Jackdaw editor: cargo install jackdaw --features dylib fails in much the same way (can't find libstd.so or libjackdaw_dylib.so).

Version

cargo 1.98.0-nightly (4d1f98451 2026-05-15)
release: 1.98.0-nightly
commit-hash: 4d1f984518c77fad6eeef4f40153b002a659e662
commit-date: 2026-05-15
host: x86_64-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.20.0-DEV (sys:0.4.88+curl-8.20.0 vendored ssl:OpenSSL/3.6.2)
ssl: OpenSSL 3.6.2 7 Apr 2026
os: Arch Linux Rolling Release [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions