From bc6c5fe6774452917360814c36cd8b3af58a1d2c Mon Sep 17 00:00:00 2001 From: Kuba Mracek Date: Wed, 19 Mar 2025 16:03:02 -0700 Subject: [PATCH] [embedded] Update embedded UserManual.md to explain how to use a macOS downloadable toolchain --- docs/EmbeddedSwift/UserManual.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/EmbeddedSwift/UserManual.md b/docs/EmbeddedSwift/UserManual.md index edcdfba415c55..3ae79e375f7ea 100644 --- a/docs/EmbeddedSwift/UserManual.md +++ b/docs/EmbeddedSwift/UserManual.md @@ -37,6 +37,19 @@ $ swiftc -target -enable-experimental-feature Embedded -wmo \ input1.swift input2.swift ... -c -o output.o ``` +On macOS, it's common to have Xcode installed, which comes with a toolchain that does not support Embedded Swift yet. Unless you download, install, and activate a swift.org toolchain, you'll see this error: + +```bash +$ swiftc input1.swift -enable-experimental-feature Embedded -wmo +:0: error: unable to load standard library for target 'arm64-apple-macosx15.0' +``` + +To resolve it, download and install a nightly toolchain from swift.org. Then, don't forget to activate it in your terminal by setting the `TOOLCHAINS` environment variable, for example with this command (if you installed into the `/Library` path): + +```bash +$ export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist) +``` + ## Examples ### Building Swift firmware for an embedded target