-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Allow iOS dynamic linking #88130
Allow iOS dynamic linking #88130
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon. Please see the contribution instructions for more information. |
|
Based on this comment, it seems like there are still several unresolved issues and merging this would re-introduce the issues that caused #77716 to be opened in the first place. Is my understanding correct or have those issues been mitigated in another way and there is no longer a concern of breaking users? Thanks! |
Ping from triage: |
'breaking users' was not caused by 'dynamic linking' but 'crate-types' are not able to override by target specific configurations. rust-lang/cargo/#4881 Users could correctly build static or dynamic libraries for iOS by setting crate type in Cargo.toml before #77716, for iOS Apps that needs to be uploaded to App Store, they can just set crate type as static. Allowing dynamic linking is not stopping people from developing iOS Apps for production use, but loosing an option to build some dylibs to iOS for tests or other use. As this comment said, he's workflow would not able to cross compile rust libraries after compiler blocked iOS dylibs (and his distro still having large ammount users in iOS jailbreak community). Aren't users who were attempting to build iOS dynamic libraries 'breaking users'? sorry for my terrible English tho |
The problem as I understand it is that some projects have multiple crate types set and (prior to #73516) We discussed #77716 in the weekly compiler team triage meeting and concluded that merging it was the most appropriate action to take at that time. Since then, no new information has been discovered and the overall situation has not changed (the required features discussed at that time like rust-lang/cargo#4881 have not yet been implemented). Therefore to reverse that decision, we will need to have another conversation in the form of a Major Change Proposal that explains why that decision was incorrect, what the correct behavior should be, what work arounds are available to users in the situation described above and what the long term behavior should be taking into account proposed Cargo features. Alternatively, I have a suggestion I did not see proposed in #77716: use a custom target JSON file which would allow you to set |
Currently I have a custom compiler with some modifications on my device that could let me create dylibs for Darwin targets. But bootstrapping full rust compiler to jailbroken iOS environment needs to compile rust for twice, which was spending much time: once for enabling rustc to build dylibs when iOS targets has been set, and use the compiler from first result to cross compile rust and rust toolchains to iOS (rustlibs cannot be built to iOS if rustc doesn't allow it). But I still wonder if there is any future plans that regarding to those issues mentioned above. Allowing separate crate types for different targets would be pretty. |
You can specify a custom json target spec with dynanic linking enabled when compiling rustc. Just pass the path to the json file instead of the target name. This saves the first bootstrap. |
Ping from triage: |
@francesca64 |
@dvc94ch I've changed jobs, so I'm no longer involved; @ArthurKValladares is the new point of contact. |
Well, that's kind of great. Now this feature will never land because one day someone's build didn't work which no longer knows if the build is broken. I guess that is why you don't make concessions for these things. Does this mean that this needs a new rust edition to be enabled? @ArthurKValladares any comments? |
I would hate to see improvements to the language never landing because of work that has fallen on my shoulders. I'll dedicate some time in the next few days to bringing myself up to date on this issue and figuring if the |
@ArthurKValladares I believe you're running into rust-lang/cargo#10356 can you try on nightly? |
@dvc94ch Yeah, this is the problem. I was under the impression that I was on nightly, but I was mistaken and everything worked after a |
@ArthurKValladares thanks for looking into this @wesleywiser is that enough to reopen and merge this PR? |
Given the new evidence, I reopened the PR in #95847 |
This reverts PR #77716.
Since Apple LLVM actually supported compiling .dylibs on/to iOS targets, there is no reason to prevent dynamic linking on a platform that supports it.
aarch64-apple-ios as a Tier 2 target that was 'promised to be compiled', should be allowed to access such a basic feature. Once dynamic library are prohibited to be built, some common libraries such as Cryptography would no longer able to run on iOS targets, it is theoretically feasible though.
I was trying to get mitmproxy working on my iPhone 12, as dynamic libraries written in rust cannot be compiled to this target, causing a lot of problems when attempting to run open source projects on an iOS device which was quite capable.