# itk-wasm toolchain c++ debug symbols

**URL:** <https://discourse.itk.org/t/itk-wasm-toolchain-c-debug-symbols/5945>\
**Category:** Engineering\
**Tags:** itk-wasm\
**Created:** [May 15, 2023, 10:12am UTC](https://discourse.itk.org/t/itk-wasm-toolchain-c-debug-symbols/5945 "2023-05-15T10:12:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sag](https://discourse.itk.org/user_avatar/discourse.itk.org/sag/32/2041_2.png) [@sag](https://discourse.itk.org/u/sag)\
**Post date:** [May 15, 2023, 10:12am UTC](https://discourse.itk.org/t/itk-wasm-toolchain-c-debug-symbols/5945/1 "2023-05-15T10:12:23Z")

</div>

Hi everyone

I have a simple question about itk-wasm. Have anybody managed to build debug version of itk example into c++ using itk-wasm toolchain for both wasi/emscripten/browser?

My ecosystem is as follows:

1. Node.js v19.xx
2. npm v9.6.x
3. WSL2/UBUNTU 22.04 (Docker 4.17.x)
4. itk-wasm@1.0.0-b.94
5. itk-image-io@1.0.0-b.94

It seems that I am unable to generate debugging c++ symbols using itk-wasm. I have looked at the itkwasm/emscripten-base:latest-debug, what does not make sense is that I see ARG CMAKE\_BUILD\_TYPE=Release in Dockerfile,( inside the TAG tab )? why in a debug version of the itkwasm/emscripten debug you need Release??  
furthermore, in next lines I spotted ARG CMAKE\_BUILD\_TYPE=Debug ??  
besides the only option Dockerfile has is -s ALLOW\_MEMORY\_GROWTH and I don’t see how other options missing. One needs to do some changes like minimum memory for wasm, max memory, -s WASM=1, -s export methods,and so forth,  
can I add those in the command line as I use itk-wasm or inside the CMakeLists.txt file? like below  
`itk-wasm -b dir itkwasm/emscripten:latest-debug -s WASM=1 -o some.html, -g -fdebug-compilation-dir='..'` , IS IT POSSIBLE TO DO THAT?

I want to export functions from final wasm file and use it for passing some arguments or do something with it? I cannot seem to have any way to do that from command line. `it think that the reason itk-wasm does not generate c++ symbolic under DWARF support enabled could be missing options`, any ideas welcomed specially from staff who wrote the Dockerfile to build itk into the itk-wasm.

I built a c++ program without itk-wasm toolchain using emcc/em++ and it worked, I could step into c++ code in the devtools and it was okay. what is it I am doing wrong, I followed all the instruction @matt.mccormick in Debugging tutorial and still I am not able to step into c++ code, most of the time c++ code is not found in devtools even though I setup path substitution according to the instructions provided in tutorials. Please acknowledge I could have complete debugging experience using emcc/em++ with proper options to generate `.html, .js, .wasm` file in the build directory.

`the following is how I build debug version of emscripten build for my itk application, any example you pick:`  
`itk-wasm -I itkwasm/emscripten:latest-debug --build-dir emscripten-build-debug build -- -DCMAKE_BUILD_TYPE=Debug`

`I am not sure if I want to use emcc/em++ so I could get every ITK dependencies right and consequently build the my version of itk-wasm?`

I already appreciate you help

BR  
@sag

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [July 27, 2023, 9:19pm UTC](https://discourse.itk.org/t/itk-wasm-toolchain-c-debug-symbols/5945/2 "2023-07-27T21:19:17Z")

</div>

Hi @sag,

To confirm,

> generate c++ symbolic under DWARF support enabled could be missing options

The `-debug` Docker images do contain ITK builds with debugging symbols.

> itk-wasm -I itkwasm/emscripten:latest-debug --build-dir emscripten-build-debug build – -DCMAKE\_BUILD\_TYPE=Debug

Yes, adding `-DCMAKE_BUILD_TYPE=Debug` will also include debug versions in your generated wasm binary.

This is necessary to get the debugging experience in Chromium [as documented in the debugging tutorial](https://wasm.itk.org/tutorial/debugging?id=chromium-based-browsers). Very recent versions of Chromium enabled the debugging support by default in DevTools, but I believe you still need to install and configure the associated extension.
