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

[bazel] Failed to build on Emscripten #459

Closed
kon72 opened this issue Nov 16, 2023 · 5 comments
Closed

[bazel] Failed to build on Emscripten #459

kon72 opened this issue Nov 16, 2023 · 5 comments

Comments

@kon72
Copy link

kon72 commented Nov 16, 2023

I bumped the version of re2 for my project and now the build fails with the following error:

wasm-ld: error: --shared-memory is disallowed by bazel-out/wasm-dbg-ST-b4dbd4a2bfc4/bin/foo/_objs/test_wasm.js/test.o because it was not compiled with 'atomics' or 'bulk-memory' features.

After some digging, I found out that the error was introduced in 055e124 where the platform selection was narrowed down from @platforms//cpu:wasm32 to @platforms//os:wasi.
Since in non-standalone build Emscripten only sets cpu to wasm32 and doesn't set os to wasi, I suspect the change should be reverted to check whether cpu is wasm32.

@junyer
Copy link
Contributor

junyer commented Nov 16, 2023

Thanks for the report! I see what you mean; this looks like the standalone logic. Do you have any suggestions, @anuraaga? It seems like specifying @platforms//os:wasi and @platforms//cpu:wasm32 (plus @platforms//cpu:wasm64?) would address all of the possibilities here, but that might be overdoing it.

@anuraaga
Copy link

Hi @junyer - unfortunately I haven't ever used bazel to build this repo and have used only wasi-sdk, not emscripten so am not sure how to solve this particular issue in terms of syntax.

@kon72 Just curious what version did you bump from? re2 migrated to using absl for logging so it requires threads support now, which implies shared memory and generally poor support for wasm. I am pinning to march 1st version possiby for a long time because while I have been trying to get threads support into wazero, many issues make it seem unlikely to happen in the mid term.

https://github.com/wasilibs/go-re2/blob/main/buildtools/re2/Dockerfile#L12

@junyer
Copy link
Contributor

junyer commented Nov 16, 2023

Thanks, @anuraaga. I will just try what I suggested and see whether that helps. :)

@kon72
Copy link
Author

kon72 commented Nov 18, 2023

I will just try what I suggested and see whether that helps. :)

I confirmed that 7e0c1a9 resolves the error. Thank you for the quick fix!

@junyer
Copy link
Contributor

junyer commented Nov 18, 2023

Great, thanks for confirming. :)

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.

3 participants