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

--embind-emit-tsd may cause "ReferenceError: assert is not defined" #21641

Open
wojdyr opened this issue Mar 28, 2024 · 0 comments · May be fixed by #21695
Open

--embind-emit-tsd may cause "ReferenceError: assert is not defined" #21641

wojdyr opened this issue Mar 28, 2024 · 0 comments · May be fixed by #21695
Assignees

Comments

@wojdyr
Copy link
Contributor

wojdyr commented Mar 28, 2024

With some options, generating d.ts causes ReferenceError: assert is not defined.

I see that embind_gen.js doesn't wrap assert() in #if ASSERTIONS / #endif.
If it's meant to work only with assertions enabled, it's OK, but a message telling the user to change the options would be helpful, because it took me some time to understand what the error is about.

Thanks for working on this useful tool.

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.56 (cf90417)
clang version 19.0.0git (https:/github.com/llvm/llvm-project 34ba90745fa55777436a2429a51a3799c83c6d4c)

Failing command line in full:

$ em++ -O3 -s STRICT=1 --no-entry test.cpp -o test.js -lembind --embind-emit-tsd test.d.ts
/tmp/emscripten_temp_le1gbuxu/tsgen_a.out.js:121
      throw ex;
      ^

ReferenceError: assert is not defined
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.

2 participants