Skip to content

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

Closed
@wojdyr

Description

@wojdyr

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions