Skip to content

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

Description

@tvolkert

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.

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    platform-macosBuilding on or for macOS specifically
    a: first hourThe first hour of using Flutter
    a: buildBuilding flutter applications with the tool
    P2Important issues not at the top of the work list
    on Feb 26, 2022
  2. christopherfujino commented on Feb 28, 2022

    @christopherfujino
    Contributor

    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)?

  3. eseidelGoogle commented on Apr 13, 2022

    @eseidelGoogle
    Contributor

    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
    
  4. jmagman commented on Apr 21, 2022

    @jmagman
    Member

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

  5. github-actions commented on May 5, 2022

    @github-actions

    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.

  6. locked as resolved and limited conversation to collaborators on May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toola: desktopRunning on desktopa: first hourThe first hour of using Flutterplatform-host-armBuilding on an ARM-based platformplatform-iosiOS applications specificallyplatform-macosBuilding on or for macOS specificallytoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions