Skip to content

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

@tvolkert

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.

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-macBuilding 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