Open MihaelIsaev opened 2 months ago
@kubamracek thank you for taking on this issue.
If you can't reproduce the problem with the provided project, please check this repository where the issue can be easily replicated.
In the LightWebApp remove the code following the section in Sources/LightWebApp/LightWebApp.swift
:
// The following code is a hack to make JavaScriptKit compile
// since in the current `swift-wasm-DEVELOPMENT-SNAPSHOT-2024-06-13`
// snapshot _cdecl won't be taken from a dependency
This should lead to the following compiler error:
Building for production...
error: link command failed with exit code 1 (use -v to see invocation)
clang: warning: argument unused during compilation: '-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks' [-Wunused-command-line-argument]
wasm-ld: error: .build/wasm32-unknown-none-wasm/release/_CJavaScriptKitEmbedded.build/_CJavaScriptKit.c.o: undefined symbol: _call_host_function_impl
wasm-ld: error: .build/wasm32-unknown-none-wasm/release/_CJavaScriptKitEmbedded.build/_CJavaScriptKit.c.o: undefined symbol: _free_host_function_impl
wasm-ld: error: .build/wasm32-unknown-none-wasm/release/_CJavaScriptKitEmbedded.build/_CJavaScriptKit.c.o: undefined symbol: _library_features
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[6/7] Linking LightWebApp.wasm
Description
Bug in Embedded Swift with
@_cdecl
inside a dependency package.Toolchain: swift-wasm-DEVELOPMENT-SNAPSHOT-2024-06-09-a Build command:
swift build -c release --triple wasm32-unknown-none-wasm
Compilation error
Reproduction
Lib1 package code
Expected behavior
@_cdecl("_swiftMethod")
should be taken by the compiler from theLib1
Environment
Apple Swift version 6.0-dev (LLVM 579155491d559cc, Swift 64869e5a42221b2) Target: arm64-apple-macosx14.0
Additional information
CDeclDependencyBug.zip – project that reproduces the issue