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

Cannot compile the demo to wasm32-unknown-emscripten #1413

Open
daanboer opened this issue Dec 16, 2024 · 0 comments
Open

Cannot compile the demo to wasm32-unknown-emscripten #1413

daanboer opened this issue Dec 16, 2024 · 0 comments

Comments

@daanboer
Copy link

daanboer commented Dec 16, 2024

I am trying to compile the demo provided in this repository to the wasm32-unknown-emscripten target. According to #1121 this is simply done by issuing

cargo build --target wasm32-unknown-emscripten

in the demo directory. However, doing so results in an error: exception handling disabled, use '-fexceptions' to enable. Fortunately, this has already been reported in a comment in #1343, and I follow the solution posted in the linked issue #1317, so I run

CXXFLAGS="-DRUST_CXX_NO_EXCEPTIONS=ON" cargo build --target wasm32-unknown-emscripten

This fixes the previous error, but instead I am now greeted with linker errors:

error: linking with `emcc` failed: exit status: 1
<omitted for brevity>
wasm-ld: warning: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/build/demo-159040b455eced30/out/libcxxbridge-demo.a: archive member '8037ba413e599e6d-main.rs.o' is neither Wasm object file nor LLVM bitcode
wasm-ld: warning: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/build/demo-159040b455eced30/out/libcxxbridge-demo.a: archive member '48d3f1b29a630f4c-blobstore.o' is neither Wasm object file nor LLVM bitcode
wasm-ld: warning: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/libcxx-e355095e2e8f250f.rlib: archive member 'c16f17691ff6f04b-cxx.o' is neither Wasm object file nor LLVM bitcode
wasm-ld: warning: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/liblink_cplusplus-555366c65df2217b.rlib: archive member '8d9510866275f375-dummy.o' is neither Wasm object file nor LLVM bitcode
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: org$blobstore$cxxbridge1$new_blobstore_client
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: cxxbridge1$unique_ptr$org$blobstore$BlobstoreClient$raw
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: cxxbridge1$unique_ptr$org$blobstore$BlobstoreClient$get
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: org$blobstore$cxxbridge1$BlobstoreClient$put
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: cxxbridge1$unique_ptr$org$blobstore$BlobstoreClient$get
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: org$blobstore$cxxbridge1$BlobstoreClient$tag
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: cxxbridge1$unique_ptr$org$blobstore$BlobstoreClient$get
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: org$blobstore$cxxbridge1$BlobstoreClient$metadata
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: cxxbridge1$unique_ptr$org$blobstore$BlobstoreClient$drop
wasm-ld: error: /home/daan/git/cxx/target/wasm32-unknown-emscripten/release/deps/demo.demo.223578a9ea247727-cgu.0.rcgu.o: undefined symbol: cxxbridge1$unique_ptr$org$blobstore$BlobstoreClient$drop
emcc: error: '/nix/store/qz8x3jsspa8y7q9497skabscihl3d2ry-emscripten-llvm-3.1.64/bin/wasm-ld @/tmp/nix-shell.Sc6YqU/emscripten_aybnisi6.rsp.utf-8' failed (returned 1)

I am not sure why this happens, it seems that perhaps some intermediate libraries are not compiled to wasm?

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

No branches or pull requests

1 participant