Schlaubischlump / LocationSimulator

MacOS application to spoof / fake / mock your iOS / iPadOS or iPhoneSimulator device location. WatchOS and TvOS are partially supported.
https://schlaubischlump.github.io/LocationSimulator/
GNU General Public License v3.0
2.39k stars 184 forks source link

[Question] ARM Support #104

Closed fujistoo closed 2 years ago

fujistoo commented 2 years ago

Does this support the Apple Silicon (M1) chips?

Schlaubischlump commented 2 years ago

Libimobiledevice has no support for M1 to my knowledge, thats why LocationSimulator has no native support as well. That being said, Rosetta is still more than good enough to run LocationSimulator on M1 macs.

Furthermore LocationSimulators code is written in swift and supports ARM with no problem. As soon as there is a native M1 binary for libimobiledevice device, there will be a native version of LocationSimulator.

Tldr: Can you run it on M1 macs: yes. Is it fully optimized for the hardware: no. Does the latter matter: not really.

fujistoo commented 2 years ago

Gotcha, that was exactly what came across my mind and you just reconfirmed it in the tldr as well. What initially prompted the question was it failed to run when I installed it via Homebrew, something to do with some library missing (never looked too much into it), but obviously it ran okay using the .dmg in the releases.

Schlaubischlump commented 2 years ago

The homebrew version is quite outdated. I should really update it.

This error could actually mean that libimobiledevice is updated for Arm already. I should check this as well and recompile LocationSimulator if required.

Schlaubischlump commented 2 years ago

Okay this is possible. The problem is when I install libimobiledevice using homebrew, only the x86_64 arch will be build (I have no M1 mac). Therefore I can only build against that. This is the reason for your error as well. It is trying to run LocationSimulator on x86_64 mode against an arm only compiled libimobiledevice.

That means the homebrew version is totally broken. I either need to build a universal libimobiledevice and link against that or upload the x86_64 version with included libraries.

bayumurti94 commented 2 years ago

It's trying to load 2.0.3 while I have 2.2.0 (?) If I'm not mistaken in reading the crash log:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: /usr/local/opt/libplist/lib/libplist-2.0.3.dylib
Referenced from: /Applications/LocationSimulator.app/Contents/MacOS/LocationSimulator
Reason: tried: '/usr/local/opt/libplist/lib/libplist-2.0.3.dylib' (no such file), '/usr/local/lib/libplist-2.0.3.dylib' (no such file), '/usr/lib/libplist-2.0.3.dylib' (no such file)
(terminated at launch; ignore backtrace)
Schlaubischlump commented 2 years ago

Yes, that seems to be a problem as well. The easiest solution might be to just push the app bundle with the libraries included to homebrew. That way there is no problem with wrong architectures or dependencies installed on the host system and a universal build could be provided as well, if someone manages to create a universal build of libimobiledevice.

bslatyer commented 2 years ago

You could run GitHub actions to compile and release it with both architectures (x86_64 - Intel and aarch64 - Apple Silicon) of libmobiledevice

Schlaubischlump commented 2 years ago

But then I would have to compile libimobiledevice, usbmuxd, libplist and openssl manually for both platforms as well. Currently homebrew will only install the version for your architecture (which is Intel in my case). And I still would have to notarise the app manually or can github take care of this as well? I'll be honest: It would be great if a github action would take care of all of this, but since I never set this up, I don't feel up to the task.

I think for the future I will try to build universal binaries of all dependencies. Then Xcode can build a universal binary as well, without all this confusing homebrew setup I'm using at the moment. This is most likely the easiest solution for me.

Schlaubischlump commented 2 years ago

Has anybody access to an M1 mac with Big Sur on it ?

I would need some files from it, because compiling libimobiledevice cross platform is possible, but really time consuming. I would like to try if my idea works before I try to compile it myself.

bslatyer commented 2 years ago

Hey @Schlaubischlump,

I have two M1 Macs with both Big Sur and Monterey. Send the list of stuff you need from it and I'll get it for you.

Schlaubischlump commented 2 years ago

Great !

Can you install libimobiledevice using homebrew on the Big Sur machine and upload the following files (The homebrew path might be different for your):

  1. /usr/local/Cellar/libplist/2.2.0/lib/libplist-2.0.a
  2. /usr/local/Cellar/libusbmuxd/2.0.2/lib/libusbmuxd-2.0.a
  3. /usr/local/Cellar/libimobiledevice/1.3.0/lib/libimobiledevice-1.0.a

Make sure that the versions 2.2.0, 2.0.2 and 1.3.0 match. I think if you put the files in a zip archive you should be able to upload the file as a comment in this thread. Just drag and drop the file into the comment box on github.

bslatyer commented 2 years ago

No worries!

Here's the ZIP as requested. Homebrew.zip

Schlaubischlump commented 2 years ago

Thank you ! This helps a lot !

I'll try to export all the location spoofing stuff to a custom swift package that uses libimobiledevice internally. That way other applications could use the package to manipulate the location of iOS or simulator devices. E.g one could easily write a command line tool or a different UI. I'll try to make this package compatible with the arm architecture. That means it will take some time, until I finish adding the M1 support to LocationSimulator, but it is definitely on my To-Do list.

bslatyer commented 2 years ago

No worries! Happy to help anytime.

Schlaubischlump commented 2 years ago

Supported with version v0.1.9