Skip to content

Add whole_archive option to cc::Build #688

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

Closed
wants to merge 1 commit into from
Closed

Add whole_archive option to cc::Build #688

wants to merge 1 commit into from

Conversation

onalante-msft
Copy link

Rust 1.61 no longer links with whole-archive in some cases, instead linking in this manner only if requested1. This means that the emitted Cargo metadata can sometimes be insufficient to produce usable artifacts from cc::Build outputs2. A workaround is to set cargo_metadata to false and print the appropriate rustc-link-{lib,search} arguments, but having this as a built-in option would be helpful since the default linking mode (with respect to the Cargo metadata) is static linking.

Footnotes

  1. https://github.com/rust-lang/rust/blob/1.61.0/RELEASES.md#compatibility-notes

  2. Concrete example: bind_engine and v_check from here are omitted when linking into a cdylib: build script.

@petrochenkov
Copy link
Contributor

Previous PR about this - #671.

@onalante-msft
Copy link
Author

My apologies, I completely missed that. That PR is definitely the better option. Thank you for the reference.

@onalante-msft onalante-msft deleted the whole-archive branch June 24, 2022 17:48
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

Successfully merging this pull request may close these issues.

2 participants