Skip to content

Only add an automatic SONAME for Rust dylibs #130960

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Sep 27, 2024

#126094 added an automatic relative SONAME to all dynamic libraries, but it was really only needed for Rust --crate-type="dylib". In Fedora, it was a surprise to see SONAME on "cdylib" libraries like Python modules, especially because that generates an undesirable RPM Provides. We can instead add a SONAME just for Rust dylibs by passing the crate-type argument farther.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2314879

@cuviper
Copy link
Member Author

cuviper commented Sep 27, 2024

(Is the bot sleeping? trying again...)

r? petrochenkov

@marmeladema
Copy link
Contributor

I also encountered a breaking change related to this. In my case, I was explicitly renaming the final shared library to something different (from libmylib_ffi.so to libmylib.so) to package it nicely and it broke my cgo bindings.

It turned out that the cgo dynamic loader was very confused with a library file having a certain name and the SONAME being different. This wasn't a problem before since previously the shared library did not have a SONAME.

I ultimately found a way around it but I bet it a broke a variety of subtle use cases for people. I was too lazy to open a GitHub issue at the time though as I initially thought the change was intented.

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 28, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 28, 2024

📌 Commit f46057b has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 28, 2024
@petrochenkov
Copy link
Contributor

This fixes a stable-to-stable regression from Rust 1.81.0 (#126094).
So, beta nominating, and stable nominating as well in case there is a point release.

@petrochenkov petrochenkov added beta-nominated Nominated for backporting to the compiler in the beta channel. stable-nominated Nominated for backporting to the compiler in the stable channel. labels Sep 28, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 28, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#128778 (atomics: allow atomic and non-atomic reads to race)
 - rust-lang#130918 (simplify LLVM submodule handling)
 - rust-lang#130960 (Only add an automatic SONAME for Rust dylibs)
 - rust-lang#130973 (compiletest: rename "runtest/crash.rs" to "runtest/crashes.rs" to be in line with the test directory)
 - rust-lang#130976 (remove couple redundant clones)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cfe0cff into rust-lang:master Sep 28, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 28, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 28, 2024
Rollup merge of rust-lang#130960 - cuviper:cdylib-soname, r=petrochenkov

Only add an automatic SONAME for Rust dylibs

rust-lang#126094 added an automatic relative `SONAME` to all dynamic libraries, but it was really only needed for Rust `--crate-type="dylib"`. In Fedora, it was a surprise to see `SONAME` on `"cdylib"` libraries like Python modules, especially because that generates an undesirable RPM `Provides`. We can instead add a `SONAME` just for Rust dylibs by passing the crate-type argument farther.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2314879
@apiraino
Copy link
Contributor

apiraino commented Oct 3, 2024

Beta backport accepted as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle.

A stable backport was also approved, provided a dot release is planned for other reasons.

@rustbot label +beta-accepted +stable-accepted

@rustbot rustbot added beta-accepted Accepted for backporting to the compiler in the beta channel. stable-accepted Accepted for backporting to the compiler in the stable channel. labels Oct 3, 2024
@cuviper cuviper mentioned this pull request Oct 9, 2024
@cuviper cuviper modified the milestones: 1.83.0, 1.82.0 Oct 9, 2024
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 9, 2024
@cuviper cuviper deleted the cdylib-soname branch October 10, 2024 15:45
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 11, 2024
[beta] backports

- Only add an automatic SONAME for Rust dylibs rust-lang#130960
- Reject leading unsafe in `cfg!(...)` and `--check-cfg` rust-lang#131057, resolving rust-lang#131055
- Disable jump threading `UnOp::Not` for non-bool rust-lang#131201
- Update LLVM submodule rust-lang#131448

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 11, 2024
[beta] backports

- Only add an automatic SONAME for Rust dylibs rust-lang#130960
- Reject leading unsafe in `cfg!(...)` and `--check-cfg` rust-lang#131057, resolving rust-lang#131055
- Disable jump threading `UnOp::Not` for non-bool rust-lang#131201
- Update LLVM submodule rust-lang#131448

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2024
[beta] backports

- Only add an automatic SONAME for Rust dylibs rust-lang#130960
- Reject leading unsafe in `cfg!(...)` and `--check-cfg` rust-lang#131057, resolving rust-lang#131055
- Disable jump threading `UnOp::Not` for non-bool rust-lang#131201
- Update LLVM submodule rust-lang#131448

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2024
[beta] backports

- Only add an automatic SONAME for Rust dylibs rust-lang#130960
- Reject leading unsafe in `cfg!(...)` and `--check-cfg` rust-lang#131057, resolving rust-lang#131055
- Disable jump threading `UnOp::Not` for non-bool rust-lang#131201
- Update LLVM submodule rust-lang#131448
- Split x86_64-msvc-ext into two jobs rust-lang#130072
- Use a small runner for msvc-ext2 job rust-lang#130151

r? ghost
@cuviper cuviper removed stable-nominated Nominated for backporting to the compiler in the stable channel. stable-accepted Accepted for backporting to the compiler in the stable channel. labels Oct 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants