# How can we avoid removing all VTK directories when updating slicer

**URL:** <https://discourse.slicer.org/t/how-can-we-avoid-removing-all-vtk-directories-when-updating-slicer/1840>\
**Category:** Development\
**Tags:** build\
**Created:** [January 15, 2018, 2:08am UTC](https://discourse.slicer.org/t/how-can-we-avoid-removing-all-vtk-directories-when-updating-slicer/1840 "2018-01-15T02:08:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [January 15, 2018, 2:08am UTC](https://discourse.slicer.org/t/how-can-we-avoid-removing-all-vtk-directories-when-updating-slicer/1840/1 "2018-01-15T02:08:31Z")

</div>

(@chir.set asked the following in [Commit 69e26835e would burn my discrete GPU!](https://discourse.slicer.org/t/commit-69e26835e-would-burn-my-discrete-gpu/1839))

> Secondly, I need your advice for another issue.
> 
> Every time I run 'git checkout ', I must remove completely VTKv9{,-build,-prefix} directories to have a successful build. Else, there are errors like :
> 
> make[5]: \*\*\* No rule to make target ‘/home/arc/src/Slicer-SuperBuild/VTKv9/Common/Core/vtkAngularPeriodicDataArray.h’, needed by ‘Wrapping/Python/vtkAngularPeriodicDataArrayPython.cxx’. Stop.
> 
> Here, it’s vtkAngularPeriodicDataArray.h, but it can be any other file in a similar complaint.
> 
> How can we avoid removing all VTK directories whenever we checkout a commit ? It’s quite a big download. Even if I unpack a saved VTKv9 directory from a previously failed build, its contents get cleared and pulled from git again.
> 
> Thank you.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [January 15, 2018, 2:20am UTC](https://discourse.slicer.org/t/how-can-we-avoid-removing-all-vtk-directories-when-updating-slicer/1840/2 "2018-01-15T02:20:28Z")

</div>

It should never be necessary to delete the VTKv9 git directory, – in the off chance the source git directory is left in a transient state by the build system, you can run a hard git reset to clean it up and avoid re-downloading that.

However, rebuilds are also time-consuming… The -build or -prefix directories should almost never need to be deleted. However, the error you listed could be caused by an out-of-sync superbuild after major changes, so if it happens again, try re-running cmake in the superbuild directory (one level above `Slicer-build`) – `cmake .` should do the trick at command line, or click `Generate` in the GUi.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [January 15, 2018, 8:46am UTC](https://discourse.slicer.org/t/how-can-we-avoid-removing-all-vtk-directories-when-updating-slicer/1840/3 "2018-01-15T08:46:06Z")

</div>

> [@ihnorton](#):
>
> you can run a hard git reset to clean it up and avoid re-downloading that

That did the trick, thanks.
