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

incompatible_macos_set_install_name: Set -install_name when linking dynamic libraries on macOS #12370

Closed
Yannic opened this issue Oct 28, 2020 · 6 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: apple team-Rules-CPP Issues for C++ rules type: process

Comments

@Yannic
Copy link
Contributor

Yannic commented Oct 28, 2020

Flag: --incompatible_macos_set_install_name

This incompatible change will add -install_name=@rpath/<runtime_solib_name> to the comman-line of link actions for creating dynamic libraries on macOS. This will allow us to remove the hacky wrapper scripts that rely on the runtime solibs being symlinks.

Migration

TBD.

@Yannic
Copy link
Contributor Author

Yannic commented Oct 28, 2020

/cc @oquenchil @keith

@keith
Copy link
Member

keith commented Oct 28, 2020

@steeve this change #12304 only broke cgo, since you've been around that area it might interest you

@steeve
Copy link
Contributor

steeve commented Oct 28, 2020

absolutely! thank you i'll take a look, cc @jayconrod

@philwo philwo added z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple untriaged type: process labels Nov 10, 2020
@susinmotion susinmotion added team-Rules-CPP Issues for C++ rules platform: apple and removed z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple labels Nov 18, 2020
@oquenchil oquenchil added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Nov 19, 2020
@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 2+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Apr 13, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@fmeum
Copy link
Collaborator

fmeum commented Jul 24, 2024

I just discovered this flag while working on enabling all remote tests on macOS (#23085). Without it, dylib discovery from runfiles will not work correctly for tools (see test_cc_binary_tool_with_dynamic_deps).

@fmeum fmeum reopened this Jul 24, 2024
@fmeum fmeum removed the stale Issues or PRs that are stale (no activity for 30 days) label Jul 24, 2024
copybara-service bot pushed a commit that referenced this issue Aug 28, 2024
The `runtime_solib_name` link variable had an incorrect value in the case of a transitive dynamic library. Since non-transitive ("nodeps") dynamic libraries are no longer used on macOS, the `--incompatible_macos_set_install_name` flag didn't have any positive effect.

This PR is intentionally limited to the fix so that it can be cherry-picked into Bazel 7, where it can make the incompatible flag work with the `apple_support` toolchain. A follow-up PR will add the feature to the Unix toolchain and flip the incompatible flag for Bazel 8.

Work towards #12370

Closes #23089.

PiperOrigin-RevId: 668228562
Change-Id: I7524679bfe8c6b8b28c0cb04f46c0d22d0adbe99
fmeum added a commit to fmeum/bazel that referenced this issue Sep 19, 2024
The `runtime_solib_name` link variable had an incorrect value in the case of a transitive dynamic library. Since non-transitive ("nodeps") dynamic libraries are no longer used on macOS, the `--incompatible_macos_set_install_name` flag didn't have any positive effect.

This PR is intentionally limited to the fix so that it can be cherry-picked into Bazel 7, where it can make the incompatible flag work with the `apple_support` toolchain. A follow-up PR will add the feature to the Unix toolchain and flip the incompatible flag for Bazel 8.

Work towards bazelbuild#12370

Closes bazelbuild#23089.

PiperOrigin-RevId: 668228562
Change-Id: I7524679bfe8c6b8b28c0cb04f46c0d22d0adbe99
github-merge-queue bot pushed a commit that referenced this issue Sep 23, 2024
…l_name` (#23672)

The `runtime_solib_name` link variable had an incorrect value in the
case of a transitive dynamic library. Since non-transitive ("nodeps")
dynamic libraries are no longer used on macOS, the
`--incompatible_macos_set_install_name` flag didn't have any positive
effect.

This PR is intentionally limited to the fix so that it can be
cherry-picked into Bazel 7, where it can make the incompatible flag work
with the `apple_support` toolchain. A follow-up PR will add the feature
to the Unix toolchain and flip the incompatible flag for Bazel 8.

Work towards #12370

Closes #23089.

PiperOrigin-RevId: 668228562
Change-Id: I7524679bfe8c6b8b28c0cb04f46c0d22d0adbe99

Fixes #23185
keith pushed a commit to keith/bazel that referenced this issue Oct 3, 2024
This requires adding the `set_install_name` feature to the Unix toolchain on macOS only. The legacy install name patcher is kept around for as long as the flag can be unflipped.

RELNOTES[INC]: With the default Unix toolchain on macOS, binaries now use `@rpath` to find their `.dylib` dependencies. This is required to fix issues where tools run during the build couldn't find their dynamic dependencies.

Closes bazelbuild#12370

Closes bazelbuild#23090.

PiperOrigin-RevId: 678780800
Change-Id: I13a1bb993c13fb2f9d7b358c2881a7ccdafe66cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: apple team-Rules-CPP Issues for C++ rules type: process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants