Skip to content

Emitting TSD errors when exporting POINTER_SIZE #26589

@jeremy-code

Description

@jeremy-code

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 5.0.4 (62e2265)
clang version 23.0.0git (https:/github.com/llvm/llvm-project dcaab6dd99a33edbf98ad1ade0ea0d196b797910)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /emsdk/upstream/bin

Failing command line in full:

emcc \
  --emit-tsd "./helloworld.d.ts" \
  -sVERBOSE=1 \
  -sEXPORTED_RUNTIME_METHODS=POINTER_SIZE \
  -o "helloworld.js" \
  helloworld.cpp

...
adding $runtimeKeepaliveCounter (referenced by $keepRuntimeAlive, referenced by proc_exit, referenced by $exitJS, referenced by root reference (e.g. compiled C/C++ code))
adding $handleException (referenced by root reference (e.g. compiled C/C++ code))
adding $POINTER_SIZE (referenced by root reference (e.g. compiled C/C++ code))
Traceback (most recent call last):
  File "/emsdk/upstream/emscripten/emcc.py", line 587, in <module>
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/emsdk/upstream/emscripten/emcc.py", line 326, in main
    return link.run(options, linker_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/emsdk/upstream/emscripten/tools/link.py", line 3154, in run
    phase_post_link(options, wasm_target, wasm_target, target, js_syms, base_metadata)
  File "/usr/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/emsdk/upstream/emscripten/tools/link.py", line 1905, in phase_post_link
    phase_emit_tsd(options, wasm_target, js_target, js_syms, metadata)
  File "/usr/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/emsdk/upstream/emscripten/tools/link.py", line 2030, in phase_emit_tsd
    all_tsd = emscripten.create_tsd(metadata, embind_tsd)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/emsdk/upstream/emscripten/tools/emscripten.py", line 683, in create_tsd
    out += create_tsd_exported_runtime_methods(metadata)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/emsdk/upstream/emscripten/tools/emscripten.py", line 646, in create_tsd_exported_runtime_methods
    snippet = ' = ' + definition['snippet']
              ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "int") to str

Full output if necessary.

#include <iostream>
int main() {
  std::cout << "Hello World!" << std::endl;
  return 0;
}

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