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

Support ARM32 iOS devices (iPhone 4, iPhone 5) #2089

Closed
eseidelGoogle opened this issue Feb 22, 2016 · 94 comments
Closed

Support ARM32 iOS devices (iPhone 4, iPhone 5) #2089

eseidelGoogle opened this issue Feb 22, 2016 · 94 comments

Comments

@eseidelGoogle
Copy link
Contributor

@eseidelGoogle eseidelGoogle commented Feb 22, 2016

@chinmaygarde says this should be very straightforward and is just about teaching our Mac bot to build the ARM32-bit variants of our engine, uploading them to the right place, and teaching our XCode project template to use them.

EDIT: Turns out it was not straight forward. Work is actively underway, @cbracken is driving the effort.

@eseidelGoogle eseidelGoogle added this to the Flutter 1.0 milestone Feb 22, 2016
@chinmaygarde
Copy link
Member

@chinmaygarde chinmaygarde commented Feb 22, 2016

Ninja can build a non-aarch64 engine and runner if the --ios-force-armv7 flag is specified to GN

Loading

@tvolkert tvolkert added this to the Next milestone Mar 4, 2016
@tvolkert tvolkert removed this from the Flutter 1.0 milestone Mar 4, 2016
@eseidelGoogle eseidelGoogle added this to the Flutter 1.0 milestone Mar 10, 2016
@eseidelGoogle eseidelGoogle removed this from the Next milestone Mar 10, 2016
@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Mar 10, 2016

Lets hold off on this for now. This is just a plumbing question.

  • Document the instructions on how to build for 32 bit devices.
  • Wire up our buildbots to build for ios_arm_32 and upload binaries
  • teach the flutter tool how to use the binaries.

This is almost identical to, but superseded in importance by two other bugs:
Mac #1707
Android x86 emulator #490

Loading

@chinmaygarde
Copy link
Member

@chinmaygarde chinmaygarde commented Apr 8, 2016

The buildbot now build this target. The tools need to be wired up though.

Loading

@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Nov 4, 2016

@chinmaygarde does your Apr 8 comment mean that we're publishing the artifacts but just haven't taught the flutter tool to use them? FYI @danrubel

Loading

@chinmaygarde
Copy link
Member

@chinmaygarde chinmaygarde commented Nov 15, 2016

We got rid of the GN flags for iOS ARMv7 because no one was using them and the tools never recognized this variant. flutter/engine@3fe2469

Loading

@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Feb 7, 2017

If I'm reading this right: https://www.statista.com/statistics/606147/iphone-model-device-market-share-worldwide/ 32-bit arm devices account for about 17% of the worldwide usage of idevices? If that's true, that likely bumps the priority of this bug a little at least into milestone 4 if not 3.

Loading

@chinmaygarde
Copy link
Member

@chinmaygarde chinmaygarde commented Feb 8, 2017

From the tooling perspective, supporting universal applications is a bit tricky. Though we can easily prepare a fat mach binary that supports armv7 as well as aarch64 (we already do this for the Flutter framework that can be used for both simulator and device builds), we also have to prepare and package the instructions snapshot for the Dart code in multiple architectures (via gen_snapshot). Then, at runtime, depending on the architecture of the device, pick the appropriate instructions snapshot and start the shell. This would also double the code side of the application and slow down the development in non-debug product modes (since we have to snapshot twice).

Is it possible to upload a separate binary to the App Store just for non-64 bit devices? That way, newer devices wont need to download an unnecessary copy of the code. Developers for whom it is critical to support iPhone 5 and below, can just prepare one extra IPA.

Loading

@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Apr 7, 2017

@vlidholt noted on gitter just now that the most common feedback he's received so far is lack of support for iPhone 5.

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented May 7, 2018

As of #17312 (849676f) on master, armv7-only, arm64-only, and universal iOS binaries should now be working for profile and release builds. There's one remaining VM fix required for debug builds to work on 32-bit iOS devices, which is out in r53822 and should roll into Flutter within the next couple of days.

For an example of how to update your Xcode project to build universal binaries, have a look at #17350, which does this for the Flutter Gallery example. I'll be updating the other examples and our flutter create templates shortly.

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented May 7, 2018

As of #17358, flutter create generates projects that build universal iOS binaries by default. I've updated the armv7 wiki page to explain how to update existing projects to generate universal binaries.

Loading

@cbracken cbracken closed this May 7, 2018
@MiguelCatalan
Copy link

@MiguelCatalan MiguelCatalan commented May 7, 2018

Should we do anything special to the plugins too?

I pulled the marter branch, done the changes of at #17350. But I keep getting the following error when preparing the build for release (flutter build ios --release)

 Error output from Xcode build:
↳
    ** BUILD FAILED **
    
Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
    Non-fat binary *projectdirectory*/build/ios/Release-iphoneos/Runner.app/Frameworks/geolocation.framework/geolocation is not armv7. Running lipo -info:
    Non-fat file: *projectdirectory*/build/ios/Release-iphoneos/Runner.app/Frameworks/geolocation.framework/geolocation is architecture: arm64
    Command /bin/sh failed with exit code 1
Encountered error while building for device.

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented May 7, 2018

@MiguelCatalan until this rolls to dev and beta branches, ensure that you're on the master branch (looks like you are), then run flutter upgrade.

Once that's done, and you've followed the instructions on the wiki page I updated a few minutes ago, try re-running flutter build ios --release. That should automatically detect the build setting change and re-run pod install for you if you've updated master.

If you'd prefer, you can do cd ios; pod install; cd .. from your project directory to update the pod project architecture to $(ARCHS_STANDARD).

Loading

@MiguelCatalan
Copy link

@MiguelCatalan MiguelCatalan commented May 7, 2018

Thanks @cbracken, great work btw.

I just did what you told, but keep getting the same error for the plugin geolocation when trying to build my app for release.

Did a miss anything?

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented May 7, 2018

Thanks for checking. It's entirely possible I need to do a pass over our plugins repo and verify each of them. I've verified the gallery, which uses pods, but I'll do a pass over the rest now. Until then, one possibility is to manually edit the build settings for the geolocation plugin in the same way as documented in the wiki and see if that gets you going. I'll quick try the geolocation plugin now.

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented May 7, 2018

@MiguelCatalan Here's what I tried (with a new project), which worked for me:

  1. Create the project
flutter create --ios-language=swift geoloc_test
cd geoloc_test
  1. Edit pubspec.yaml. Add geolocation: ^0.2.1 to the dependencies section.
  2. Open ios/Runner.xcworkspace. Select the Runner project. In the Build Settings tab, Set the Deployment target to 9.0 (the geolocation package has this restriction).
  3. Set my development team and bundle identifier in the Signing section of the General tab.
  4. Run the project on on 32-bit device. flutter run -d MyDevice --release

I didn't add code that made use of the geolocation plugin, but I did check the contents of the built app under build/ios/Release-iphoneos/Runner.app/Frameworks and it contained geolocation.framework. Running lipo on that framework returns:

Architectures in the fat file: build/ios/Release-iphoneos/Runner.app/Frameworks/geolocation.framework/geolocation are: armv7 arm64

I'm using flutter on master at de332ec78292c2d79fdb76034328f902c9087ee9, and cocoapods 1.5.0. If necessary, you can update cocoapods by doing gem install cocoapods and pod repo update.

Can you give that a go and let me know if that work for you?

Possibly worth noting -- the geolocation plugin isn't developed by the Flutter team or Google, but I did notice that their podspec doesn't contain s.static_framework = true which I believe we added to a lot of our plugins during the transition to cocoapods 1.5, though I'm not familiar with the background. The above steps seemed to work for me without that change though.

Loading

@johanhenselmans
Copy link

@johanhenselmans johanhenselmans commented May 8, 2018

When I run a "flutter run --release" on a new flutter project I am getting this warning :

You've implemented -[ application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
You've implemented -[ application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.

i have tried to add these settings to Info.plist in the folder ios/Runner, but no avail.

The test app runs ok, afterwards, in the real app I am getting an unhandled exception error:

Running pod install... 3.0s
Starting Xcode build...
├─Building Dart code... 44.0s
├─Assembling Flutter resources... 2.2s
└─Compiling, linking and signing... 18.7s
Xcode build done. 82.2s
Installing and launching... 20.6s

To repeat this help message, press "h". To quit, press "q".
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:

Loading

@afocsa
Copy link

@afocsa afocsa commented May 11, 2018

@cbracken It works for me, too. With flutter upgrade from master.
Do you know when will this be available on beta? Thanks.

Loading

@jeffreyfate
Copy link

@jeffreyfate jeffreyfate commented May 12, 2018

I ran the instructions described on https://github.com/flutter/engine/wiki/iOS-Builds-Supporting-ARMv7 but am still getting an error trying to run my application on an iPhone 5c:

Could not install build/ios/iphoneos/Runner.app on xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Try launching Xcode and selecting "Product > Run" to fix the problem:
  open ios/Runner.xcworkspace

Error running application on iPhone.

Loading

@MiguelCatalan
Copy link

@MiguelCatalan MiguelCatalan commented May 15, 2018

Sorry for the delay.

@cbracken I can confirm this is working.

I had to upgrade cocoapods gem install cocoapods and pod repo update.

Also and because upgrading from older version of cocoapods had to apply this.

And everything work as expected. Thanks a lot for the help.

Loading

@ypelud
Copy link

@ypelud ypelud commented May 18, 2018

Build and debug (simulator) work well on iPhone5c but Testflight crash.
Crash is may be not the good term because the app is still alive but goes background immediately.
Tests done on the basic flutter demo app.

Did someone succeed with testFlight on iPhone 5C ?

I create an issue for that #17619.

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented Jun 1, 2018

@ypelud I’ve just landed a fix for the issue you reported about distribution through test flight. Thanks for reporting.

Loading

@wurst-case
Copy link

@wurst-case wurst-case commented Mar 26, 2019

@cbracken looks like the wiki referenced above, https://github.com/flutter/engine/wiki/iOS-Builds-Supporting-ARMv7, is gone? Or the whole wiki looks to be gone. No such page on the framework's wiki exists. I'm still getting build errors for arm32 device simulators, trying to diagnose.

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented May 1, 2019

@wurst-case we've taken down the wiki page since Flutter has been building universal binaries by default for some time now. We still don't support building for 32-bit i386 simulators (just x86_64).

Can you provide some details about your usecase for 32-bit simulators and why using a 64-bit simulator device doesn't work for you?

EDIT: Interesting, it looks like I did enable support for 32-bit device simulators in #17443. Can you file a new bug with what you're seeing and repro instructions, then CC me on it?

Loading

@mleonhard
Copy link
Contributor

@mleonhard mleonhard commented Oct 30, 2019

This appears to be broken again, due to Apple discontinuing support for 32-bit builds in XCode. This wiki page has instructions for installing old build tools to get it to work:
https://github.com/flutter/flutter/wiki/Supporting-legacy-platforms

Loading

@cbracken
Copy link
Member

@cbracken cbracken commented Nov 5, 2019

@mleonhard can you run flutter upgrade to be sure you're using a recent version of the SDK, and if you're still hitting issues, would you mind providing details of the build failure you're seeing?

You're correct that 32-bit i386 binaries are no longer supported on Catalina, but we eliminated the dependency on 32-bit i386 binaries in the Flutter build over the summer. 32-bit armv7 builds for old iOS versions are still supported under Xcode 11 with the iOS 13 SDK on Catalina. Here's me building the examples/hello_world app just now:

18:16 cbracken@momiji:hello_world (master)% % sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.1
BuildVersion:	19B88

18:16 cbracken@momiji:hello_world (master)% xcodebuild -version
Xcode 11.1
Build version 11A1027

18:17 cbracken@momiji:hello_world (master)% flutter build ios --release
Downloading ios tools...                                            2.3s
Downloading ios-profile tools...                                    1.3s
Downloading ios-release tools...                                    6.4s
Running "flutter pub get" in hello_world...                         2.5s
Building io.flutter.examples.hello-world for device (ios-release)...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Signing iOS app for device deployment using developer identity: "iPhone Developer: Chris Bracken (7RANYCR6BW)"
Running Xcode build...

 ├─Building Dart code...                                    17.0s
 ├─Generating dSYM file...                                   1.4s
 ├─Stripping debug symbols...                                0.8s
 ├─Assembling Flutter resources...                           1.3s
 └─Compiling, linking and signing...                        43.7s
Xcode build done.                                           66.7s
Built /Users/cbracken/src/flutter/flutter/examples/hello_world/build/ios/iphoneos/Runner.app.

18:19 cbracken@momiji:hello_world (master)% lipo -info /Users/cbracken/src/flutter/flutter/examples/hello_world/build/ios/iphoneos/Runner.app/Runner
Architectures in the fat file: /Users/cbracken/src/flutter/flutter/examples/hello_world/build/ios/iphoneos/Runner.app/Runner are: armv7 arm64

Notice the app is still a fat binary containing both armv7 and arm64 architectures. If you're seeing this broken on recent builds, please file a bug with repro instructions and reference it here and we'll take a look.

Loading

@github-actions
Copy link

@github-actions github-actions bot commented Aug 26, 2021

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 flutter doctor -v and a minimal reproduction of the issue.

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Milestone 3
Customer Blockers
Linked pull requests

Successfully merging a pull request may close this issue.

None yet