-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Automatically create destination JSON to allow linking Foundation #4
Comments
@MaxDesiatov, first, thank for the hard work you are putting in I'm spending a bit of time trying it out with some of my libs to see what can be compile and what not and I am getting into the missing Foundation problem. So I crafted the following destination file: {
"version": 1,
"sdk": "/Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/share/wasi-sysroot",
"toolchain-bin-dir": "/Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin",
"target": "wasm32-unknown-wasi",
"extra-cc-flags": [
""
],
"extra-cpp-flags": [
""
],
"extra-swiftc-flags": [
""
]
} and I am adding it as a flag to my swift build command, but I still get the Do you have any pointers as to what I am doing wrong? Thank! PS: |
Hi @ratranqu, thank you very much for your kind words! You're missing a few flags here. Sorry about that, I should've documented it, and this issue is on my list to resolve very soon. In the meantime, here's how it should look: {
"version": 1,
"sdk": "/Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/share/wasi-sysroot",
"toolchain-bin-dir": "/Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin",
"target": "wasm32-unknown-wasi",
"extra-cc-flags": [
""
],
"extra-cpp-flags": [
""
],
"extra-swiftc-flags": [
"-I", "/Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/lib/swift/wasi/wasm32",
"-Xlinker", "-lCoreFoundation",
"-Xlinker", "-lBlocksRuntime",
"-Xlinker", "-licui18n",
"-Xlinker", "-luuid"
]
} Does that allow you to get rid of the "missing required module" error? |
Yes! it solves the problem. Thx much! Now, I have issues with the building of |
Yes, I hope that passing additional flags is going to work, but on the other hand SwiftCrypto is a pretty complex project, some other issues could come up. Please post here about your experience if you can, that could be useful to other people. And if there are any bugs in either |
Will do. In the meantime, I have done the following:
|
Awesome! The issue with the number of locals is apparently caused by the lack of optimizations applied to the final binary. Did you try building it in the release mode with I'd be happy to review the PR, please go ahead 👍 |
Interestingly, building with Foundation in release mode (for instance just add Arcadia:Tokamak $ ../carton/.build/debug/carton dev --destination destination.json --release
Polyfill integrity verified: /Users/alex/.carton/static/dev.js
Inferring basic settings...
- swift executable: /Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift
Swift version 5.3-dev (LLVM b54b6b832e, Swift 4bb1458ec4)
Target: x86_64-apple-darwin19.5.0
Parsing package manifest: /Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift package dump-package
- development binary to serve: /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/debug/TokamakDemo
Building the project before spinning up a server...
/Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift build -c release --triple wasm32-unknown-wasi --product TokamakDemo --destination destination.json
Assertion failed: ((Args.size() == FTy->getNumParams() || (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && "Calling a function with bad signature!"), function init, file /Users/runner/runners/2.263.0/work/swift/llvm-project/llvm/lib/IR/Instructions.cpp, line 395.
Stack dump:
0. Program arguments: /Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift -frontend -c /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Binding.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/CGStubs.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Default.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Environment/Environment.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Environment/EnvironmentKey.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Environment/EnvironmentValues.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/Effects/ClipEffect.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/FlexFrameLayout.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/FrameLayout.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/ModifiedContent.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/PaddingLayout.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/StyleModifiers.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/ViewModifier.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Modifiers/zIndex.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/MountedComponents/MountedCompositeView.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/MountedComponents/MountedHostView.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/MountedComponents/MountedNull.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/MountedComponents/MountedView.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Null.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Renderer.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Shapes/Ellipse.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Shapes/ModifiedShapes.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Shapes/Path.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Shapes/Rectangle.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Shapes/Shape.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Shapes/ShapeModifiers.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/StackReconciler.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/State.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Target.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/Angle.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/Axis.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/Color.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/Edge.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/Font.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/LineBreakMode.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/TextAlignment.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/UnitPoint.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/AnyView.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/Button.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/ForEach.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/HStack.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/ScrollView.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/SecureField.swift /Users/alex/acer.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/Text.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/TextField.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/TupleView.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/VStack.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/View.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/ViewBuilder.swift /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Views/ZStack.swift -supplementary-output-file-map /var/folders/f5/4r6myvhn0dl1stfm524q64t80000gn/T/supplementaryOutputs-976673 -target wasm32-unknown-wasi -disable-objc-interop -sdk /Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/share/wasi-sysroot -I /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release -I /Users/alex/.swiftenv/versions/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/lib/swift/wasi/wasm32 -I /Users/alex/Documents/dev/wasm/Tokamak/.build/checkouts/Runtime/Sources/CRuntime/include -g -module-cache-path /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -Xcc -fmodule-map-file=/Users/alex/Documents/dev/wasm/Tokamak/.build/checkouts/Runtime/Sources/CRuntime/include/module.modulemap -parse-as-library -module-name TokamakCore -num-threads 8 -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Binding.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/CGStubs.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Default.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Environment/Environment.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Environment/EnvironmentKey.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Environment/EnvironmentValues.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/Effects/ClipEffect.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/FlexFrameLayout.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/FrameLayout.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/ModifiedContent.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/PaddingLayout.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/StyleModifiers.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/ViewModifier.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Modifiers/zIndex.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/MountedComponents/MountedCompositeView.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/MountedComponents/MountedHostView.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/MountedComponents/MountedNull.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/MountedComponents/MountedView.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Null.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Renderer.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Shapes/Ellipse.swift.o -o /ments/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Shapes/ModifiedShapes.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Shapes/Path.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Shapes/Rectangle.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Shapes/Shape.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Shapes/ShapeModifiers.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/StackReconciler.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/State.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Target.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/Angle.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/Axis.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/Color.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/Edge.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/Font.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/LineBreakMode.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/TextAlignment.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Tokens/UnitPoint.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/AnyView.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/Button.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/ForEach.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/HStack.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/ScrollView.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/SecureField.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/Spacer.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/Text.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/TextField.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/TupleView.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/VStack.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/View.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/ViewBuilder.swift.o -o /Users/alex/Documents/dev/wasm/Tokamak/.build/wasm32-unknown-wasi/release/TokamakCore.build/Views/ZStack.swift.o
1. Swift version 5.3-dev (LLVM b54b6b832e, Swift 4bb1458ec4)
2. While evaluating request IRGenWholeModuleRequest(IR Generation for module TokamakCore)
3. While emitting IR SIL function "@$s11TokamakCore4ViewPAAE4fontyQrAA4FontVSgF".
for 'font(_:)' (at /Users/alex/Documents/dev/wasm/Tokamak/Sources/TokamakCore/Tokens/Font.swift:165:3)
0 swift 0x00000001096fc7b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x00000001096fb738 llvm::sys::RunSignalHandlers() + 248
096fcdad SignalHandler(int) + 285
3 libsystem_platform.dylib 0x00007fff6d5d45fd _sigtramp + 29
4 libsystem_platform.dylib 0x0000000000001110 _sigtramp + 18446603338681338672
5 libsystem_c.dylib 0x00007fff6d4aa808 abort + 120
6 libsystem_c.dylib 0x00007fff6d4a9ac6 err + 0
7 swift 0x000000010a889143 llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&) (.cold.4) + 35
8 swift 0x0000000109566b2f llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&) + 447
9 swift 0x0000000108f48c4f llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::Instruction*) + 319
10 swift 0x0000000106d01255 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::MDNode*) + 69
11 swift 0x0000000105a40b83 swift::irgen::IRBuilder::CreateCall(swift::irgen::FunctionPointer const&, llvm::ArrayRef<llvm::Value*>) + 307
12 swift 0x0000000105ae95d1 getAccessorForComputedComponent(swift::irgen::IRGenModule&, swift::KeyPathPatternComponent const&, KeyPathAccessor, swift::GenericEnvironment*, llvm::ArrayRef<swift::irgen::GenericRequirement>, bool) + 1665
13 swift 0x0000000105ae591f emitKeyPathComponent(swift::irgen::IRGenModule&, swift::irgen::ConstantStructBuilder&, swift::KeyPathPatternComponent const&, bool, swift::GenericEnvironment*, llvm::ArrayRef<swift::irgen::GenericRequirement>, swift::CanType, llvm::ArrayRef<KeyPathIndexOperand>, bool) + 6879
14 swift 0x0000000105ae397b swift::irgen::IRGenModule::getAddrOfKeyPathPattern(swift::KeyPathPattern*, swift::SILLocation) + 1803
15 swift 0x0000000105b85e01 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 19985
16 swift 0x0000000105b7d4bf swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 7199
17 swift 0x0000000105a7d3e2 swift::irgen::IRGenerator::emitGlobalTopLevel(llvm::StringSet<llvm::MallocAllocator>*) + 898
18 swift 0x0000000105b52f71 swift::IRGenWholeModuleRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 993
19 swift 0x0000000105b7b895 swift::SimpleRequest<swift::IRGenWholeModuleRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::IRGenWholeModuleRequest const&, swift::Evaluator&) + 37
20 swift 0x0000000105b57603 llvm::Expected<swift::IRGenWholeModuleRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenWholeModuleRequest>(swift::IRGenWholeModuleRequest const&) + 451
21 swift 0x0000000105b529b5 swift::performIRGeneration(swift::IRGenOptions const&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::GlobalVariable**, llvm::StringSet<llvm::MallocAllocator>*) + 277
22 swift 0x00000001058d1385 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*) + 2277
23 swift 0x00000001058c46e6 performCompile(swift::CompilerInstance&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 7926
0x00000001058c17f5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3397
25 swift 0x000000010585bc3d main + 861
26 libdyld.dylib 0x00007fff6d3dbcc9 start + 1
27 libdyld.dylib 0x00000000000000b8 start + 18446603338683401200Build failed, check the build process output above.
Watching this directory for changes: /Users/alex/Documents/dev/wasm/Tokamak/Sources
[ NOTICE ] Server starting on http://127.0.0.1:8080
[ INFO ] GET /watcher
[ INFO ] GET /watcher To achieve this, I added a |
Very interesting, I'll have to investigate that more closely, looks like a bug in SwiftWasm. Thanks for reporting it! I'm currently trying to fix the most recent SwiftWasm development snapshots, and also more stable 5.3 snapshots, will let you know once those are ready to retest with those. |
Destination files are now automatically generated for each toolchain with |
This also unblocks further work on |
Hi @MaxDesiatov, I think I'm running into an issue with this: https://forums.swift.org/t/how-to-disable-implicit-foundation-imports/59678/4 I am desperately trying to stop Foundation from being linked because it is ballooning the bundle size. By writing some seemingly innocuous code like I would really like to disable this behaviour – can you point me towards how I could do that? Do I need to create a custom |
I don't think we're linking Foundation anywhere explicitly anymore, it's on done on the compiler side, specifically the driver I guess. |
@MaxDesiatov this code is still in edit: sorry, maybe that's not correct? GitHub was claiming the PR is a part of |
Ah, that's correct, thanks for looking it up. But we needed those flags for the code that does use Foundation to link. Now these flags are passed automatically, on the compiler driver side I guess, will need to investigate to confirm if needed. In my understanding, if your code does not reference any symbols in Foundation, it won't be linked even when This still means that it can be linked when your code relies on Foundation transitively. We just need to understand what that code is, and why it doesn't require |
I can reproduce this really easily, but interestingly only with JavaScriptKit right now. I will continue investigating a bit further but the following is super simple:
change
-> Foundation is linked Without the edit: this is crazy though, because the entire |
@MaxDesiatov I played around with some alternatives here, and it does seem to have something to do with JavaScriptKit, although I can't see why.
fails with the error
as soon as I add |
The reason why Foundation is automatically linked when importing JavaScriptKit is that SwiftPM generates
|
In my understanding, unused |
For anyone struggling with Foundation being implicitly imported, I've had success with the following carton invocation:
Then, to just get the Bundle location, we have to create our own "Foundation" module. This as simple as creating a // In `Sources/Foundation/MyFile.swift`
public final class Bundle {
public init?(path: String) { /* Save the path */ }
} With autolink extract disabled, we can use the custom Foundation module (to access the bundle) with no linking errors. |
@filip-sakel does that still work for you with the Swift 6 compiler? I am struggling to find any way of stopping Foundation from being linked with the edit: I'm not sure why your workaround didn't work for me at first, but it's working now also in the Swift 6 compiler. Thanks! |
Currently Foundation can't be linked even when installed due to autolinking issues. Supplying an explicit destination JSON file to
swift build
should resolve the issue in the meantime.The text was updated successfully, but these errors were encountered: