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

rust: Fix link arguments #12367

Merged
merged 3 commits into from
Nov 2, 2023
Merged

Conversation

xclaesse
Copy link
Member

@xclaesse xclaesse commented Oct 12, 2023

Reduce code duplication by iterating target.get_dependencies() instead
of iterating target.link_targets and target.link_whole_targets
separately. This has the extra benefit of taking into account
transitive dependencies.

  • For indirect C ABI static libraries, this adds missing "-l static="
    arguments.
  • For indirect Rust ABI dependencies, this adds missing "-L" arguments.
  • Verbatim modifier was used only for link_whole_targets, it's now
    always used when available.

Fixes: #11694

@xclaesse xclaesse requested a review from jpakkane as a code owner October 12, 2023 17:11
@xclaesse
Copy link
Member Author

This is an alternative fix replacing #11719. I imported @sdroege's unit test.

@xclaesse xclaesse force-pushed the rust-link-command branch 2 times, most recently from 0630265 to 3af3a96 Compare October 12, 2023 18:09
@xclaesse
Copy link
Member Author

xclaesse commented Oct 13, 2023

@dcbaker I think the CRT changes you made in #11902 never worked. You made a typo there: https://github.com/mesonbuild/meson/pull/11902/files#diff-76c8a26e81a7fd37cca2db144349e88dbcf9be56e32954ea722a9d106e4e400dR2049-R2050. This PR fix that typo, but then the CI fails with:

error: could not find native static library msvcrtd, perhaps an -L flag is missing?

xclaesse and others added 3 commits October 19, 2023 08:29
Reduce code duplication by iterating target.get_dependencies() instead
of iterating target.link_targets and target.link_whole_targets
separately. This has the extra benefit of taking into account
transitive dependencies.

- For indirect C ABI static libraries, this adds missing "-l static="
  arguments.
- For indirect Rust ABI dependencies, this adds missing "-L" arguments.
- Verbatim modifier was used only for link_whole_targets, it's now
  always used when available.

Fixes: mesonbuild#11694
It seems broken and fails on our CI:
rust-lang/rust#116674
@xclaesse
Copy link
Member Author

@dcbaker CRT issue has been worked around now, this PR is now ready for review.

@xclaesse xclaesse merged commit de03bf5 into mesonbuild:master Nov 2, 2023
@xclaesse xclaesse deleted the rust-link-command branch November 2, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rust: rlib/dylib dependencies of dependencies only need -L added but not --extern
4 participants