idb: Can't install idb-companion on macOS Catalina and BigSur
Description
tried to install idb-companion on macOS Catalina and macOS Big Sur and having compilation issues. Here is the log (installation via homebrew or via source code):
** BUILD FAILED **
The following build commands failed:
CompileC /tmp/idb-companion-20210520-97887-1d577si/idb-1.1.2/build/Build/Intermediates.noindex/idb_companion.build/Debug/idb_companion.build/Objects-normal/x86_64/FBIDBServiceHandler.o /tmp/idb-companion-20210520-97887-1d577si/idb-1.1.2/idb_companion/Server/FBIDBServiceHandler.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Reproduction
Run these commands on Catalina 10.15.7 or Big Sur 11.2. Homebrew:
$ brew tap facebook/fb
$ brew install idb-companion
Source code:
$ git clone https://github.com/facebook/idb.git
$ cd idb
$ ./idb_build.sh idb_companion build /usr/local/bin/idb_companion
Solution
https://github.com/facebook/idb/issues/671#issuecomment-1000497933
Additional Information
...
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 13
- Comments: 24 (1 by maintainers)
@zLinz That works indeed!
I’m going to assume this is a better fix than me commenting the faulty line (which works, believe me, I tried 😄 …)
@matgardon FYI I did not encounter this issue so far and I’m using the same config. And I had to, since I built on a target using ios 14.5.1 for which you need xcode 12.5…
Just to recap, the steps I took that allowed me to work with flipper (with errors about csrf) and use idb and idb_companion to connect to a real target:
@executable_path/../Frameworks@executable_path/Frameworks@loader_path/../Frameworks** Changed the “Build Active Architecture Only” Flag to “Yes” (Projects>idb_companion>Build settings>Architecture)Honestly, I have no idea which of these points are the ones that made the difference. Just sharing in the hope that it helps some people to unlock the situation because I did also spend 2 days straight trying absolutely everything…
EDIT: CSRF issue solved. So after checking https://github.com/facebook/flipper/issues/2113 I realised that I had done one more step that I did not describe here and that turned out to be a mistake: I added in the scheme’s build’s arguments passed on launch specific udid’s (potential solution I saw on SO I believe). Once I reverted this change, if I
idb connect <my currently connected device's udid>before launching flipper, I’m finetried updating to the latest version (macOS BigSur 11.3.1). also removed the package
idb-companion:and installed again:
result of
trying to install
lscommand:ls /usr/local/binfb-idbpip package:Make sure the package is installed:
Now we are trying to run the command of
idbpackage:Hey guys!
in the set_data error; i change to this code, use the NSData to replace buffer!!!
FBIDBServiceHandler.mm
` uintptr_t buffer[BufferOutputSize]; NSInteger size = [inputStream read:(uint8_t *)buffer maxLength:BufferOutputSize]; // use the NSData to replace buffer NSData *data = [NSData dataWithBytes:buffer length:BufferOutputSize]; if (size == 0) { break; } if (size < 0) { return Status::OK; } T response; idb::Payload *payload = response.mutable_payload(); payload->set_data(data.bytes, data.length); stream->Write(response);
`
and than in command line IDB_COMPANION=localhost:10882 idb launch com.apple.reminders
IT WORKS!!!
I’m not sure this is the best workaround ,but i can run idb now!!!
I am not able to run the maestro test on MacOS: ventura 13.1; Got below errors:
java.io.IOException: Cannot run program “idb_companion”: error=2, No such file or directory at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071) at maestro.cli.device.DeviceService.startIdbCompanion(DeviceService.kt:96) at maestro.cli.device.DeviceService.prepareDevice(DeviceService.kt:73) at maestro.cli.device.PickDeviceInteractor.pickDevice(PickDeviceInteractor.kt:26) at maestro.cli.session.MaestroSessionManager.selectDevice(MaestroSessionManager.kt:87) at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:48) at maestro.cli.command.TestCommand.call(TestCommand.kt:97) at maestro.cli.command.TestCommand.call(TestCommand.kt:39) at picocli.CommandLine.executeUserObject(CommandLine.java:1933) at picocli.CommandLine.access$1200(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332) at picocli.CommandLine$RunLast.handle(CommandLine.java:2326) at picocli.CommandLine$RunLast.handle(CommandLine.java:2291) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159) at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22) at picocli.CommandLine.execute(CommandLine.java:2058) at maestro.cli.AppKt.main(App.kt:119) Caused by: java.io.IOException: error=2, No such file or directory at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340) at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
properly working on macOS 12.1🥳 just install this with
pip3orhomebrewlog says that file
/Users/designervoid/Desktop/tests/idb/idb_companion/Server/FBIDBServiceHandler.mm:has no payload withset_datafunctionI did that and it’s working. thank you 😃)) Seriously this problem needs to be fixed with a PR. Such time consuming job.
@zLinz thanks for that, it did help me pass the build step, I’ve been fighthing on this for 2 days now (reinstalled everything from brew / python / macos helped get passed a bunch of different issues with grcp etc, but then I ended up with the JSonDecode error when trying to run from brew / pip package, went on to try to build from source, found this issue … this is a nightmare devXP, I assume I’m using it too soon and it’s not ready yet).
So although this build without issue, it fails when trying to run (with a simulator device target):
Did you downgrade XCode or did not encounter this issue ? As shown in the error logs, I’m on XCode 12.5 / bigSur 11.3.1.
@designervoid Had the same issue as you. After many hours I tried doing something pretty dirty that unlocked me a little: I went to
/usr/local/opt/grpc/lib/, figured I had alibgrpc++.1.38.dylibfile but nolibgrpc++.1.dylib, so I duplicated the former and renamed the duplicatelibgrpc++.1.dylib, tried again which made more similar errors pop, which I solved using the same strategy.After that I could run
idb list-targetssuccessfully. While this is probably the wrong way to fix the issue, it makes me feel like idb and grpc are desynchronised.Further to that I tried
idb connect --udid <my_target_udid>which failed with the errorsFailed to spawn companion, couldn't read portandFailed to start GRPC server.So that didn’t bring me very far because idb_companion is anyway wrongly set up.
Finally I tried building idb_companion from source and got the same issues as mentioned in this thread, build failed with
set_dataerror. I also tried checking out in v1.1.0 but got the same error. I’m guessing this has more to do with the version of XCode / big sur than the code itself.Hope this helps someone to unlock the situation, I’m looking forward to leveraging Flipper in my daily work!
@designervoid that is the error I was getting from xCode.
Also tried build from source in
XCode: