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
[wasm] error: undefined symbol: emscripten_webgpu_get_device #20422
Comments
This is probably caused by: |
mmm I see, any suggestions on how to generate the bc file then? If I use the .a extension it says that the file is not an static library. However I'm using emscripten 1.40... |
Ok @vargaz I managed to remove the invalid input file warning by compiling to bitcode the following source: #include <emscripten.h>
#include <emscripten/html5.h>
#include <emscripten/html5_webgpu.h>
extern "C"
{
WGPUDevice test_emscripten_webgpu_get_device(void);
void test_emscripten_set_main_loop(em_callback_func func, int fps, int simulate_infinite_loop);
void test_emscripten_cancel_main_loop(void);
}
WGPUDevice test_emscripten_webgpu_get_device(void)
{
return emscripten_webgpu_get_device();
}
void jemscripten_set_main_loop(em_callback_func func, int fps, int simulate_infinite_loop)
{
emscripten_set_main_loop(func, fps, simulate_infinite_loop);
}
void test_emscripten_cancel_main_loop(void)
{
emscripten_cancel_main_loop();
} The libWebGPU.bc file is generated with the following command: Now, if I do in c#:
I can compile but javascript console says On the other hand, if I do (note not puting the bc extension): [DllImport("libWebGPU")]
private static extern void test_emscripten_set_main_loop(EMLoop func, int fps, int simulate_infinite_loop); Then ninja build fails:
|
Try using libWebGPU.o as the file name, '.bc' is llvm bitcode, and emcc generates wasm object files by default. |
Thanks @vargaz , I compiled the .o with
|
It doesn't complain about libWebGPU.bc anymore, so thats an improvement. |
Thanks again @vargaz , one of the two wasm-ld: error has desappeared. Any hint why the seccond still occur?
|
Which library defines that function ? |
Its the main.cpp (above) I used to compile the file libWebGPU.o |
The functions might need to be marked with |
I had a typo on main.cpp, the functions defined in it are correctly linked. However I imported webgpu.h functions using DllImport to try to draw a triangle and I'm having pinvoke errors on all them like
BTW I'm getting as well 14 warnings like below, but I think it is not related:
Thank you very much @vargaz for taking the time. |
No idea about that. The warnings are harmless. |
So after some digging latests pinvoke errors were solved by moving to emscripten 1.40.1. It seems that I needed this PR emscripten-core/emscripten#11737 for webgpu to work. Other errors have arised now, but I think they are unrelated so I'm closing this. thanks! |
Hi, I've been trying to compile a .net project with emscripten/webgpu with no success, as the linker seems to not found the function "emscripten_webgpu_get_device". I'm compiling webgpu from emscrpten as a .bc file, then using packager to link everything toguether. Same approach with webgl has worked in the past.
Steps to Reproduce
emcc include/emscripten.h include/emscripten/html5_webgpu.h include/emscripten/html5.h -std=c++17 -s LEGALIZE_JS_FFI=0 -r -o libWebGPU.bc -s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0
mono $HOME/mono/sdks/wasm/packager.exe --emscripten-sdkdir=$HOME/mono/sdks/builds/toolchains/emsdk --enable-fs --mono-sdkdir=$HOME/mono/sdks/out --appdir=$HOME/.build/bin --builddir=$HOME/.build/obj --template=$HOME/.build/publish/runtime.js --linker --link-descriptor=$HOME/.build/aot-link-descriptor.xml --pinvoke-libs=libWebGPU --native-lib=libWebGPU.bc HelloWebGPUNet.Web.dll
Current Behavior
Ninja log says that the function "emscripten_webgpu_get_device" is undefined
Expected Behavior
ninja build ends successfully.
On which platforms did you notice this
[ ] macOS
[x] Linux (WSL1)
[ ] Windows
Version Used:
commit 163f458 (HEAD -> master, origin/master, origin/HEAD)
Author: monojenkins jo.shields+jenkins@xamarin.com
Date: Wed Sep 16 11:24:16 2020 -0400
emcc (Emscripten gcc/clang-like replacement) 1.40.0 (634dfe9c7837119d3970c4145984b8f517e3e1ca)
The text was updated successfully, but these errors were encountered: