Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and test with SwiftWasm 5.6 on CI #475

Merged
merged 25 commits into from
Apr 8, 2022
Merged

Conversation

MaxDesiatov
Copy link
Collaborator

@MaxDesiatov MaxDesiatov commented Apr 5, 2022

Had to drop support for Swift 5.4/5.5 and macOS 5.6 jobs, see #475 (comment) for more details.

Also applied a few formatting changes with the latest SwiftFormat.

Configuration for simultaneous builds with SwiftWasm 5.4, 5.5, and 5.6 can't be specified more succinctly due to swiftwasm/swiftwasm-action#3. I had to create almost duplicate job descriptions because of that.
@MaxDesiatov MaxDesiatov added the continuous integration Changes related to the continuous integration process label Apr 5, 2022
@MaxDesiatov
Copy link
Collaborator Author

MaxDesiatov commented Apr 5, 2022

I'm seeing a validation issue in TokamakDemo.wasm binaries built with SwiftWasm 5.6:

% ../wasminspect/target/debug/wasminspect ./.build/debug/TokamakDemo.wasm
[2022-04-05T10:19:11Z WARN  wasminspect_debugger::debugger] type mismatch: expected i32 but nothing on stack (at offset 22347435)
type mismatch: expected i32 but nothing on stack (at offset 22347435)

Broken binary produced by SwiftWasm 5.6 is attached below. It's also reproducible with carton 0.13.0 on this branch with carton dev --product TokamakDemo.

TokamakDemo.wasm.zip

cc @kateinoigakukun

@kateinoigakukun
Copy link
Contributor

I guess our WasmTransformer does something wrong...

@kateinoigakukun
Copy link
Contributor

Please try again with swiftwasm/carton#310

MaxDesiatov added a commit to swiftwasm/JavaScriptKit that referenced this pull request Apr 8, 2022
New release is required to resolve TokamakUI/Tokamak#475.

I've also cleaned up formatting in `.ts` file and clarified version incompatibility error message.
@kateinoigakukun kateinoigakukun deleted the maxd/swiftwasm-5.6 branch April 8, 2022 08:42
@kateinoigakukun kateinoigakukun restored the maxd/swiftwasm-5.6 branch April 8, 2022 08:44
@@ -1,32 +1,7 @@
// swift-tools-version:5.4
// swift-tools-version:5.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need to update tools version? Can we keep [email protected] for older toolchains?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me double-check this once again... I've tried this once and 5.4/5.5 didn't really work with latest carton

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, latest carton doesn't support SwiftWasm 5.5 with this package:

/Users/maxd/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/bin/swift build -c debug --product TokamakDemo --triple wasm32-unknown-wasi -Xlinker -licuuc -Xlinker -licui18n -Xlinker /Users/maxd/.carton/static/so_sanitizer.wasm -Xlinker --stack-first
Fetching https://github.com/pointfreeco/swift-snapshot-testing.git from cache
Fetching https://github.com/swiftwasm/JavaScriptKit.git from cache
Fetching https://github.com/swiftwasm/OpenCombineJS.git from cache
Fetched https://github.com/swiftwasm/OpenCombineJS.git (0.57s)
Fetching https://github.com/apple/swift-argument-parser from cache
Fetched https://github.com/swiftwasm/JavaScriptKit.git (0.61s)
Fetching https://github.com/OpenCombine/OpenCombine.git from cache
Fetched https://github.com/pointfreeco/swift-snapshot-testing.git (0.62s)
Fetching https://github.com/google/swift-benchmark from cache
Fetched https://github.com/google/swift-benchmark (0.53s)
Fetched https://github.com/apple/swift-argument-parser (0.64s)
Fetched https://github.com/OpenCombine/OpenCombine.git (0.80s)
Computing version for https://github.com/pointfreeco/swift-snapshot-testing.git

Process failed and produced following output: 
Process failed with non-zero exit status and following output:
 and following error output:
