fulldecent / corelocationcli

Command line program to print location information from CoreLocation
MIT License
217 stars 29 forks source link

bad CPU type in executable: /usr/local/bin/CoreLocationCLI #42

Open rr0ss0rr opened 2 years ago

rr0ss0rr commented 2 years ago

Did a brew upgrade CoreLocationCLI and received the error. I removed and did a brew install cask corelocationcli with same results.

MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports) 2.3 GHz Quad-Core Intel Core i5

Thanks

jlconlin commented 2 years ago

I have the same issue. This did work on my M1 MacBook Pro, but it failed on my Intel-based Mac

MacBook Pro (16-inch, 2019) 2.4 GHz 8-Core Intel Core i9

evgkrsk commented 2 years ago
~ > brew ls corelocationcli
==> Binary
/usr/local/bin/CoreLocationCLI -> /usr/local/Caskroom/corelocationcli/4.0.0/CoreLocationCLI (98.9KB)

~ > file /usr/local/bin/CoreLocationCLI
/usr/local/bin/CoreLocationCLI: Mach-O 64-bit executable arm64

~ > uname -rsm
Darwin 21.5.0 x86_64
edoardob90 commented 1 year ago

Easiest workaround: compile it for your current machine. Download the repo, unzip, and then run swift build -c release from the root folder. The binary will be available in the hidden folder ./.build/<arch>/release. You can optionally move the binary to a location in your PATH. It requires XCode, obviously.

mschirrmeister commented 1 year ago

Wondering why the official package is not build as a universal binary for both architectures. I ran into the same issue and setup as a workaround my own homebrew tap and compiled it with swift build -c release --arch arm64 --arch x86_64. Hope the upstream homebrew cask will be universal at one point. Intel Macs are not going away anytime soon.

fulldecent commented 1 year ago

CoreLocationCLI.zip

I just ran this and got this executable. Any good?


Also I can't find any documentation for these --arch flags. But it seems straightforward enough. Happy to support universal builds if this works.

mschirrmeister commented 1 year ago

Looks like still a arm64 binary only.

marco@loop ~/Downloads> ./CoreLocationCLI
exec: Failed to execute process '/Users/marco/Downloads/CoreLocationCLI': Bad CPU type in executable.

marco@loop ~/Downloads> lipo -info CoreLocationCLI
Non-fat file: CoreLocationCLI is architecture: arm64

When I run it on the one I compiled.

◆ corelocationcli git:(main) ❯❯❯ lipo -info .build/apple/Products/Release/CoreLocationCLI
Architectures in the fat file: .build/apple/Products/Release/CoreLocationCLI are: x86_64 arm64

I don't know where the options are in the official documentation. I found it here. https://developer.apple.com/forums/thread/667440 https://liamnichols.eu/2020/08/01/building-swift-packages-as-a-universal-binary.html

Also read somewhere that you can change something in Xcode, but could not figure out what to do in Xcode that it spits out a universal binary.

mayurankv commented 1 year ago

Also really looking forward to this working on Intel Macs! Very sad that its not been working since April :(. p.s. @mschirrmeister Could you explain the hosting your own homebrew tap briefly? I would love this temporary fix!

fulldecent commented 1 year ago

Trying a new approach. Please see

https://github.com/fulldecent/corelocationcli/releases/tag/4.0.2

https://github.com/Homebrew/homebrew-cask/pull/136269

mschirrmeister commented 1 year ago

@fulldecent, version 4.0.2 works perfect. :-)

@mayurankv, not sure what you exactly mean. My repo is here and it has some description. Does that answer your question? https://github.com/mschirrmeister/homebrew-corelocationcli

mayurankv commented 1 year ago

I was just wondering how to replicate the same self-maintained tap but 4.0.2 works great for me (up to the location privacy issues mentioned in another issue) so no need anymore. Thanks so much for the speedy responses!

mayurankv commented 1 year ago

On that note, this thread can be closed no?