facebook / flipper

A desktop debugging platform for mobile developers.
https://fbflipper.com/
MIT License
13.27k stars 951 forks source link

IDB: Current setting isn't a valid IDB installation #3126

Open seyaobey-dev opened 2 years ago

seyaobey-dev commented 2 years ago

🐛 Bug Report

Apologies, this may not be a bug per se but I could not find any forum or other place where I can find help. This is the first time for me using Flipper. After having followed the instructions, I was able to install Flipper on my Macbook air M1 (2020) Monterey. When I open "Setup Doctor", everything is green except a warning with IDB:

IDB is required to use Flipper with IOS devices. (...)
Current settings:
/Library/Frameworks/Python.framework/Versions/3.10/bin isn't a valid IDB installation.

I followed the instructions on this repository and also on facebook IDB page.

To Reproduce

Install Flipper according to instructions Install facebook IDB companion and client

Environment

OS: MacOS Monterey 12.0.1, Chip Apple M1 Flipper version: 0.123.0 (50.0.0) Android Studio Artic Fox 2020.3.1 Patch 3 XCode 13.2 beta 2

lblasa commented 2 years ago

@seyaobey-dev many thanks for reaching out.

That doesn't seem the path to the idb binary. On macOS, can you please execute this on the terminal: which idb

That'll print out the path to idb. Copy the value and set it into Flipper -> Settings.

For example, this is a valid path for idb: /usr/local/bin/idb

seyaobey-dev commented 2 years ago

@Iblasa thank you so much for your answer. Here is the output of the command which idb:

/Library/Frameworks/Python.framework/Versions/3.10/bin/idb

Screenshot at Dec 10 19-22-08

seyaobey-dev commented 2 years ago

Also which pip3 returns:

/Library/Frameworks/Python.framework/Versions/3.10/bin/pip3
mweststrate commented 2 years ago

Please make sure the IDB setting ends with /idb and restart Flipper. Is the file readable by flipper and executable? use ll /Library/Frameworks/Python.framework/Versions/3.10/bin/idb to verify

Pyroboomka commented 2 years ago

@seyaobey-dev what was your steps installing idb on you mac? I'm kinda lost in the "make sure to install everything through homebrew" on m1 mac to keep stuff working.

For me brew tap facebook/fb brew install idb-companion

fails with

==> Installing facebook/fb/idb-companion
==> pod install
==> ./idb_build.sh idb_companion build /opt/homebrew/Cellar/idb-companion/1.1.5
Last 15 lines from /Users/*****/Library/Logs/Homebrew/idb-companion/02.idb_build.sh:
'
/bin/sh: line 3: protoc: command not found
cp: /tmp/idb-companion-20211217-90921-1qolsbx/idb-1.1.5/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/DerivedSources/*.h: No such file or directory
Command RuleScriptExecution failed with a nonzero exit code

WriteAuxiliaryFile /tmp/idb-companion-20211217-90921-1qolsbx/idb-1.1.5/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/Objects-normal/arm64/idbGRPC.LinkFileList (in target 'idbGRPC' from project 'idb_companion')
    cd /tmp/idb-companion-20211217-90921-1qolsbx/idb-1.1.5
    write-file /tmp/idb-companion-20211217-90921-1qolsbx/idb-1.1.5/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/Objects-normal/arm64/idbGRPC.LinkFileList

** BUILD FAILED **

And i'm kinda lost at here.

EDIT: activated a few more braincells, tried to brew install protobuf, now it fails with another error

Last 15 lines from /Users/dseb/Library/Logs/Homebrew/idb-companion/02.idb_build.sh:
Libtool /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/libPods-idb_companion.a normal (in target 'Pods-idb_companion' from project 'Pods')
    cd /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/Pods
    export MACOSX_DEPLOYMENT_TARGET\=10.14
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -D -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -L/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug -L/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/BoringSSL-GRPC -L/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/Protobuf-C++ -L/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/abseil -L/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/gRPC-C++ -L/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/gRPC-Core -filelist /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/Pods.build/Debug/Pods-idb_companion.build/Objects-normal/arm64/Pods-idb_companion.LinkFileList -dependency_info /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/Pods.build/Debug/Pods-idb_companion.build/Objects-normal/arm64/Pods-idb_companion_libtool_dependency_info.dat -o /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/libPods-idb_companion.a

Ld /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/FBControlCore.framework/Versions/A/FBControlCore normal (in target 'FBControlCore' from project 'FBSimulatorControl')
    cd /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-macos10.14 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -L/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug -F/tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug -F/Applications/Xcode.app/Contents/Developer/../Frameworks -F/Applications/Xcode.app/Contents/Developer/../PlugIns -F/Applications/Xcode.app/Contents/Developer/../OtherFrameworks -F/Applications/Xcode.app/Contents/Developer/../SharedFrameworks -F/Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/PrivateFrameworks -F/Library/Developer/PrivateFrameworks -filelist /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/FBSimulatorControl.build/Debug/FBControlCore.build/Objects-normal/arm64/FBControlCore.LinkFileList -install_name @rpath/FBControlCore.framework/Versions/A/FBControlCore -Xlinker -rpath -Xlinker @executable_path -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -object_path_lto -Xlinker /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/FBSimulatorControl.build/Debug/FBControlCore.build/Objects-normal/arm64/FBControlCore_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -framework Foundation -framework Cocoa -framework CoreGraphics -framework ServiceManagement -framework CoreMedia -Xlinker -no_adhoc_codesign -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/FBSimulatorControl.build/Debug/FBControlCore.build/Objects-normal/arm64/FBControlCore_dependency_info.dat -o /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Products/Debug/FBControlCore.framework/Versions/A/FBControlCore

** BUILD FAILED **

The following build commands failed:
    RuleScriptExecution /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/DerivedSources/idb.pb.h /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/DerivedSources/idb.pb.cc /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/DerivedSources/idb.grpc.pb.h /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/build/Build/Intermediates.noindex/idb_companion.build/Debug/idbGRPC.build/DerivedSources/idb.grpc.pb.cc /tmp/idb-companion-20211217-48935-1gibx8q/idb-1.1.5/proto/idb.proto normal arm64 (in target 'idbGRPC' from project 'idb_companion')
(1 failure)

which is kinda dead-end for me since not even an error message is present.

grean commented 2 years ago

It seems that idb is not installed in this path /usr/local/bin/idb when using this command: pip3.10 install fb-idb Maybe pip3.6 accordingly to the documentation doesn't install in the same way..

vipin04 commented 1 year ago

I am using python 3.10 I moved idb from /Library/Frameworks/Python.framework/Versions/3.10/bin to /usr/local/bin Now after giving idb location as /usr/local/bin/idb is flipper settings, idb is getting detected properly.

RichardFevrier commented 1 year ago

You should not have to move anything... If idb is accessible from your $PATH it should be used and not be hard coded to /usr/local/bin/idb...

gavrilikhin-d commented 1 year ago

Have absolutely the same issue, except cp /Library/Frameworks/Python.framework/Versions/3.10/bin/idb /usr/local/bin doesn't help

gavrilikhin-d commented 1 year ago

idb installed with python is not a binary but python's shell script.

#!/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10
# -*- coding: utf-8 -*-
import re
import sys
from idb.cli.main import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
gavrilikhin-d commented 1 year ago

Temporary workaround:

  1. pip install pyinstaller
  2. pyinstaller -F `which idb`
  3. sudo mv ./dist/idb /usr/local/bin/idb

This will create real executable file from python script, which may be used by flipper.

You may also need sudo cp /opt/homebrew/bin/idb_companion /usr/local/bin/idb_companion

gavrilikhin-d commented 1 year ago

@mweststrate could you update installation steps for new python versions?

jnunes-ds commented 9 months ago

I was heaving the same error, and the @gavrilikhin-d solution works for me. But the Flipper still don't recognize my ios device and I can't debug my application. Anyone having the same error? Note: "No Application Selected" is the error I'm getting here.

Jefid commented 7 months ago

I spent a lot of time troubleshooting this myself. Turns out all I had to do was go into the Flipper settings, and change the "IDB binary location" to match the location given when you run which idb

In my case I had to change the location to "/Users/my-username/.pyenv/idb"

With the amount of people that report having issues with installing idb to use Flipper, it blows my mind that this solution isn't included anywhere in the Flipper Installation guide.

RichardFevrier commented 7 months ago

Again, if it's in your PATH nothing should be added in the documentation and it should work properly.

SeanDunford commented 7 months ago

Again, if it's in your PATH nothing should be added in the documentation and it should work properly.

At first i was unable to get idb in my path using the default instructions. I needed to run both

Based off of https://github.com/facebook/idb/issues/620

I'd prefer not to run this command as sudo but not sure of another workaround atm.

WARNING: The directory '/Users/seandunford/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting fb-idb
  Downloading fb_idb-1.1.7-py3-none-any.whl (149 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 149.7/149.7 kB 4.3 MB/s eta 0:00:00
Requirement already satisfied: aiofiles in /usr/local/lib/python3.11/site-packages (from fb-idb) (23.2.1)
Requirement already satisfied: grpclib>=0.4.0 in /usr/local/lib/python3.11/site-packages (from fb-idb) (0.4.6)
Requirement already satisfied: protobuf in /usr/local/lib/python3.11/site-packages (from fb-idb) (4.21.12)
Requirement already satisfied: treelib in /usr/local/lib/python3.11/site-packages (from fb-idb) (1.7.0)
Requirement already satisfied: h2<5,>=3.1.0 in /usr/local/lib/python3.11/site-packages (from grpclib>=0.4.0->fb-idb) (4.1.0)
Requirement already satisfied: multidict in /usr/local/lib/python3.11/site-packages (from grpclib>=0.4.0->fb-idb) (6.0.4)
Requirement already satisfied: six in /usr/local/lib/python3.11/site-packages (from treelib->fb-idb) (1.16.0)
Requirement already satisfied: hyperframe<7,>=6.0 in /usr/local/lib/python3.11/site-packages (from h2<5,>=3.1.0->grpclib>=0.4.0->fb-idb) (6.0.1)
Requirement already satisfied: hpack<5,>=4.0 in /usr/local/lib/python3.11/site-packages (from h2<5,>=3.1.0->grpclib>=0.4.0->fb-idb) (4.0.0)
Installing collected packages: fb-idb
Successfully installed fb-idb-1.1.7
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Installing with sudo did add to my path and flipper worked correctly after that.

alioshr commented 6 months ago

I just created a symbolic link to the current path, so I can keep it under homebrew:

~ which idb -> /opt/homebrew/bin/idb

Then I did this:

ln -s /opt/homebrew/bin/idb /usr/local/bin/idb

Done =)

LukaBabunadze commented 4 months ago

ln -s /opt/homebrew/bin/idb /usr/local/bin/idb

This worked for me...

Thanks!

Jefid commented 4 months ago

Once again asking devs to add a section in the troubleshooting docs about this because this is a common issue. Linking to the idb docs that link to non-existent pip install docs isn't very intuitive.

daibergm commented 2 months ago

I used /Users/$user/Library/Python/3.9/bin/idb and it works for me

halilertekin commented 3 weeks ago

Screenshot 2024-06-13 at 18 06 22 Not working