# itk-wasm wasi build for c++ program

**URL:** <https://discourse.itk.org/t/itk-wasm-wasi-build-for-c-program/5153>\
**Category:** Beginner Questions\
**Created:** [July 3, 2022, 8:09pm UTC](https://discourse.itk.org/t/itk-wasm-wasi-build-for-c-program/5153 "2022-07-03T20:09:35Z")\
**Posts on this page:** 4\
**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:** [July 3, 2022, 8:09pm UTC](https://discourse.itk.org/t/itk-wasm-wasi-build-for-c-program/5153/1 "2022-07-03T20:09:35Z")

</div>

@matt.mccormick , @dzenanz ,

Hi,

I need help to link hdf5 libraries of ITK-5.2.1/ITK-5.3 to a itk-wasm/wasi build. It seems to complain about hdf5 libraries.

1. the c++ code: include \<itkImageFileReader.h\> causes the fdh5 link error. seems cannot find relevant libraries. please refer to cmake file and you will see i have do my bes to link those libraries into the HelloWorld final executable project.

 ![wasi-build-itkImageFileReader-dependency3](https://discourse.itk.org/uploads/default/original/2X/7/75d4d569308f96f4444b4173e24f1f06e5f9328a.png)

1. the below picture is result of build command using itk-wasm for wasi build!  

2. is the cmake file for the c++ program build.  

3. this is the list of file and folder in the PROJECT\_SOURCE\_DIR. I copied ITK/include & ITK/lib OF THE BUILD ITK TOOLKIT INTO MY PROJECT. THUS , you would understand the CMake file. still i am getting weird build failure like itk-wasm/itkwasi does not understand thecmake file how to build this.  
Note: when i remove \<itkImageFileReader.h\> header with the c++ program everything compiles just fine because HDF5 libriaris not linked into the final HelloWorld project.!?  

node -v : v18.4.0  
npm -v : 8.12.1

what is it that i am doing wrong. Any help appreciate

regards,  
@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:** [August 22, 2022, 9:31pm UTC](https://discourse.itk.org/t/itk-wasm-wasi-build-for-c-program/5153/2 "2022-08-22T21:31:05Z")

</div>

Hi @sag,

The CMake configuration code should only need,

```auto
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

[...]

target_link_libraries(${PROJECT_NAME} ${ITK_LIBRARIES})

```

However, when reading an image with itk-wasm, you want to use `itk::wasm::Pipeline` and `itk::wasm::InputImage`. Please review this example that provides more documentation:

> <https://github.com/InsightSoftwareConsortium/itk-wasm/pull/615>

---

<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:** [August 26, 2022, 1:58pm UTC](https://discourse.itk.org/t/itk-wasm-wasi-build-for-c-program/5153/3 "2022-08-26T13:58:36Z")

</div>

@matt.mccormick, @dzenanz  
Hi,

Thank you matt i just could try both wasi and wasm project for hellopipeline and MedianImageFilter. Both worked like a charm. I also checked out new commitments in ITK-WASM and it is very useful and nice.  
@matt.mccormick & @dzenanz appreciate the effort. I am wondering do you have any links for articles or docs that can help me to understand pipeline mechanism in both wasi and node.js.

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:** [August 26, 2022, 5:44pm UTC](https://discourse.itk.org/t/itk-wasm-wasi-build-for-c-program/5153/4 "2022-08-26T17:44:10Z")

</div>

@sag great to hear, thanks for testing!

There is not yet [a journal article](https://github.com/InsightSoftwareConsortium/itk-wasm/issues/623), but we are working towards it.
