# Build  Slicer  Failed with   VTK9  Wrapper Error

**URL:** <https://discourse.slicer.org/t/build-slicer-failed-with-vtk9-wrapper-error/26953>\
**Category:** Development\
**Created:** [December 28, 2022, 5:25am UTC](https://discourse.slicer.org/t/build-slicer-failed-with-vtk9-wrapper-error/26953 "2022-12-28T05:25:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hanzhang\_DAI](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hanzhang_dai/32/17842_2.png) [@Hanzhang\_DAI](https://discourse.slicer.org/u/Hanzhang_DAI)\
**Post date:** [December 28, 2022, 5:25am UTC](https://discourse.slicer.org/t/build-slicer-failed-with-vtk9-wrapper-error/26953/1 "2022-12-28T05:25:20Z")

</div>

Build Command :

```auto
cmake.exe ^
  -G "Visual Studio 17 2022" ^
  -A x64 ^
  -DQt5_DIR:PATH=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5 ^
  -DBUILD_TESTING=OFF ^
  -DSlicer_USE_QtTesting=OFF ^
  -DSlicer_BUILD_DOCUMENTATION=OFF ^
C:\SD

```

and then

```auto
cmake.exe --build . --conifg Debug

```

```auto
 WrappingTools.vcxproj -> C:\SDR\VTK-build\bin\Debug\vtkWrappingTools-9.1d.dll
    WrapHierarchy.vcxproj -> C:\SDR\VTK-build\bin\Debug\vtkWrapHierarchy-9.1d.exe
    Generating the wrap hierarchy for VTK::CommonCore
    vtkWrapHierarchy-9.1d.exe: In C:/SDR/VTK/Common/Core/vtkArrayIteratorIncludes.h:44: syntax error.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5):
error MSB8066: “C:\SDR\VTK-build\CMakeFiles\1cfbdef9874d7fdc273814d48bd74a5b\vtkCommonCore-hierarchy.txt.rule;C:\SDR\VT
K-build\CMakeFiles\df4d66c3f6286a66ff3e7e6450b91535\vtkCommonCore-hierarchy.rule”的自定义生成已退出，代码为 1。 [C:\SDR\VTK-build\Com
mon\Core\vtkCommonCore-hierarchy.vcxproj] [C:\SDR\VTK.vcxproj]
    Interaction.vcxproj -> C:\SDR\VTK-build\bin\Debug\vtkInteraction-9.1d.dll
    ViewsCore-objects.vcxproj -> C:\SDR\VTK-build\Views\Core\ViewsCore-objects.dir\Debug\ViewsCore-objects.lib
    ViewsContext2D-objects.vcxproj -> C:\SDR\VTK-build\Views\Context2D\ViewsContext2D-objects.dir\Debug\ViewsContext2D-
  objects.lib
    sqlitebin.vcxproj -> C:\SDR\VTK-build\bin\Debug\sqlitebin-9.1d.exe
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5):
error MSB8066: “C:\SDR\CMakeFiles\0ca0d5233e679e5f621ec3684d706eb7\VTK-update.rule;C:\SDR\CMakeFiles\0ca0d5233e679e5f62
1ec3684d706eb7\VTK-patch.rule;C:\SDR\CMakeFiles\0ca0d5233e679e5f621ec3684d706eb7\VTK-configure.rule;C:\SDR\CMakeFiles\0
ca0d5233e679e5f621ec3684d706eb7\VTK-build.rule;C:\SDR\CMakeFiles\0ca0d5233e679e5f621ec3684d706eb7\VTK-create_egg_info.r
ule;C:\SDR\CMakeFiles\0ca0d5233e679e5f621ec3684d706eb7\VTK-install.rule;C:\SDR\CMakeFiles\9da03540a85529a975aa26e942872
eb0\VTK-complete.rule;C:\SDR\CMakeFiles\a93f313db68a08233b06795067f443c0\VTK.rule”的自定义生成已退出，代码为 1。 [C:\SDR\VTK.vcxproj]

```

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 28, 2022, 5:41am UTC](https://discourse.slicer.org/t/build-slicer-failed-with-vtk9-wrapper-error/26953/2 "2022-12-28T05:41:21Z")

</div>

To help understand the command and associated errors, I edited your text to use both backquotes \[1\] and `^` to split windows command.

Could you indicate which version of Slicer you are attempt to build ?

* * *

1. [Select the programming language used in code blocks - users - Discourse Meta](https://meta.discourse.org/t/select-the-programming-language-used-in-code-blocks/19247)

---

<div class="post-metadata">

**Author:** ![Hanzhang\_DAI](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hanzhang_dai/32/17842_2.png) [@Hanzhang\_DAI](https://discourse.slicer.org/u/Hanzhang_DAI)\
**Post date:** [December 28, 2022, 10:05am UTC](https://discourse.slicer.org/t/build-slicer-failed-with-vtk9-wrapper-error/26953/3 "2022-12-28T10:05:34Z")

</div>

Thank U . Slice Version is v5.2.1 . a builted vtk9.1 without python-wrapper in system environment variable path. is conflict with ?

---

<div class="post-metadata">

**Author:** ![Hanzhang\_DAI](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hanzhang_dai/32/17842_2.png) [@Hanzhang\_DAI](https://discourse.slicer.org/u/Hanzhang_DAI)\
**Post date:** [December 28, 2022, 10:06am UTC](https://discourse.slicer.org/t/build-slicer-failed-with-vtk9-wrapper-error/26953/4 "2022-12-28T10:06:49Z")

</div>

I run command with admin privileges.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 28, 2022, 1:46pm UTC](https://discourse.slicer.org/t/build-slicer-failed-with-vtk9-wrapper-error/26953/5 "2022-12-28T13:46:30Z")

</div>

> [@Hanzhang\_DAI](#):
>
> Slice Version is v5.2.1 . a builted vtk9.1 without python-wrapper in system environment variable path. is conflict with

If you have shared libraries in a folder that is in your system PATH environment variable then anything can happen, including build and/or runtime failure of any application. Therefore, the system PATH environment variable should be kept clean - there are several alternative ways to make utilities conveniently available, for example using [App Paths registry key](https://learn.microsoft.com/en-gb/windows/win32/shell/app-registration).

Confusing entries in the system PATH might have corrupted your build. So after removing all non-system paths from your PATH I would recommend to delete the entire Slicer build folder and restart the build from scratch. I would also recommend putting your build commands into a .bat file to allow (re)building Slicer anytime by a single click.
