From: Jeffrey Walton <noloader@gmail.com>
To: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: [wireguard-apple] [iOS] Running WireGuard on a simulator
Date: Wed, 1 Sep 2021 21:20:36 -0400 [thread overview]
Message-ID: <CAH8yC8=T82_UUcWsp3Q6Bv-YgAb2P5rVm-JD7uHRU1+-bmyoOg@mail.gmail.com> (raw)
In-Reply-To: <-_8oxop6VI5mP0UY_0vydSMUBInbj0hR4IUPDWshTaRG0-6O9ybfu6kzIAk68XdY9N-LHiVgaiWhNQw6-iYG1cR14pfODj2o5JMStY-75ns=@protonmail.ch>
On Wed, Sep 1, 2021 at 9:00 PM Neutron <dotneutron@protonmail.ch> wrote:
>
> I've tried running wireguard-apple on an iOS simulator and encountered some
> trouble during the compilation of WireGuardKitGo. I did this on an Apple M1,
> which I thought at first would be the culprit.
>
> The Go version is "go1.16 darwin/arm64". The build process fails at
> # runtime/cgo
> Undefined symbols for architecture arm64:
> "_darwin_arm_init_mach_exception_handler", referenced from:
> _x_cgo_init in _x004.o
> "_darwin_arm_init_thread_exception_port", referenced from:
> _threadentry in _x004.o
> _x_cgo_init in _x004.o
> ld: symbol(s) not found for architecture arm64
>
> This issue was reported a few times in Go's issues section, e.g.,
> https://github.com/golang/go/issues/45772#issuecomment-874616905
>
> Further head banging lead me to the discovery that
>
> xcodebuild -target WireGuardiOS -sdk iphoneos14.5
Yeah, whenever you start seeing problems with missing symbols related
to exception handlers, you should look at the target SDK. I see it a
lot when trying to cross compile for Apple WatchOS and AppleTV when
using the wrong SDK.
Besides -sdk, other ones to look for are -miphoneos-version-min,
-miphonesimulator-version-min, -mappletvos-version-min,
-mappletvsimulator-version-min, -mwatchos-version-min and
-mwatchsimulator-version-min. If you drop them too low, you will break
during link with the missing exception handlers.
I think what happens is, the headers mostly work with a lot of
different targets. But the exception handlers are specific to a
particular SDK, and you only have a limited range of them installed
(otherwise, you have to install older versions of Xcode and older
SDKs).
I don't know how Go affects things. I usually work with native C/C++/ObjC code.
> I don't have an actual iPhone on hand at the moment,
> so I guess the question is, is the project supposed to
> work only on real hardware? Was that flag left out
> intentionally? If so, is there a way to get it to run
> properly on simulators?
In the past, the network stack was crippled on the simulator. I don't
know if that's the case nowadays. I think Android is about the same.
It is hard to test some of this stuff on a simulator or emulator.
Jeff
next prev parent reply other threads:[~2021-09-02 1:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-02 0:57 [wireguard-apple] [iOS] Running WireGuard on a simulator Neutron
2021-09-02 1:20 ` Jeffrey Walton [this message]
2021-09-02 2:10 ` Jeffrey Walton
2021-09-02 6:48 ` Neutron
2021-09-02 7:02 ` Jeffrey Walton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH8yC8=T82_UUcWsp3Q6Bv-YgAb2P5rVm-JD7uHRU1+-bmyoOg@mail.gmail.com' \
--to=noloader@gmail.com \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).