Skip to content

Commit

Permalink
toolchain: swift 5.9 support static build
Browse files Browse the repository at this point in the history
  • Loading branch information
CmST0us committed Oct 21, 2023
1 parent f040d04 commit 7ec74fb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
25 changes: 25 additions & 0 deletions Destinations/macos/arm-none-linux-gnueabihf-5.9-static.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": 1,
"sdk": "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/",
"sysroot-flag": "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/",
"toolchain-bin-dir": "/Library/Developer/Toolchains/swift-5.9-RELEASE.xctoolchain/usr/bin",
"target": "armv7-unknown-linux-gnueabihf",
"dynamic-library-extension": "so",
"extra-cc-flags": [
"--sysroot=/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/toolchain/arm-none-linux-gnueabihf/libc",
"-isystem", "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/toolchain/arm-none-linux-gnueabihf/include/c++/12.2.1",
"-isystem", "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/toolchain/arm-none-linux-gnueabihf/include/c++/12.2.1/arm-none-linux-gnueabihf"
],
"extra-swiftc-flags": [
"-target", "armv7-unknown-linux-gnueabihf",
"-use-ld=/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/linker/macos_arm64/ld.gold",
"-tools-directory", "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/toolchain/lib/gcc/arm-none-linux-gnueabihf/12.2.1",
"-sdk", "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/toolchain/arm-none-linux-gnueabihf/libc",
"-resource-dir", "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/usr/lib/swift_static",
"-L", "/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/toolchain/lib/gcc/arm-none-linux-gnueabihf/12.2.1/",
"-latomic"
],
"extra-cpp-flags": [
"--sysroot=/Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf/toolchain/arm-none-linux-gnueabihf/libc",
],
}
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Create `Runtimes` folder in `/Library/Developer` if there is not exist
`mkdir -p /Library/Developer/Runtimes`

Copy destinations file
`cp Destinations/macos/arm-none-linux-gnueabihf-5.9.json /Library/Developer/Destinations`
`cp Destinations/macos/arm-none-linux-gnueabihf-*.json /Library/Developer/Destinations`

Decompression file `swift-5.9-runtime-arm-none-linux-gnueabihf` into `/Library/Developer/Runtimes`

```
mkdir -p /Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf
tar xf swift-5.9-runtime-arm-none-linux-gnueabihf.tar.xz -C /Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf
tar xf swift-5.9-runtime-arm-none-linux-gnueabihf.tar.gz -C /Library/Developer/Runtimes/swift-5.9-runtime-arm-none-linux-gnueabihf
```

# How to install runtime in linux target
Expand All @@ -46,6 +46,12 @@ swift package init --type executable
swift build --destination /Library/Developer/Destinations/arm-none-linux-gnueabihf-5.9.json
```

Build Static
```
swift package init --type executable
swift build --destination /Library/Developer/Destinations/arm-none-linux-gnueabihf-5.9-static.json --static-swift-stdlib
```

After building success, you can upload binary to you target device, and run it.


Expand Down
4 changes: 2 additions & 2 deletions swift-5.9-runtime-arm-none-linux-gnueabihf.tar.gz
Git LFS file not shown

0 comments on commit 7ec74fb

Please sign in to comment.