The CLI currently assumes that the Swift toolchain is installed at /Library/Developer/Toolchains/swift-6.0.3-RELEASE.xctoolchain
. You can obtain a copy of this toolchain here. During the installation of the toolchain pkg, you need to select "Install for all users of this computer".
Before installing the SDK in the next step, export theTOOLCHAINS
environment variable:
export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-6.0.3-RELEASE.xctoolchain/Info.plist)
After installing the toolchain and exporting the TOOLCHAINS
variable, you need to install the Swift Static Linux SDK.
swift sdk install https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz --checksum 67f765e0030e661a7450f7e4877cfe008db4f57f177d5a08a6e26fd661cdd0bd
Currently, the run
command targets a local Docker daemon instead of a remote EdgeOS device, so Docker needs to be running.
You can then run the hello world example by executing the following command:
cd Examples/HelloWorld
swift run --package-path ../../ -- edge run
This will build the Edge CLI and execute it's run
command. The Edge CLI will in turn build the
HelloWorld
example using the Swift Static Linux SDK, and run it in a Docker container.
To debug the HelloWorld
example, you can use the following command:
swift run --package-path ../../ -- edge run --debug
You can now attach the LLDB debugger using port 4242
like this:
lldb
(lldb) target create .build/debug/HelloWorld
(lldb) settings set target.sdk-path "<path-to-sdk.artifactbundle>/swift-6.0.3-RELEASE_static-linux-0.0.1/swift-linux-musl/musl-1.2.5.sdk/aarch64"
(lldb) settings set target.swift-module-search-paths "<path-to-sdk.artifactbundle>/swift-6.0.3-RELEASE_static-linux-0.0.1/swift-linux-musl/musl-1.2.5.sdk/aarch64/usr/lib/swift_static/linux-static"
(lldb) gdb-remote localhost:4242
Unfortunately, running expressions (e.g. po
) doesn't work yet.