# building VTK for webAssembly,ninja: build stopped: subcommand failed

**URL:** https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876
**Category:** vtk.wasm
**Created:** [May 14, 2024, 2:23am UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876 "2024-05-14T02:23:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![zfzlzh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zfzlzh/32/8540_2.png) [@zfzlzh](https://discourse.vtk.org/u/zfzlzh)
#### Post date: [May 14, 2024, 2:23am UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876/1 "2024-05-14T02:23:09Z")

</div>

i follow the guide ’ Building using emscripten for WebAssembly’ to build VTK-wasm,  
but when i use ninja compile ,error occurs:  
**ninja: build stopped: subcommand failed**

and this is the full info:

```auto
[1/1027] Generating proj.db
FAILED: share/vtk-9.3/proj/proj.db E:/vtk-wasm-new/share/vtk-9.3/proj/proj.db
C:\Windows\system32\cmd.exe /C "cd /D E:\github\VTK-master\ThirdParty\libproj\vtklibproj\data && "C:\Program Files\CMake\bin\cmake.exe" -E remove -f E:/vtk-wasm-new/lib/../share/vtk-9.3/proj/proj.db && "C:\Program Files\CMake\bin\cmake.exe" -DCMAKE_SYSTEM_NAME=Emscripten -DCMAKE_CROSSCOMPILING_EMULATOR=E:/github/emsdk/emsdk/node/16.20.0_64bit/bin/node.exe -DALL_SQL_IN=E:/vtk-wasm-new/ThirdParty/libproj/vtklibproj/data/all.sql.in -DEXE_SQLITE3=E:/vtk-wasm-new/bin/sqlitebin-9.3.js -DPROJ_DB=E:/vtk-wasm-new/lib/../share/vtk-9.3/proj/proj.db -DPROJ_VERSION=8.1.0 -P E:/github/VTK-master/ThirdParty/libproj/vtklibproj/data/generate_proj_db.cmake && "C:\Program Files\CMake\bin\cmake.exe" -E copy E:/vtk-wasm-new/lib/../share/vtk-9.3/proj/proj.db E:/vtk-wasm-new/ThirdParty/libproj/vtklibproj/data/for_tests"
'E:/github/emsdk/emsdk/node/16.20.0_64bit/bin/node.exe' 'E:/vtk-wasm-new/bin/sqlitebin-9.3.js' '-init' 'E:/vtk-wasm-new/ThirdParty/libproj/vtklibproj/data/all.sql.in' 'E:/vtk-wasm-new/lib/../share/vtk-9.3/proj/proj.db'
-- Loading resources from E:/vtk-wasm-new/ThirdParty/libproj/vtklibproj/data/all.sql.in
Error: unable to open database "E:/vtk-wasm-new/lib/../share/vtk-9.3/proj/proj.db": unable to open database file
CMake Error at generate_proj_db.cmake:29 (message):
  SQLite3 failed

[2/1027] Building CXX object ThirdParty/libproj/vtklibproj/src/CMakeFiles/libproj.dir/iso19111/operation/esriparammappings.cpp.o
[3/1027] Building CXX object ThirdParty/libproj/vtklibproj/src/CMakeFiles/libproj.dir/iso19111/operation/parammappings.cpp.o
[4/1027] Building CXX object ThirdParty/libproj/vtklibproj/src/CMakeFiles/libproj.dir/iso19111/operation/projbasedoperation.cpp.o
[5/1027] Building CXX object ThirdParty/libproj/vtklibproj/src/CMakeFiles/libproj.dir/iso19111/operation/oputils.cpp.o
[6/1027] Building CXX object ThirdParty/libproj/vtklibproj/src/CMakeFiles/libproj.dir/iso19111/operation/singleoperation.cpp.o
ninja: build stopped: subcommand failed.

```

Here’s how I do it:  
1.downlaod ‘Emscripten SDK’ and install as instructed in the guide,enter ‘embuilder build sdl2’

2.download ‘cmake’ and install it

3.download ‘VTK-master’ from github,the version is 9.3.0

4.create a folder named ‘vtk-wasm-new’,and open git bash in this folder,enter these instructions

```auto
emcmake cmake   
-S ../github/VTK-Master   
-B .   
-G "Ninja"  
-DCMAKE_BUILD_TYPE=Release   
-DBUILD_SHARED_LIBS:BOOL=OFF   
-DVTK_ENABLE_LOGGING:BOOL=OFF   
-DVTK_ENABLE_WRAPPING:BOOL=OFF   
-DVTK_MODULE_ENABLE_VTK_RenderingLICOpenGL2:STRING=DONT_WANT

```

5.enter ‘ninja’ and waiting for end,but throw error

what should i do ? please help me,thank you.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 14, 2024, 10:00pm UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876/2 "2024-05-14T22:00:03Z")

</div>

Hello,

> [@zfzlzh](#):
>
> 4.create a folder named ‘vtk-wasm-new’,and open git base in this folder,enter these instructions

What do you mean by “open git base in this folder”?

best,

PC

---

<div class="post-metadata">

### Author: ![zfzlzh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zfzlzh/32/8540_2.png) [@zfzlzh](https://discourse.vtk.org/u/zfzlzh)
#### Post date: [May 15, 2024, 1:08am UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876/3 "2024-05-15T01:08:17Z")

</div>

oh，I’ve made a typo，it’s git bash

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 15, 2024, 5:56pm UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876/4 "2024-05-15T17:56:30Z")

</div>

I’d advise against building from the GitHub sources. These are supposed to be used by VTK developers. I recommend downloading the sources from here: [Download | VTK](https://vtk.org/download/), which are packed for end users.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [May 15, 2024, 7:55pm UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876/5 "2024-05-15T19:55:16Z")

</div>

> CMake Error at generate\_proj\_db.cmake:29 (message):  
> SQLite3 failed

When targeting wasm on windows, use `-DVTK_MODULE_ENABLE_VTK_libproj=NO` with cmake.

> [@Paulo\_Carvalho](#):
>
> I’d advise against building from the GitHub sources. These are supposed to be used by VTK developers. I recommend downloading the sources from here: [Download | VTK](https://vtk.org/download/), which are packed for end users.

wasm sdk is not distributed in that link. We do however publish them in docker hub at [kitware/vtk-wasm-sdk](https://hub.docker.com/r/kitware/vtk-wasm-sdk). Eventually, [Download | VTK](http://vtk.org/download) should include a link to the docker image and/or tarball of the vtk-wasm-sdk install tree.

---

<div class="post-metadata">

### Author: ![zfzlzh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zfzlzh/32/8540_2.png) [@zfzlzh](https://discourse.vtk.org/u/zfzlzh)
#### Post date: [May 16, 2024, 2:51am UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876/6 "2024-05-16T02:51:37Z")

</div>

thanks,this problem is solved，and if i want use vtk.wasm in javascript,what should I do next?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [May 16, 2024, 12:15pm UTC](https://discourse.vtk.org/t/building-vtk-for-webassembly-ninja-build-stopped-subcommand-failed/13876/7 "2024-05-16T12:15:17Z")

</div>

> thanks,this problem is solved

great!

> if i want use vtk.wasm in javascript,what should I do next?

Depends. We see people generally take one of two paths.

1. Wrap only the VTK classes you intend to use for JavaScript using [Embind — Emscripten 3.1.60-git (dev) documentation](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html)

2. Create a C++ library which wraps over VTK objects and doesn’t expose them to JavaScript. You will limit the C++ API to only accept and return ints/floats/strings and/or maps/vectors of those data types.
