# Problem building VTK

**URL:** https://discourse.vtk.org/t/problem-building-vtk/6197
**Category:** Support
**Created:** [July 15, 2021, 1:58pm UTC](https://discourse.vtk.org/t/problem-building-vtk/6197 "2021-07-15T13:58:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![GeorgeS](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/bcef8e/32.png) [@GeorgeS](https://discourse.vtk.org/u/GeorgeS)
#### Post date: [July 15, 2021, 1:58pm UTC](https://discourse.vtk.org/t/problem-building-vtk/6197/1 "2021-07-15T13:58:11Z")

</div>

I’ve been happily developing large projects for VTK and ITK for years, but I am not a CMake expert.

I just switched to a new Mac Powerbook with the M1 chip, and I’m getting errors running CMake on VTK

I’ve updated to the latest  
Cmake-3.21.0  
VTK 9.0.3  
Xcode 12.5 (with the Command Line Tools for Xcode 12.5 installed)

CMake configures successfully, but the Generate yields the error statement below. Any help would be appreciated.

* * *

## CMake Error in ThirdParty/zlib/vtkzlib/CMakeLists.txt: The custom command generating /Users/Stetten/ITK\_VTK\_FLTK/VTK-9.0.0\_build/ThirdParty/hdf5/vtkhdf5/H5Tinit.c is attached to multiple targets: vtkhdf5\_src gen\_hdf5 but none of these is a common dependency of the other(s). This is not allowed by the Xcode “new build system”.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 15, 2021, 3:07pm UTC](https://discourse.vtk.org/t/problem-building-vtk/6197/2 "2021-07-15T15:07:15Z")

</div>

The Xcode generator is not well-tested by VTK. I would recommend using the Ninja generator instead for now.

---

<div class="post-metadata">

### Author: ![GeorgeS](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/bcef8e/32.png) [@GeorgeS](https://discourse.vtk.org/u/GeorgeS)
#### Post date: [July 16, 2021, 1:04am UTC](https://discourse.vtk.org/t/problem-building-vtk/6197/3 "2021-07-16T01:04:20Z")

</div>

Thanks for the tip. I have been using Xcode successfully with CMake/ITK/VTK for years, and would hate to have to switch to a whole new IDE. It seems strange that CMake would not support Xcode, which seems like one of the major environments out there. Perhaps I’m not understanding what exactly an IDE is vs. the actual compiler inside? I have read that Xcode uses Clang internally. Is there some way i can still use Xcode as the IDE by switching which compiler is used?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 16, 2021, 10:06am UTC](https://discourse.vtk.org/t/problem-building-vtk/6197/4 "2021-07-16T10:06:09Z")

</div>

We test with the Xcode _compilers_ all the time. What is not well-tested is the Xcode _generator_. CMake supports both just fine, but Xcode is a “multi-config generator” and it’s just not something that I’ve put a lot of time into making sure works as well as it can when building VTK due to a lack of time and it being a lower priority thing (AFAIK, very few VTK developers use these generators). I think most of the VTK module system should be OK with multi-config generators, but there are always corner cases (probably in the wrapping support logic). So it’s not so much out of interest, just a lack of resources to make it work well.

---

<div class="post-metadata">

### Author: ![GeorgeS](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/bcef8e/32.png) [@GeorgeS](https://discourse.vtk.org/u/GeorgeS)
#### Post date: [July 16, 2021, 12:31pm UTC](https://discourse.vtk.org/t/problem-building-vtk/6197/5 "2021-07-16T12:31:47Z")

</div>

Thanks so much for your comments. They helped… I used the “Unix Makefile” option in CMake and successfully compiled VTK and ITK (with the “Module\_ITKVtkGlue” option, to tie the two libraries together) using good old fashioned “make -f Makefile”. Then I tried using the “Xcode” option in CMake to generate a project for my own code (which uses the ITK an VTK libraries and worked in the past) but it returns the error below.  
…

The C compiler identification is AppleClang 12.0.5.12050022  
The CXX compiler identification is AppleClang 12.0.5.12050022  
CMake Error at CMakeLists.txt:22 (project):  
No CMAKE\_C\_COMPILER could be found.

CMake Error at CMakeLists.txt:22 (project):  
No CMAKE\_CXX\_COMPILER could be found.

---

<div class="post-metadata">

### Author: ![GeorgeS](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/bcef8e/32.png) [@GeorgeS](https://discourse.vtk.org/u/GeorgeS)
#### Post date: [July 16, 2021, 4:12pm UTC](https://discourse.vtk.org/t/problem-building-vtk/6197/6 "2021-07-16T16:12:27Z")

</div>

I seem to have found the problem.  
After installing “Command Line Tools for Xcode 12.5” I needed to remove and reinstall CMake. CMake can now find the C and C++ compilers.

Thanks again for your help.

---

<div class="post-metadata">

### Author: ![GeorgeS](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/bcef8e/32.png) [@GeorgeS](https://discourse.vtk.org/u/GeorgeS)
#### Post date: [July 16, 2021, 7:14pm UTC](https://discourse.vtk.org/t/problem-building-vtk/6197/7 "2021-07-16T19:14:36Z")

</div>

One more discovery… I did finally get VTK-9.0.3 to configure and generate with Xcode (and then compile) by putting “buildsystem=1” into the -T window in CMake, see  
[[When trying to generate an Xcode project from a cmake folder, I get an error related to Xcode new build system. Any possible solution? - Stack Overflow](https://stackoverflow.com/questions/65473503/when-trying-to-generate-an-xcode-project-from-a-cmake-folder-i-get-an-error-rel)]
