-
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
Support dylib on iOS #21727
Comments
Triage: not aware of any changes here |
This feature would be very appreciated |
Hi, |
Is implementing this just a matter of setting |
Ok, so as a practical matter this appears to be blocked on rust-lang/cargo#4881 |
ssb-keys-mnemonic-neon had some transitive dependencies updated so that it doesn't compile anymore on old versions of Rust (e.g. 1.46.0), so this means we are forced to use new versions of Rust, but in new versions we have issue rust-lang/rust#21727 which means that Rust and Cargo do not support cdylib, which is really what we need on iOS. So, we're stuck, and this commit disables Rust usage on iOS just so we can make working releases for iOS users.
Any update on this? I would really like to stop using static libraries only for iOS in projects that use shared libraries on all other platforms |
Any update on this issue? |
I concur, the issue does appear to be fixed by PR #95847 (closed without merging) and #88130 (closed without merging) - now the real question is, how do we get this fixed upstream? I've never made my own custom, patched Rust distribution before, and that doesn't look like a very simple thing to do, and even if it was, that's the kind of work that would likely take days of trial and error until it all works perfectly and is integrated into our CI environment. I've been blocked on this for a while, we have a growing number of Rust libraries that we build for Windows, macOS, Linux, Android and iOS in nuget packages with C# wrappers on top. As you can understand, static linking for iOS is very annoying as it means special treatment for one platform, but also the inability to easily ship libraries in packages built separately without symbol conflicts. The static libraries also don't necessarily trim unused code paths, so they're really big. @dvc94ch what's the next move? |
It would be great to get these fixes merged into the official Rust distro! :) |
See #95847 (comment) |
What I see is an actual fix to the current issue for which a Major Change Proposal was requested, causing the author of the pull request to close it because of lack of time. I could probably re-open a new pull request with exactly the same fixes, but then I'd have to look into what that major change proposal process is, and if, like the name says, it's a major thing. Is it really necessary? I'm not a core Rust developer, but I am very blocked on this. All the options I see right now appear fairly time consuming for something that would allow building for a platform currently hard-blocked in the code with just two boolean values. Am I seeing this as bigger than it is? |
There was a quite lengthy discussion in #77716 which might provide more context. |
For anybody else still hard-blocked on this, I have decided to bite the bullet and figure out how to roll my own Rust distribution and publish a prebuilt toolchain on GitHub Releases: https://github.com/awakecoding/llvm-prebuilt The only patch required is to set "dynamic_linking: true" in compiler/rustc_target/src/spec/apple_sdk_base.rs: My current Rust 1.64 prebuilt distribution does not include all components, but it works just fine by manually installing the patched components + the official components for the matching Rust toolchain release. I didn't get a chance to get a proper distribution manifest published somewhere, so I've just scripted the downloading and installing of individual components in my GitHub Actions workflow: https://github.com/Devolutions/sspi-rs/blob/master/.github/workflows/nuget.yml
I can now finally build Rust shared libraries for iOS, after years waiting for an upstream fix. I hope this can help others stuck in the same situation. I'd be glad to help with a pull request, but I don't see how much work would be required beyond the patch I'm already doing on my own distribution. As I understood it, there's a potential for file conflicts when building multiple crate types at a time? I would rather have an open issue about fixing that as a known limitation, rather than an open issue to enable shared library building. |
As an alternative (if you don't mind using nightly rust), we can also specify a
A dynamic target can then be built with Similar custom specs can be built for simulator (x86 and arm). |
1.65 included this PR: This should now be supported. Assuming there are no other bugs of concern: Closing! |
iOS added support for dynamic libraries in iOS 8. Clang/LLVM can now build them:
However rustc cannot:
We should support building dylibs on the platform.
The text was updated successfully, but these errors were encountered: