Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace dylib with missing shared object dependencies #46369

Closed
nickbabcock opened this issue Nov 29, 2017 · 1 comment
Closed

Workspace dylib with missing shared object dependencies #46369

nickbabcock opened this issue Nov 29, 2017 · 1 comment

Comments

@nickbabcock
Copy link
Contributor

On latest stable / nightlies on linux:

Creating a new project and the modifying the generated Cargo.toml:

[lib]
crate-type = ["dylib"]

Produces an .so with the following shared objects dependencies

ldd target/debug/lib*.so
        linux-vdso.so.1 =>  (0x00007ffd3d1e6000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f21e02f1000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f21e00e9000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f21dfecb000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f21dfcb4000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f21df8ed000)
        /lib64/ld-linux-x86-64.so.2 (0x00005638697ba000)

I expected that if we added a workspace member that also is a dylib, both would have the same shared object dependencies

However, if you add a workspace member (we'll create an inner project that is also a dylib and neither crate depends on each other). A cargo clean && cargo build --all later and the shared object dependencies for both change:

ldd target/debug/lib*.so
target/debug/libinner.so:
        linux-vdso.so.1 =>  (0x00007fff0cc8a000)
        libstd-29fb1fb52cf57377.so => not found
target/debug/libtemp.so:
        linux-vdso.so.1 =>  (0x00007fff38950000)
        libstd-29fb1fb52cf57377.so => not found

This issue came up when searching for previous issues: #39487 but seems somewhat windows and $PATH related, so didn't seem relevant.

*cargo clean was a necessary step as the library wouldn't be rebuilt otherwise.

@nickbabcock
Copy link
Contributor Author

Ah, for single crate repos dylib will link against posted objects, but this is only for backwards compatibility. Cargo workspaces assume that it's a sign to renege compatibility. Crates that will be opened by dlopen or the like need to have a crate type of cdylib. So no bug anywhere 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant