majd / ipatool

Command-line tool that allows searching and downloading app packages (known as ipa files) from the iOS App Store
MIT License
5.45k stars 473 forks source link

ipatool run error on M1 #43

Closed DargonLee closed 2 years ago

DargonLee commented 2 years ago

image

lnguyen234 commented 2 years ago

Try install this: https://download.swift.org/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2021-12-06-a/swift-DEVELOPMENT-SNAPSHOT-2021-12-06-a-osx.pkg Then set export DYLD_LIBRARY_PATH=/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-12-06-a.xctoolchain/usr/lib/swift/macosx

majd commented 2 years ago

What version of macOS are you running? Did you compile ipatool yourself or did you install the Homebrew distribution?

gms8994 commented 2 years ago

I just got this after

brew tap majd/repo
brew install ipatool

==> Downloading https://github.com/majd/ipatool/releases/download/v1.0.8/ipatool-v1.0.8.zip
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/369755856/5776dd8f-9e35-4ea6-a7d8-516dfc6080b3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-A
######################################################################## 100.0%
==> Installing Cask ipatool
==> Linking Binary 'ipatool' to '/usr/local/bin/ipatool'
🍺  ipatool was successfully installed!

ipatool --version                                                                                                       master↑7|✚47… 
dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
  Referenced from: /usr/local/bin/ipatool
  Reason: image not found
[1]    30068 abort      ipatool --version

On a 2019 Intel Core i7 MBP running Big Sur.

EduardLev commented 2 years ago

I got the same error as @gms8994 on a new brew install running Big Sur 11.6.4

palaniraja commented 2 years ago

same error on Big Sur 11.4 / intel i7

gms8994 commented 2 years ago

On a 2018 Intel Core i7 running Monterey, the install runs successfully.

majd commented 2 years ago

Can you try this binary and see if it fixes the issue?

ipatool.zip

suyashbansal commented 2 years ago

Still not working on M1 Air Big Sur 11.6.3

suyash@Suyashs-MacBook-Air Downloads % ipatool
dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
  Referenced from: /opt/homebrew/bin/ipatool
  Reason: image not found
zsh: abort      ipatool
majd commented 2 years ago

Still not working on M1 Air Big Sur 11.6.3

suyash@Suyashs-MacBook-Air Downloads % ipatool
dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
  Referenced from: /opt/homebrew/bin/ipatool
  Reason: image not found
zsh: abort      ipatool

@suyashbansal I believe you are using the wrong binary given the output says that the library is referenced from /opt/homebrew/bin/ipatool. Maybe you meant to execute the new binary with ./ipatool instead of ipatool?

suyashbansal commented 2 years ago

Maybe you meant to execute the new binary with ./ipatool instead of ipatool?

You are right! I did run the new binary and still getting the similar error:

suyash@Suyashs-MacBook-Air Downloads % ./ipatool   
dyld: lazy symbol binding failed: can't resolve symbol _swift_task_create in /Users/suyash/Downloads/./ipatool because dependent dylib @rpath/libswift_Concurrency.dylib could not be loaded
dyld: can't resolve symbol _swift_task_create in /Users/suyash/Downloads/./ipatool because dependent dylib @rpath/libswift_Concurrency.dylib could not be loaded
zsh: abort      ./ipatool
suyash@Suyashs-MacBook-Air Downloads % 

Update - getting the same error on MacBook Pro 16 (2019, Core i9)

majd commented 2 years ago

@suyashbansal Could you try this one? It's built using Xcode 13.3 and the latest Swift toolchain, which I think resolves this issue.

ipatool.zip

suyashbansal commented 2 years ago

@majd still getting the same error

suyash@Suyashs-MacBook-Air Downloads % chmod +x ./ipatool
suyash@Suyashs-MacBook-Air Downloads % ./ipatool         
dyld: lazy symbol binding failed: can't resolve symbol _swift_task_create in /Users/suyash/Downloads/./ipatool because dependent dylib @rpath/libswift_Concurrency.dylib could not be loaded
dyld: can't resolve symbol _swift_task_create in /Users/suyash/Downloads/./ipatool because dependent dylib @rpath/libswift_Concurrency.dylib could not be loaded
zsh: abort      ./ipatool
majd commented 2 years ago

@suyashbansal That's unfortunate. Do you by any chance have the latest Swift runtime installed on your Mac? I believe it ships with Xcode. You can verify that by running

ls /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/macosx

If you see libswift_Concurrency.dylib, please try running

export DYLD_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/macosx

before starting the ipatool binary above and let me know the outcome.

Jinxiansen commented 2 years ago

Thanks @majd The method is useful to me. 👍

suyashbansal commented 2 years ago

@majd I don't have the full Xcode installed but I added the latest stable Swift runtime as mentioned by @lnguyen234 above.

suyash@Suyashs-MacBook-Air ~ % export DYLD_LIBRARY_PATH=/Library/Developer/Toolchains/swift-5.5.3-release.xctoolchain/usr/lib/swift/macosx
suyash@Suyashs-MacBook-Air ~ % cd Downloads 
suyash@Suyashs-MacBook-Air Downloads % ./ipatool 
OVERVIEW: A cli tool for interacting with Apple's ipa files.

USAGE: ipatool <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  download                Download (encrypted) iOS app packages from the App
                          Store.
  search                  Search for iOS apps available on the App Store.

  See 'ipatool help <subcommand>' for detailed help.
suyash@Suyashs-MacBook-Air Downloads % 

It works now!!

majd commented 2 years ago

Thanks for confirming. It seems like you need to install the Swift 5.5 toolchain or Xcode 13 (which contains the Swift 5.5 toolchain). Since macOS Catalina does not support Xcode 13, you need to install the official Swift toolchain package (thanks @lnguyen234). I've added this information to the wiki.

palaniraja commented 2 years ago

Is there a way to bundle this part of app binary? i thought builds from xcode13.2 should have included this concurrency changes similar to swift runtime, packaged along with binary(to support old versions). Though i had xcode13 installed and running BigSur 11.4 I had the same error.

Also if possible support installing old version via homebrew, i wanted to go back to old version which did not have this concurrency change but brew install ipatool@1.0.6 didn't work. Wondering if this requires additional steps from your end.

Thank you

majd commented 2 years ago

@palaniraja

Is there a way to bundle this part of app binary? i thought builds from xcode13.2 should have included this concurrency changes similar to swift runtime, packaged along with binary(to support old versions). Though i had xcode13 installed and running BigSur 11.4 I had the same error.

Initially, I had also assumed that Xcode 13.2 would statically link the Concurrency library with the compiled binary - it sadly does only seem to weakly link it. Perhaps this is currently not supported with Swift packages.

Also if possible support installing old version via homebrew, i wanted to go back to old version which did not have this concurrency change but brew install ipatool@1.0.6 didn't work. Wondering if this requires additional steps from your end.

I believe Homebrew does not support installing older versions of formulas. To grab older releases, you can either retrieve it from the releases history in this repository or grab the older formula from the commits history on majd/homebrew-repo and pass it to Homebrew.