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

library.rb:275: [BUG] Bus Error at 0x00000001042fc000 #99195

Closed
tvolkert opened this issue Feb 26, 2022 · 4 comments · Fixed by #101796 or #102327
Closed

library.rb:275: [BUG] Bus Error at 0x00000001042fc000 #99195

tvolkert opened this issue Feb 26, 2022 · 4 comments · Fixed by #101796 or #102327
Labels
a: build Building flutter applications with the tool a: desktop Running on desktop a: first hour The first hour of using Flutter P2 Important issues not at the top of the work list platform-host-arm Building on an ARM-based platform platform-ios iOS applications specifically platform-mac Building on or for macOS specifically tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@tvolkert
Copy link
Contributor

Steps to reproduce

  1. On an M1 Mac...
  2. Clone the repo at https://github.com/wmleler/thematrix
  3. Enable macos for the project by running flutter create --platforms=macos .
  4. Ensure that macos is enabled by running flutter config --enable-macos-desktop
  5. Install Cocoapods from scratch using sudo gem install cocoapods (as instructed by https://guides.cocoapods.org/using/getting-started.html#installation, which is pointed to by flutter doctor)
  6. Attempt to run the app using flutter run -d macos

Expected behavior

You expect the app to run (it's out of date and has errors after running, but it still should be able to run).

Actual behavior

You get an error building. The main error is:

/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi/library.rb:275: [BUG] Bus Error at 0x00000001042fc000

Googling for that error will eventually lead you to CocoaPods/CocoaPods#10723 (comment)

So then, you run:

sudo arch -x86_64 gem install ffi

But when you run the app again, you still get the same error.

It turns out that you can get it working by applying the following patch to flutter_tools:

diff --git a/packages/flutter_tools/lib/src/macos/cocoapods.dart b/packages/flutter_tools/lib/src/macos/cocoapods.dart
index 8e7a08f62c..c0ce393d03 100644
--- a/packages/flutter_tools/lib/src/macos/cocoapods.dart
+++ b/packages/flutter_tools/lib/src/macos/cocoapods.dart
@@ -311,7 +311,7 @@ class CocoaPods {
   Future<void> _runPodInstall(XcodeBasedProject xcodeProject, BuildMode buildMode) async {
     final Status status = _logger.startProgress('Running pod install...');
     final ProcessResult result = await _processManager.run(
-      <String>['pod', 'install', '--verbose'],
+      <String>['arch', '-x86_64', 'pod', 'install', '--verbose'],
       workingDirectory: _fileSystem.path.dirname(xcodeProject.podfile.path),
       environment: <String, String>{
         // See https://github.com/flutter/flutter/issues/10873.

... but presumably we shouldn't be unconditionally running that.

@tvolkert tvolkert added tool Affects the "flutter" command-line tool. See also t: labels. platform-mac Building on or for macOS specifically a: first hour The first hour of using Flutter a: desktop Running on desktop a: build Building flutter applications with the tool P2 Important issues not at the top of the work list labels Feb 26, 2022
@christopherfujino
Copy link
Member

So, we're already detecting a similar error, and recommend a similar workaround: #94385

@tvolkert I wonder, does arch -x86_64 sudo gem install ffi work (with the sudo after the arch call)?

@jmagman jmagman added the platform-ios iOS applications specifically label Apr 13, 2022
@jmagman jmagman added the platform-host-arm Building on an ARM-based platform label Apr 13, 2022
@eseidelGoogle
Copy link
Contributor

eseidelGoogle commented Apr 13, 2022

I hit this today and followed instructions from https://stackoverflow.com/questions/69867593/flutter-run-crash-on-ios-error-running-pod-install

To do:

sudo arch -x86_64 gem install ffi

arch -x86_64 pod install

in the "ios" folder, and then flutter build ios worked just fine. :)

It also may be Google-mac specific? I don't know if we have a different ruby than default on these machines (I know we used to have a non-standard python which sometimes caused problems).

eseidel-macbookpro3% flutter --version
Flutter 2.13.0-0.0.pre.483 • channel master • https://github.com/flutter/flutter.git
Framework • revision b086473769 (30 hours ago) • 2022-04-11 20:19:09 +0100
Engine • revision 32a2cab5d1
Tools • Dart 2.18.0 (build 2.18.0-10.0.dev) • DevTools 2.12.2

eseidel-macbookpro3% ruby --version
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]

eseidel-macbookpro3% gem --version
3.0.3.1

eseidel-macbookpro3% pod --version
1.11.3

@jmagman
Copy link
Member

jmagman commented Apr 21, 2022

#101796 wasn't complete, I just hit this myself.
New PR @ #102327

@github-actions
Copy link

github-actions bot commented May 5, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: build Building flutter applications with the tool a: desktop Running on desktop a: first hour The first hour of using Flutter P2 Important issues not at the top of the work list platform-host-arm Building on an ARM-based platform platform-ios iOS applications specifically platform-mac Building on or for macOS specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants