Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows build to run on iOS Simulator for Apple Silicon #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vetrek
Copy link

@vetrek vetrek commented Jun 15, 2022

Allows wireguard-go to be built for iOS simulator which runs on Apple Silicon.

@houmie
Copy link

houmie commented Aug 9, 2022

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.

@houmie
Copy link

houmie commented Jan 27, 2023

@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?

@vetrek
Copy link
Author

vetrek commented Jan 27, 2023

@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?

@houmie
Copy link

houmie commented Jan 27, 2023

@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
Copy link
Author

vetrek commented Jan 27, 2023

@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.

Screenshot 2023-01-27 at 15 42 03

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

Like this:

Screenshot 2023-01-27 at 15 37 12
Screenshot 2023-01-27 at 15 38 40
Screenshot 2023-01-27 at 15 38 45

@houmie
Copy link

houmie commented Jan 27, 2023

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.

Screenshot 2023-01-27 at 15 26 15

How have you set up this section in your project, please?

Screenshot 2023-01-27 at 15 33 15

@vetrek
Copy link
Author

vetrek commented Jan 27, 2023

Are you launching Xcode without rosetta, right?

Anyway, these are my settings
Screenshot 2023-01-27 at 22 08 36

@crash481
Copy link

crash481 commented Dec 6, 2023

Why it is still not in production?
And how to use it now in SPM?

@crash481
Copy link

@vetrek is it allows to work and test VPN on simulator?
Or it is allows just to build with stubs without working functionality?

@vetrek
Copy link
Author

vetrek commented Jan 23, 2024

@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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants