idb: idb-companion installation fails on Mac M1

Description

I’m working on a Mac Mini M1, already installed fb-idb, but when trying to brew install idb-companion it fails all the time with the following error:

Screen Shot 2021-01-26 at 9 41 16 PM

Reproduction

brew install idb-companion / brew reinstall --build-from-source idb-companion

Solution

[OPTIONAL: Do you know what needs to be done to address this issue? Ideally, provide a pull request which fixes this issue.]

Additional Information

  • idb revision: [FILL THIS OUT]

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 41
  • Comments: 52 (1 by maintainers)

Most upvoted comments

I managed to install idb_companion on a M1 Mac by installing x86_64 version of homebrew first and then using that to install idb_companion.

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
arch -x86_64 /usr/local/bin/brew tap Facebook/fb
arch -x86_64 /usr/local/bin/brew install idb-companion

This worked well for me, but also requires a pod install for the fresh repo clone:

$ arch # arm64
$ git clone git@github.com:facebook/idb.git
$ cd idb
$ pod install
$ ./idb_build.sh idb_companion build /opt/homebrew
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBDeviceControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBSimulatorControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/XCTestBootstrap.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBControlCore.framework/Versions/A/Resources/libShimulator.dylib
$ idb_companion --version
> {"build_time":"12:32:07","build_date":"Oct 10 2021"}

I had success installing idb-companion inside a x86 zsh and later installing fb-idb via pip3.

arch -x86_64 zsh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/usr/local/bin/brew tap Facebook/fb
/usr/local/bin/brew install idb-companion

And then in a arm shell, I ran

pip3 install fb-idb

No idea how it works, but it does 😃

Sources: https://gist.github.com/progrium/b286cd8c82ce0825b2eb3b0b3a0720a0 https://github.com/facebook/idb/issues/649#issuecomment-811746606

if you don’t want to install brew with x86_64 architecture,

$ arch # arm64
$ git clone git@github.com:facebook/idb.git
$ cd idb
$ ./idb_build.sh idb_companion build /opt/homebrew
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBDeviceControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBSimulatorControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/XCTestBootstrap.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBControlCore.framework/Versions/A/Resources/libShimulator.dylib
$ idb_companion --version
> {"build_time":"12:32:07","build_date":"Oct 10 2021"}

then install idb,

$ pip3 install fb-idb
$ idb list-targets
> iPad (9th generation) .....

tested on Mac Mini 2020 M1

These steps works for me, however, only after I also ran brew install protobuf grpc - otherwise, the command ./idb_build.sh idb_companion build /opt/homebrew would fail as the internal Xcode project relies on a couple of binaries installed. Unfortunately, it’s not too obvious from xcodebuild’s output but I recommend opening the project in Xcode and try to build the idb_companion executable there.

@jekoie I am not sure but I feel like GRPC and Protocol buffers is missing,

/bin/sh: line 3: protoc: command not found

cp: /Users/jett/idb/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/DerivedSources/*.h: No such file or directory

Could you please try,

$ brew install protobuf 
$ brew install grpc

This worked well for me, but also requires a pod install for the fresh repo clone:

$ arch # arm64
$ git clone git@github.com:facebook/idb.git
$ cd idb
$ pod install
$ ./idb_build.sh idb_companion build /opt/homebrew
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBDeviceControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBSimulatorControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/XCTestBootstrap.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBControlCore.framework/Versions/A/Resources/libShimulator.dylib
$ idb_companion --version
> {"build_time":"12:32:07","build_date":"Oct 10 2021"}

This worked thanks

@jekoie I am not sure but I feel like GRPC and Protocol buffers is missing,

/bin/sh: line 3: protoc: command not found

cp: /Users/jett/idb/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/DerivedSources/*.h: No such file or directory

Could you please try,

$ brew install protobuf 
$ brew install grpc

You are right, your solution solve my errors.

Build on M1 has been fixed on idb-companion v1.1.7. A arm64_monterey bottle was also published.

None of these solutions work for me on M1 😦

I was able to build off commit 776244655c06001953a94f3e38ec8cbd1c0dde9e on my M1 by installing gRPC and updating the Podfile tags for pod 'Protobuf-C++' to match my protoc version (which comes from conda on my system via the pip3 install fb-idb step):

$ brew install grpc
$ protoc --version
libprotoc 3.18.1

updated Podfile:

workspace 'idb_companion'

platform :macos, '10.14'

project 'idb_companion'

target 'idb_companion' do
  pod 'gRPC-C++'
  pod 'gRPC-C++/Protobuf'
  pod 'Protobuf-C++',  :git => 'https://github.com/google/protobuf.git', :tag => 'v3.18.1'
end

target 'idbGRPC' do
  pod 'Protobuf-C++',  :git => 'https://github.com/google/protobuf.git', :tag => 'v3.18.1'
end

and then pod install and ./idb_build.sh idb_companion build /opt/homebrew gave me an M1-native working Flipper.

i failed to install by the version of libprotoc 3.17.3, but working well by using libprotoc 3.19.3. Thanks a lot @kklobe!!

Issue has been solve with commit d339206e071b7968dff798042330056281268bea.

if you don’t want to install brew with x86_64 architecture,

$ arch # arm64
$ git clone git@github.com:facebook/idb.git
$ cd idb
$ ./idb_build.sh idb_companion build /opt/homebrew
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBDeviceControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBSimulatorControl.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/XCTestBootstrap.framework/Versions/A/Resources/libShimulator.dylib
$ codesign --force --sign - --timestamp=none /opt/homebrew/Frameworks/FBControlCore.framework/Versions/A/Resources/libShimulator.dylib
$ idb_companion --version
> {"build_time":"12:32:07","build_date":"Oct 10 2021"}

then install idb,

$ pip3 install fb-idb
$ idb list-targets
> iPad (9th generation) .....

tested on Mac Mini 2020 M1

this worked for me February 2022. To be sure its installed, run which idb to show the path it is installed in

@kklobe Thanks!

I’ve been able to build a Flipper for M1. This is how I did it:

  • Git cloned Flipper repo
  • Checked-out a commit with the latest release tag (I did 0.131.0, you can do any if you want to)
  • Cherry-picked this PR https://github.com/facebook/flipper/pull/3355
  • When went here and applied changes to desktop/scripts/build-release.ts

libprotoc version is 3.18.1

image

I got it working using @kklobe’s instructions but I had to run pod install before ./idb_build.sh idb_companion build /opt/homebrew. Thank you @kklobe!

@keeprock yes (I am building Flipper locally with no source changes, just an Electron version bump). I just updated to the latest commit there and everything is still working.

CleanShot 2022-01-18 at 06 56 29@2x

@mxmzb – Does brew install --HEAD idb-companion work for you? If not, then a new version won’t help. The problem is that even though this issue (#649) was solved with d339206, M1 support was quickly broken again after. #747 tracks the new issue.

We were having trouble getting IDB to run in the M1 environment without Rosetta. However it seems to work well if you set up Homebrew with Rosetta, and then run the install via that!