https://github.com/pointfreeco/swift-snapshot-testing.git @ 1.9.0: error: invalidManifestFormat("Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.\nStack dump:\n0.\tProgram arguments: /Users/maxd/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /var/folders/0k/y5p_js3n0px8m267zq95dkd40000gn/T/TemporaryFile.Ntq1Bv.swift -target arm64-apple-macosx11.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -I /Users/maxd/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift/pm/ManifestAPI -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -swift-version 5 -package-description-version 5.0.0 -disable-implicit-concurrency-module-import -target-sdk-version 12.3 -module-name main -o /var/folders/0k/y5p_js3n0px8m267zq95dkd40000gn/T/TemporaryFile.Ntq1Bv-03e596.o\n1.\tSwiftWasm Swift version 5.5 (swiftlang-5.5.0)\n2.\t\n3.\tWhile evaluating request IRGenRequest(IR Generation for file \"/var/folders/0k/y5p_js3n0px8m267zq95dkd40000gn/T/TemporaryFile.Ntq1Bv.swift\")\n4.\tWhile emitting IR SIL function \"@main\".\nStack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):\n0  swift-frontend           0x0000000103f493e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56\n1  swift-frontend           0x0000000103f48520 llvm::sys::RunSignalHandlers() + 128\n2  swift-frontend           0x0000000103f49c1c SignalHandler(int) + 292\n3  libsystem_platform.dylib 0x00000001ab2ed4c4 _sigtramp + 56\n4  swift-frontend           0x0000000101fbdc60 clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>, bool, bool, llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo, llvm::ArrayRef<clang::FunctionType::ExtParameterInfo>, clang::CodeGen::RequiredArgs) + 792\n5  swift-frontend           0x0000000101fbdc60 clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>, bool, bool, llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo, llvm::ArrayRef<clang::FunctionType::ExtParameterInfo>, clang::CodeGen::RequiredArgs) + 792\n6  swift-frontend           0x0000000102151d28 clang::CodeGen::arrangeFreeFunctionCall(clang::CodeGen::CodeGenModule&, clang::CanQual<clang::Type>, llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo, clang::CodeGen::RequiredArgs) + 60\n7  swift-frontend           0x0000000100bccdd8 swift::irgen::Signature::getUncached(swift::irgen::IRGenModule&, swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 968\n8  swift-frontend           0x0000000100c4ac9c swift::irgen::IRGenModule::getSignature(swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 172\n9  swift-frontend           0x0000000100c7da9c swift::irgen::getObjCMethodCallee(swift::irgen::IRGenFunction&, swift::irgen::ObjCMethod const&, llvm::Value*, swift::irgen::CalleeInfo&&) + 120\n10 swift-frontend           0x0000000100d0acd4 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2772\n11 swift-frontend           0x0000000100cf4e28 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 6528\n12 swift-frontend           0x0000000100c043c0 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 716\n13 swift-frontend           0x0000000100cc90cc swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 1784\n14 swift-frontend           0x0000000100cf31d0 swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 188\n15 swift-frontend           0x0000000100cd2954 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 332\n16 swift-frontend           0x0000000100ccaf2c swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 196\n17 swift-frontend           0x0000000100967ae4 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1904\n18 swift-frontend           0x00000001009670e0 performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 300\n19 swift-frontend           0x000000010095d428 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4076\n20 swift-frontend           0x00000001008c986c main + 544\n21 dyld                     0x00000001061d9088 start + 516\n<unknown>:0: error: unable to execute command: Segmentation fault: 11\n<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)", diagnosticFile: nil) in https://github.com/pointfreeco/swift-snapshot-testing.git

@MaxDesiatov
Copy link
Collaborator Author

MaxDesiatov commented Apr 8, 2022

I had to drop SwiftWasm 5.4/5.5, as those are incompatible with new package manifest format parsed by latest carton. Also makes sense to raise the requirement in our Package.swift to 5.6 to prevent users from stumbling upon that issue.

As a consequence, I had to disable macos-11 jobs, as macos-12 is not generally available yet on GHA, but they're required for Xcode 13.3 and Swift 5.6. I've submitted a request for macos-12 for TokamakUI org, but it hasn't been granted yet.

In a seemingly unrelated way GTK Swift 5.6 jobs are crashing on Linux with this error:

1.	Swift version 5.6 (swift-5.6-RELEASE)
2.	Compiling with the current language version
3.	While evaluating request TypeCheckSourceFileRequest(source_file "/home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift")
4.	While type-checking '_AnyTransitionModifier' (at /home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift:61:8)
5.	While type-checking 'isActive' (at /home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift:64:7)
6.	While evaluating request CheckRedeclarationRequest(TokamakCore.(file)._AnyTransitionModifier.isActive@/home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift:64:7)
7.	While building rewrite system for generic signature <τ_0_0 where τ_0_0 : _AnyTransitionModifier>

I'm disabling those jobs as well, until those compiler crashes are fixed.

@MaxDesiatov MaxDesiatov marked this pull request as ready for review April 8, 2022 09:47
@MaxDesiatov MaxDesiatov requested a review from a team April 8, 2022 09:50
@MaxDesiatov
Copy link
Collaborator Author

MaxDesiatov commented Apr 8, 2022

I managed to re-enable GTK Linux builds, turns out the compiler crash is fixed in swiftlang/swift:nightly Docker images.

@carson-katri
Copy link
Member

Awesome, that’s the same error I was seeing on the fiber branch with the Linux builds, and was stumped.

@ezraberch
Copy link
Member

Dropping support for Swift <5.6 should mean we can get rid of all of the references to earlier versions throughout the codebase.

i.e.

#if compiler(>=5.5) && (canImport(Concurrency) || canImport(_Concurrency))

@MaxDesiatov
Copy link
Collaborator Author

Thanks, that's a great point. I've addressed it in the latest commit.

.github/workflows/codecov.yml Outdated Show resolved Hide resolved
@MaxDesiatov MaxDesiatov requested review from j-f1 and a team April 8, 2022 15:45
@MaxDesiatov MaxDesiatov merged commit fd64eaf into main Apr 8, 2022
@MaxDesiatov MaxDesiatov deleted the maxd/swiftwasm-5.6 branch April 8, 2022 20:36
MaxDesiatov pushed a commit to swiftwasm/carton that referenced this pull request Apr 9, 2022
- Reactor model support
- Update sanitizer support object

This is required to resolve TokamakUI/Tokamak#475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
continuous integration Changes related to the continuous integration process
Development

Successfully merging this pull request may close these issues.

5 participants