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

Replace build.rs with link attributes #205

Merged
merged 1 commit into from
Feb 17, 2021
Merged

Replace build.rs with link attributes #205

merged 1 commit into from
Feb 17, 2021

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Feb 12, 2021

Closes #204.

iOS code already had link attributes. To be extra safe I would prefer for someone to verify that this change does not break iOS targets.

@Absolucy
Copy link

Absolucy commented Feb 16, 2021

I'm having issues related to note: ld: framework not found Security with iOS targets + LTO, so this seems like it'd actually fix things.

Can't test as my dep tree pulls in 0.1 and 0.2 of getrandom, though, so [patches.crates-io] doesn't work

Copy link
Member

@josephlr josephlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct. After reading the documentation for the cargo:rustc-link-lib=[KIND=]NAME instruction in build scripts, the #[link] attribute, and the -l rustc flag, I can confidently say that:

  • Adding "cargo:rustc-link-lib=framework=Security" to build.rs
  • Adding #[link(name = "Security", kind = "framework")] to an extern "C" block

do the exact same thing, namely passing -l framework=Security to rustc.

@josephlr josephlr merged commit c4a0004 into master Feb 17, 2021
@josephlr
Copy link
Member

Can't test as my dep tree pulls in 0.1 and 0.2 of getrandom, though, so [patches.crates-io] doesn't work

Does this mean you would also like to see this change backported to 0.1?

@Lokathor
Copy link

if 0.1 is getting new releases there's no reason to not also do this in 0.1

@newpavlov newpavlov deleted the link_attr branch February 17, 2021 09:25
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.

use link attributes on extern declarations rather than build.rs
4 participants