Skip to content

Carton 0.12.0 with SwiftWasm 5.5.0 fails with linker command #268

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

Closed
Sefford opened this issue Dec 1, 2021 · 4 comments · Fixed by #270
Closed

Carton 0.12.0 with SwiftWasm 5.5.0 fails with linker command #268

Sefford opened this issue Dec 1, 2021 · 4 comments · Fixed by #270

Comments

@Sefford
Copy link

Sefford commented Dec 1, 2021

Hello, I have been running Carton 0.12.0 with SwiftWasm and my build fails with the linker command in swiftwasm/swift#3891.

I have checked the PR on #263 indicating you had added the required linker flags in carton; but looking at the code in

"--product", product.name, "--triple", "wasm32-unknown-wasi",

and

"-Xlinker", "-licuuc", "-Xlinker", "-licui18n"

I believe you have only added them for carton test and not carton build command? Would that be correct?

Is there a way to manually input those flags via command line?

Thanks!

@MaxDesiatov
Copy link
Collaborator

MaxDesiatov commented Dec 1, 2021

Thanks for reporting this! As a temporary workaround you could check the swift build command carton dev --verbose emits in console output. Then you can paste the command and run it separately, passing any additional flags you want.

What kind of error message are you seeing by the way? This will help me investigate the issue and fix it properly.

@Sefford
Copy link
Author

Sefford commented Dec 1, 2021

Sure!

The command. I see is

swift build -c debug --product BrowserApp --triple wasm32-unknown-wasi -Xlinker /Users/<username>/.carton/static/so_sanitizer.wasm -Xlinker --stack-first

and the error is the same as I mentioned earlier, the same as swiftwasm/swift#3891.

<goes like this>
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_trans_64
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_close_64
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_openU_64
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_openU_64
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_openU_64
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_openU_64
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_close_64
wasm-ld: error: /Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a(CFStringTransform.c.obj): undefined symbol: utrans_close_64
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

I have noticed also the command output by carton when doing carton bundle is

/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/bin/swift build -c release --product BrowserApp --triple wasm32-unknown-wasi

while in carton test is

/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/bin/swift build -c debug --product CrossplatformPackageTests --triple wasm32-unknown-wasi -Xswiftc -color-diagnostics -Xlinker -licuuc -Xlinker -licui18n

which would match what I saw browsing the source code in https://github.com/swiftwasm/carton/blob/04de1c22296efe925cc002b3245613faacd26162/Sources/SwiftToolchain/Toolchain.swift

However, if I manually execute the command carton bundle generates and append the flags required in Swift compiler 5.5.0:

swift build -c release --product BrowserApp --triple wasm32-unknown-wasi --build-path "$buildPath" -Xlinker -licuuc -Xlinker -licui18n

the compilation finishes correctly, which leads me to believe you are just missing the flags when generating the bundle and dev commands.

@MaxDesiatov
Copy link
Collaborator

Thanks for the clarification, I'm waiting for CI to finish on a PR that fixes it, will tag a patch release with that shortly.

@Sefford
Copy link
Author

Sefford commented Dec 1, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants