swiftwasm / swift

WebAssembly support for the Swift programming language
https://swiftwasm.org
1.28k stars 28 forks source link

Remove pthread hack #5547

Closed kateinoigakukun closed 8 months ago

kateinoigakukun commented 11 months ago

I've tried removing 0047-wasm-stdlib-HACK-Add-pthread-stub-to-avoid-linking-e.patch patch with unmodified wasi-sysroot distributed in https://github.com/WebAssembly/wasi-sdk

It successfully compiles stdlib but got some errors when linking an executable programs

wasm-ld: error: /home/katei/ghq/work.katei.dev/swiftwasm-source/build/WebAssembly/swift-stdlib-wasi-wasm32/./lib/swift_static/wasi/libswift_Concurrency.a(GlobalExecutor.cpp.o): undefined symbol: std::__2::this_thread::sleep_for(std::__2::chrono::duration<long long, std::__2::ratio<1ll, 1000000000ll>> const&)
wasm-ld: error: /home/katei/ghq/work.katei.dev/swiftwasm-source/build-sdk/wasi-sysroot/lib/wasm32-wasi/libc.a(__main_void.o): undefined symbol: main
kateinoigakukun commented 8 months ago

Resolved by https://github.com/apple/swift/commit/87e7030e3cbe1ad9734cb8e1bcfc83dadc3c470c