-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Add Bitcode support for iOS #15288
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
Comments
Bitcode support is also being added to Kotlin-Native: |
Hi, is there any progress on this feature? |
Additional reason:
|
Hi Team, I understand that Bitcode support is not a high prio feature for most Flutter users. However, for security critical apps Bitcode support is crucial since most app hardening frameworks rely on it. Meaning apps that need to be hardened (e.g. for legal reasons) cannot be developed with Flutter. Would you kindly reconsider the prioritization of this feature? |
@yapcwed I would like to learn more about that use case. Can you point us to some example hardening frameworks which depend on bitcode? |
Hi, so as far as I understand this is causing the issue I have put on StackOverflow here: Is this correct? |
@magnatronus looks unrelated to bitcode, but I don't know for sure. @xster or @dnfield might. |
tvOS and watchOS stores require bitcode. |
Need this feture too,otherwise app's size may increasing |
Need iWatch and tvOS as well ! |
Also looking for WatchOS support. |
+1 |
Adding bitcode for iOs is mandatory for me . Without AppleTv or iWatchKit is not possibile to valuate Flutter as full replacement language for mobile. Please consider to increase task priority! |
@gimox you have the power to increase priority by upvoting the initial comment. @Portalesoft @fvisticot @sgalway00 Using "add reaction" on the initial comment would increase priority while Also upvotes on follow-up comments don't increase priority. |
@eseidelGoogle my tests adding a watch app to an iOS app have moved on. I now kinda have it working. My test Flutter project can be found here. As far as I have got it does basically works (I am yet to try and add a Watch Session to enabled real time comms). But I have come across an issue with Flutter (maybe?) which I have commented on in my project. The basic issue is that once I have added the Watch Kit target to the iOS project Flutter refused to either do a run or an iOS build. But if I use XCode directly I can get it to work, in both cases. |
@magnatronus that sounds pretty interesting. Can you provide any more details about how you added it to the project and got it to build? The normal way of doing this should trigger the same error as you're seeing. AFAIK (and I may very well be wrong), you need to have bitcode enabled to submit to the store for watch apps. Are you able to submit your working version to the store? |
@dnfield Basically I created a standard Flutter app, then in the iOS project just add a new target of a Watch Kit app (details in my project readme). After doing this it will not build/run using the Flutter tooling, but directly in the iOS project it will. I built out the Watch App in XCode using Swift. At the moment I have only build AD-HOC, but the steps are basically
At this point it offers 3 options (2 auto selected - which I left), which were
I then manually signed the app and then waited while it built the distro. This takes a while as it looks like it is rebuilding with BitCode. The resulting IPA file is usable for test distro (I used HockeyApp for this) and have both the iOS app and the installed Watch App on my devices. I want to try adding Watch session first, if that works I will try a store submission. |
Very cool - please do let us know if these steps end up working for the store! |
@dnfield I now have the Watch Kit session communicating with the Flutter app. Need to tidy up both code bases then I will try an app Store submission. |
@magnatronus impressive! Let us know if store submission is ok! |
@dnfield Great. I'll give it a try. |
@dnfield Many thanks for the great work. Can you give an instruction where to put I guess it's |
@dnfield I'm facing a strange error while testing this. So, I've created a new flutter project, enabled bitcode on the app target and tried to archive the app which went just fine. I've added local_auth package to pubspec, , removed the post_install hook on pod file that disables bitcode for all the plugin targets and tried to archive but now it fails.
Is there anything missing on my side ? thanks |
@vitor-gyant When you added local_auth to your pubspec, did you point to the version on pub.dev, or did you point to the one in master? If you pointed to the one in pub.dev, maybe the iOS project that gets generated is not compatible. Try pointing directly to master. |
@larryaasen Thanks but it does not work too. I don't think this has something to do with the plugin itself since bitcode support has no impact on the current source code. |
I should say that compiling in release works just fine. Compiling for Generic iOS Device too. Archive is the only step where the error occurs. |
I'll try this when I'm back at my desk tomorrow. It's likely there's still some work to do for plugins. |
@vitor-gyant - I was able to export a bitcode enabled app, but I did have to make sure to manually set |
Even when enabling bitcode for the Pods target, I'm still unable to build or archive in XCode - even when using a Generic iOS Device as the target. The error I'm getting is:
I've tried manually linking this library in the WatchKit extension targets to no effect. I imagine this points to dependencies needing bitcode support as well? Am I understanding that correctly? It seems odd that the WatchKit app would need to care about the iPhone dependencies at all. The only report I've seen of this working (from @magnatronus) is a trivial app with no dependencies. |
Yes. All of your targets must have bitcode enabled, and any frameworks your linking in must have been built with bitcode. I know I've seen at least one plugin out there that isn't (connectivity). |
@dnfield I tried to do a quick glance through of some of the flutter/packages to determine whether the iOS side has bitcode enabled or not but I couldn't get a clear understanding of what that looks like. Could you give an example of how a package is setup to support bitcode, and what file that support lives in. |
It has to be built with Many flutter plugins should work - for example, local_auth definitely works. This should always be true if you're compiling the plugin from source yourself. However, you may run into trouble if you have a binary distribution that was not built with bitcode. |
@dnfield Thanks so much for the further details. That makes more sense. I imagine we will see some issues created for packages that aren't compatible in the coming weeks. |
I've updated https://github.com/flutter/flutter/wiki/Creating-an-iOS-Bitcode-enabled-app-(experimental) with some more instructions/details around this. |
Would you mind sharing what you have configured for your Library Search Paths when you have dependencies like url_launcher? My troubleshooting up to this point has led me to believe that the project default is incorrect and causing the |
My library search paths are blank - I did this in just a brand new project:
|
Thank you for the support, @dnfield. I'll be curious to see if others are able to take an existing Flutter repo, make the updates to support bitcode, and add a WatchKit extension without issue. The documentation you've provided has been very helpful in understanding what needs to happen to enable bitcode, so I think at this point the issues I'm experiencing are project-related and not necessarily framework-related. |
@dnfield Did you have the opportunity to test a sample app with at least one plugin (url_launcher) exported with bitcode enabled ? I have tried in a new flutter project with just url_launcher in the pubspec and still get the following error only when archiving:
Since url_launcher is a source code dependency I don't see a problem related to it. I've change the podfile to set ENABLE_BITCODE to YES. Also double check that every bitcode setting is now YES in the both app and pods target. Is this something you're working on ? Thanks, |
@vitor-gyant - I did successfully build and archive the Flutter Gallery with bitcode since this. When you go to archive, are you sure you're archiving release mode? And are you sure you enabled bitcode on the pods targets as in the linked wiki page ( https://github.com/flutter/flutter/wiki/Creating-an-iOS-Bitcode-enabled-app-(experimental))? |
@dnfield It seems my working copy was not in a good "shape". After running |
Are there some example using bitcode to watch apps? |
I have checked bitcode which gets generated for the test project There should be files like 1, 2, 3, 4,... of LLVM bitcode type and wrapper. And you should be able to process those using llvm-dis. However, we get a Mach-O binary there. I have used bitcode_retriever tool to extract xar files from Runner.app/Frameworks/App.framework/App:
If you did the same for Runner.app/Runner binary, you would get correct bitcode of LLVM bitcode type:
The root cause of that issue is that an assembly file got put as input for clang:
Clang produces correct xars that carry LLVM bitcode if you pass unmanaged code or llvm-bitcode, and set -fembed-bitcode flag (it is possible to re-create a binary containing bitcode from bitcode). If it was possible to get Dart compiled into llvm-bitcode, it would be proper bitcode-enabled archives generated. Thus, even it is now possible to build projects with BITCODE_ENABLE=YES, the community I believe is still facing the following issues:
|
@peroksid90 - it would probably be helpful to discuss this in a new issue. Feel free to tag me in it. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
This issue is very old, but for interested parties: due to Apple dropping bitcode in an upcoming release, Flutter will be removing support for bitcode.
https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes Work tracked in #107887. Please file new issues if you see bugs or have documentation requests. Thanks! |
Apple may eventually require Bitcode support for iOS. It's currently required for submissions to tvOS and watchOS stores.
We've seen Dart's toolchain produce Bitcode as a demo:
https://medium.com/dartlang/dart-on-llvm-b82e83f99a70
This bug tracks (eventually) turning that demo into a production solution.
The text was updated successfully, but these errors were encountered: