wireguard-apple
wireguard-apple copied to clipboard
Allows build to run on iOS Simulator for Apple Silicon
Allows wireguard-go to be built for iOS simulator which runs on Apple Silicon.
This would be super useful for those working on Apple Silicon (M1/M2). Right now I have no choice but to exit Xcode, and restart Xcode in Rosetta compatibility mode, and only then I can run my unit tests on a simulator. A huge hassle. I hope this will solve it and will get merged.
@vetrek I merged this today into my fork, but I doesn't fix it.
Error Domain=NSCocoaErrorDomain Code=4 "The file “SourcePackages” doesn’t exist." UserInfo={NSFilePath=/Users/houmie/Library/Developer/Xcode/DerivedData/project-ewigkyiwmukfdibbvzefbzcdfqhi/SourcePackages, NSUnderlyingError=0x600099ee17a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Does this fix only affect the app under Sources/WireGuardApp or also the library Sources/WireGuardKit?
@houmie I've only tested this for WireGuardKit integration through SPM, but this should work for WireGuardApp. I'm just changing the MAKEFILE which is used to compile the WireGuardKitGo lib.
have you started having this problem after the merge?
@vetrek Ah that's great. I only need it for WireGuardKit integration through SPM. Have you run it successfully on Mac M1 (Silicon)? (I got the latest after merging your PR)
First I merged your PR into my own fork and then tried to build and run it on a simulator. And that's above is the error I got. When I run it on the device, it's working fine though. How strange that it works for you.
@vetrek Ah that's great. I only need it for WireGuardKit integration through SPM. Have you run it successfully on Mac M1 (Silicon)? (I got the latest after merging your PR)
First I merged your PR into my own fork and then tried to build and run it on a simulator. And that's above is the error I got. When I run it on the device, it's working fine though. How strange that it works for you.
Yes, I'm running it on my M1 iPhone Simulator.
To be honest that does not seem to be a problem related to my commit - it seems to be a simple Xcode configuration problem.
That SourcePackages folder is automatically created when Xcode fetches all your external libs through SPM, that's why as a first step I would make sure it completes successfully.
One more thing I would like to mention is the fact that the provided Directory path for the "External Build Tool Configuration" within the documentation is incorrect for me. Not sure if this is due to the M1.

That's why I simply created a new User-Defined property for WireGuardGoBridgeiOS Target.
Like this:

Sorry, @vetrek I did some clean up and removed everything from the DerivedData folder. I also ensured I'm not excluding any Simulator architecture.
Now I get this error, does it maybe sound familiar?
Could not find module 'WireGuardKit' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator,
I even added the simulator architecture, without any luck.
How have you set up this section in your project, please?
Are you launching Xcode without rosetta, right?
Anyway, these are my settings

Why it is still not in production? And how to use it now in SPM?
@vetrek is it allows to work and test VPN on simulator? Or it is allows just to build with stubs without working functionality?
@vetrek is it allows to work and test VPN on simulator?
Or it is allows just to build with stubs without working functionality?
@crash481 just build. But you could test the VPN building your App for Mac (Designed for iPad).