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

Basis Doesn't Work on Wasm Target #17657

Open
anlumo opened this issue Feb 3, 2025 · 0 comments
Open

Basis Doesn't Work on Wasm Target #17657

anlumo opened this issue Feb 3, 2025 · 0 comments
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled

Comments

@anlumo
Copy link
Contributor

anlumo commented Feb 3, 2025

Bevy version

0.15.1

[Optional] Relevant system information

If you cannot get Bevy to build or run on your machine, please include:

  • the Rust version you're using (you can get this by running cargo --version)

rustc 1.86.0-nightly (4a4309466 2025-02-02)

  • the operating system or browser used, including its version
    • e.g. Windows 10, Ubuntu 18.04, iOS 14

Archlinux

What you did

Compile bevy with the feature basis-universal.

What went wrong

Works fine on native, but if I compile for the wasm32-unknown-unknown target, there are hundreds of error messages like this:

warning: [email protected]: In file included from vendor/basis_universal/encoder/pvpngreader.cpp:14:
warning: [email protected]: vendor/basis_universal/encoder/../transcoder/basisu.h:53:10: fatal error: 'stdlib.h' file not found
warning: [email protected]:    53 | #include <stdlib.h>
warning: [email protected]:       |          ^~~~~~~~~~
warning: [email protected]: 1 error generated.
warning: [email protected]: ToolExecError: Command LC_ALL="C" "clang++" "-O0" "-ffunction-sections" "-fdata-sections" "-fno-exceptions" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-DBASISD_SUPPORT_KTX2_ZSTD=0" "-o" "/home/anlumo/Documents/dungeonfog/catalyst/target/wasm32-unknown-unknown/debug/build/basis-universal-sys-c1c2199e0df7ab26/out/dfe9b9f658ee268e-pvpngreader.o" "-c" "vendor/basis_universal/encoder/pvpngreader.cpp" with args clang++ did not execute successfully (status code exit status: 1).cargo:warning=In file included from vendor/basis_universal/encoder/jpgd.cpp:27:
warning: [email protected]: vendor/basis_universal/encoder/jpgd.h:6:10: fatal error: 'stdlib.h' file not found
warning: [email protected]:     6 | #include <stdlib.h>
warning: [email protected]:       |          ^~~~~~~~~~
warning: [email protected]: 1 error generated.
warning: [email protected]: ToolExecError: Command LC_ALL="C" "clang++" "-O0" "-ffunction-sections" "-fdata-sections" "-fno-exceptions" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-DBASISD_SUPPORT_KTX2_ZSTD=0" "-o" "/home/anlumo/Documents/dungeonfog/catalyst/target/wasm32-unknown-unknown/debug/build/basis-universal-sys-c1c2199e0df7ab26/out/dfe9b9f658ee268e-jpgd.o" "-c" "vendor/basis_universal/encoder/jpgd.cpp" with args clang++ did not execute successfully (status code exit status: 1).

Additional information

This is C++ code, that won't work on wasm due to incompatible ABIs. basis does have web support (I think by compiling the C++ code to wasm), but that needs special handling through the JavaScript library's interface.

I'm not sure if this is considered a bug or a feature request. It's a bug in that it's supposed to just work but doesn't, but fixing it will require a new implementation specifically for the web.

@anlumo anlumo added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

No branches or pull requests

1 participant