swift-toolchain-ios
swift-toolchain-ios copied to clipboard
Fix script, add Swift v5 support*, and add workflow
*This will build successfully, and the resulting toolchain does appear to mostly work on-device, but there are a couple of issues that prevent said toolchain from being ready for release as-is:
- Executing
swift
/swift-frontend
results in a crash:
<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project
<unknown>:0: note: Compiler-internal integrated REPL has been removed; use the LLDB-enhanced REPL instead.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /usr/share/swift_stash/bin/swift-frontend -frontend -repl -Xllvm -aarch64-use-tbi -enable-objc-interop -color-diagnostics -module-name REPL
1. Apple Swift version 5.5.1 (swift-5.5.1-RELEASE)
2.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000103f70520 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000103f6f3d8 llvm::sys::RunSignalHandlers() + 128
2 swift-frontend 0x0000000103f70c04 SignalHandler(int) + 360
3 libsystem_platform.dylib 0x00000001dac2ad90 <redacted> + 52
4 libsystem_pthread.dylib 0x00000001dac3a9e8 pthread_kill + 212
5 libsystem_c.dylib 0x000000019b1f38f4 abort + 100
6 swift-frontend 0x00000001000b9364 PrettyStackTraceFrontend::~PrettyStackTraceFrontend() + 0
7 swift-frontend 0x0000000103ee2258 llvm::report_fatal_error(llvm::Twine const&, bool) + 244
8 swift-frontend 0x0000000103ee2164 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
9 swift-frontend 0x00000001000b91b8 PrettyStackTraceFrontend::~PrettyStackTraceFrontend() + 0
10 swift-frontend 0x0000000100025ac0 main + 468
11 libdyld.dylib 0x000000019215d568 <redacted> + 4
Abort trap: 6
- This appears to be a known issue (?) [see here]
- And, yes, llvm-symbolizer is in the PATH
- There seems to be an issue with the queried include path(s), as trying to compile a regular swift project with the latest master branch theos results in:
/var/mobile/theos/sdks/iPhoneOS14.5.sdk/usr/include/module.modulemap:118:11: error: header 'stdarg.h' not found
header "stdarg.h" // note: supplied by the compiler
^
<unknown>:0: error: could not build Objective-C module 'Darwin'
/var/mobile/theos/sdks/iPhoneOS14.5.sdk/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios.swiftinterface:4:8: error: failed to build module 'Combine'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4 (swiftlang-1205.0.24.14 clang-1205.0.19.54)', while this compiler is 'Apple Swift version 5.5.1 (swift-5.5.1-RELEASE)'). Please select a toolchain which matches the SDK.
despite the header in question existing in two places:
/usr/lib/llvm-10/lib/clang/10.0.0/include/stdarg.h
/usr/share/swift_stash/lib/clang/10.0.0/include/stdarg.h
and swiftc
checking the correct paths:
$ swiftc -print-target-info
{
"compilerVersion": "Apple Swift version 5.5.1 (swift-5.5.1-RELEASE)",
"target": {
"triple": "arm64-apple-ios10.0",
"unversionedTriple": "arm64-apple-ios",
"moduleTriple": "arm64-apple-ios",
"swiftRuntimeCompatibilityVersion": "5.0",
"compatibilityLibraries": [
{
"libraryName": "swiftCompatibility50",
"filter": "all"
},
{
"libraryName": "swiftCompatibility51",
"filter": "all"
},
{
"libraryName": "swiftCompatibilityDynamicReplacements",
"filter": "executable"
}
],
"librariesRequireRPath": true
},
"paths": {
"runtimeLibraryPaths": [
"/usr/share/swift_stash/lib/swift/iphoneos",
"/usr/lib/swift"
],
"runtimeLibraryImportPaths": [
"/usr/share/swift_stash/lib/swift/iphoneos"
],
"runtimeResourcePath": "/usr/share/swift_stash/lib/swift"
}
}
I don't see why the compiler wouldn't support older sdks, so I am assuming it's somehow related to 1 or the include path situation...?
I've confirmed the symlinks at said paths are valid but am at a loss with how to proceed. Feel free to take it from here, advise if you'd like me to take a look again, or ignore this for the time being.
Tested on iP7 -- iOS 14.3 -- Unc0ver
Supersedes #3 and "resolves" #2.
Test v5+ libswift: https://github.com/L1ghtmann/libswift/releases/latest/ Test v5+ toolchain: https://github.com/L1ghtmann/swift-toolchain-ios/releases/latest/
Edit: toolchain size drops to ~200 MBs when FINALPACKAGE is passed (which it was not in the release linked above)
Test v5+ libswift: https://github.com/L1ghtmann/libswift/releases/latest/ Test v5+ toolchain: https://github.com/L1ghtmann/swift-toolchain-ios/releases/latest/
Edit: toolchain size drops to ~200 MBs when FINALPACKAGE is passed (which it was not in the release linked above)
Did it work for you and what device and iOS version did you test on?
No, it still has the issues mentioned above.
Tested on iPhone 7 14.3.