# Issues building VTK with TK bindings

**URL:** https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506
**Category:** Support
**Created:** [June 10, 2020, 6:05am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506 "2020-06-10T06:05:32Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![johansh](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/b3f665/32.png) [@johansh](https://discourse.vtk.org/u/johansh)
#### Post date: [June 10, 2020, 6:05am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/1 "2020-06-10T06:05:32Z")

</div>

I have been trying for hours now to set up and build VTK with the TK integration without success. I’m still stuck on configuring Cmake with the following warnings and issues.

I’m building on Windows (10) with TDM-MinGW which detects fine. I have both tried to install IronTCL and to use conda tk but get the warnings and errors below. I believe the main issue is the error “target\_include\_directories called with incorrect number of arguments” which I think refers to the tcl/tk include paths. But I have no idea how to resolve it and would appreciate any help or ideas.

```
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (Tclsh) does
  not match the name of the calling package (TCL). This can lead to problems
  in calling code that expects `find_package` result variables (e.g.,
  `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.17/Modules/FindTclsh.cmake:95 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMake/FindTCL.cmake:35 (INCLUDE)
  Rendering/Tk/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

Found Tclsh: C:\Miniconda3\pkgs\tk-8.6.8-hfa6e2cd_0\Library\bin\tclsh.exe (found version "8.6")
Found TCL: C:\Miniconda3\pkgs\tk-8.6.8-hfa6e2cd_0\Library\lib
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (TCLTK) does
  not match the name of the calling package (TCL). This can lead to problems
  in calling code that expects `find_package` result variables (e.g.,
  `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  CMake/FindTCL.cmake:186 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  Rendering/Tk/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

Found TCLTK: C:\Miniconda3\pkgs\tk-8.6.8-hfa6e2cd_0\Library\lib
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (TK) does
  not match the name of the calling package (TCL). This can lead to problems
  in calling code that expects `find_package` result variables (e.g.,
  `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  CMake/FindTCL.cmake:189 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  Rendering/Tk/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

Found TK: C:\Miniconda3\pkgs\tk-8.6.8-hfa6e2cd_0\Library\lib
CMake Error at CMake/vtkModule.cmake:1398 (target_include_directories):
  target_include_directories called with incorrect number of arguments
Call Stack (most recent call first):
  Rendering/Tk/CMakeLists.txt:65 (vtk_module_include)

```

For completeness my cmake setup steps consists of:

```
- set CMAKE_BUILD_TYPE:RELEASE
- set VTK_PYTHON_VERSION:3
- run configure
- add VTK_Group_tk:BOOL=ON
- click on advanced
- set VTK_WRAP_PYTHON:BOOL=ON
- run configure
- set VTK_USE_TK:BOOL=ON
- run configure
- manually set TCL_INCLUDE_PATH, TCL_LIBRARY, TCL_TCLSH, TK_INCLUDE_PATH, TK_LIBRARY, TK_WISH
- run configure
```

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [June 10, 2020, 5:07pm UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/2 "2020-06-10T17:07:49Z")

</div>

It’s very possible that the Tcl/Tk autodetection machinery in VTK is out-of-date and has become broken, since very few people use it.

The error you see in Rendering/Tk/CMakeLists.txt has to do with this code block:

```auto
vtk_module_include(VTK::RenderingTk
  PRIVATE
    ${TCL_INCLUDE_PATH}
    ${TK_INCLUDE_PATH}
    ${TK_INTERNAL_PATH})

```

The error (incorrect number of arguments) suggests that these variables are not set in your CMakeCache.txt (possibly because the Tcl/Tk autodetection isn’t working). You can add them to your CMakeCache.txt manually and then re-run cmake to see if the error goes away. The TK\_INTERNAL\_PATH might not be necessary, as long as the other two variables are set.

Edit: I just tried using the vtkTkRenderWidget on my own Windows system, and the program exited as soon as the widget was created (no crash or error message, it just quit). So it’s possible that the vtkTkRenderWidget is currently only working on Linux. Hard to be certain, though, since my Windows system is a VM and it doesn’t provide the OpenGL capabilities required by VTK.

---

<div class="post-metadata">

### Author: ![johansh](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/b3f665/32.png) [@johansh](https://discourse.vtk.org/u/johansh)
#### Post date: [June 11, 2020, 2:46am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/3 "2020-06-11T02:46:52Z")

</div>

Thank you for taking the time and testing the TK bindings and looking in to this. I don’t think I understand Cmake because it seems to me I have the variables set, as my CMakeCache.txt does include:

```
...

//ADVANCED property for variable: TCL_INCLUDE_PATH
TCL_INCLUDE_PATH-ADVANCED:INTERNAL=1

...

//Path to a file.
TCL_INCLUDE_PATH:PATH=C:\Miniconda3\pkgs\tk-8.6.8-hfa6e2cd_0\Library\include

etc...

```

But maybe it wouldn’t work anymore anyway.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [June 11, 2020, 2:57am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/4 "2020-06-11T02:57:57Z")

</div>

That’s strange because after I set those variables, VTK configured and built without problems. But I’m not using miniconda, I’m using a Tcl and Tk that I build myself from source a couple years ago.

---

<div class="post-metadata">

### Author: ![King\_Bartlett](https://discourse.vtk.org/user_avatar/discourse.vtk.org/king_bartlett/32/3769_2.png) [@King\_Bartlett](https://discourse.vtk.org/u/King_Bartlett)
#### Post date: [August 10, 2021, 3:47am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/5 "2021-08-10T03:47:50Z")

</div>

Hello,I also meet the same question, I want to knonw that you solved it? Thank you !!

---

<div class="post-metadata">

### Author: ![King\_Bartlett](https://discourse.vtk.org/user_avatar/discourse.vtk.org/king_bartlett/32/3769_2.png) [@King\_Bartlett](https://discourse.vtk.org/u/King_Bartlett)
#### Post date: [August 10, 2021, 3:52am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/6 "2021-08-10T03:52:34Z")

</div>

hello, I noticed you have answered mang question about VTK binding Tkinter, I meet some questions,can you give me some help,thank you .

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [August 10, 2021, 4:13am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/7 "2021-08-10T04:13:36Z")

</div>

If you have some questions, then ask them, and I’ll do my best to answer.

Make sure to say what operating system you use, what version of VTK you are building, what version of Tk, and what you have tried so far.

VTK’s Tk interface is no longer tested and isn’t fully supported, so it isn’t guaranteed to work.

---

<div class="post-metadata">

### Author: ![King\_Bartlett](https://discourse.vtk.org/user_avatar/discourse.vtk.org/king_bartlett/32/3769_2.png) [@King\_Bartlett](https://discourse.vtk.org/u/King_Bartlett)
#### Post date: [August 10, 2021, 5:19am UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/8 "2021-08-10T05:19:02Z")

</div>

> [@johansh](#):
>
> ```auto
> CMake Error at CMake/vtkModule.cmake:1398 (target_include_directories):
> target_include_directories called with incorrect number of arguments
> Call Stack (most recent call first):
> Rendering/Tk/CMakeLists.txt:65 (vtk_module_include)
> 
> ```

CMake Error at CMake/vtkModule.cmake:1398 (target\_include\_directories): target\_include\_directories called with incorrect number of arguments Call Stack (most recent call first): Rendering/Tk/CMakeLists.txt:65 (vtk\_module\_include)  
This is my question, I used vtk9.0.3,tk8.5,windows system,I tried vtk 8.2,generating is successful,but Error compiling using VS.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [August 10, 2021, 1:31pm UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/9 "2021-08-10T13:31:56Z")

</div>

What are your CMakeCache.txt entries for TCL and TK?

`TCL_INCLUDE_PATH`, `TCL_LIBRARY`, `TK_INCLUDE_PATH`, `TK_INTERNAL_PATH`, `TK_LIBRARY`

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [August 10, 2021, 2:48pm UTC](https://discourse.vtk.org/t/issues-building-vtk-with-tk-bindings/3506/10 "2021-08-10T14:48:15Z")

</div>

I just did a Release build with vtk master to confirm it can be done. It should also work with vtk 9.0.3, because I’ve been using the same configuration for a long time. I used python 3.9.3 and Tcl/Tk 8.6.8.

I built Tcl and Tk from source, to match the Tcl/Tk used by Python. For example, in Python39\DLLs:

```nohighlight
 Directory of F:\Programs\Python39\DLLs
04/02/2021 11:59 AM 1,705,120 tcl86t.dll
04/02/2021 11:59 AM 1,468,064 tk86t.dll

```

So I built `tcl86t.lib` and `tk86t.lib`. I also built the debug libraries, just in case.

```nohighlight
 Directory of F:\Programs\Tcl86\lib
09/22/2018 07:42 AM 184,460 tcl86t.lib
09/22/2018 07:46 AM 185,372 tcl86tg.lib
09/22/2018 08:30 AM 124,930 tk86t.lib
09/22/2018 09:05 AM 125,560 tk86tg.lib

```

My CMakeCache.txt has the following:

```nohighlight
TCL_INCLUDE_PATH:PATH=F:/Programs/Tcl86/include
TCL_LIBRARY:FILEPATH=F:/Programs/Tcl86/lib/tcl86t.lib
TCL_TCLSH:FILEPATH=F:/Programs/Tcl86/bin/tclsh86t.exe
TK_INCLUDE_PATH:PATH=F:/Programs/Tcl86/include
TK_INTERNAL_PATH:PATH=F:/Source/tk8.6.8/win;F:/Source/tk8.6.8/generic
TK_LIBRARY:FILEPATH=F:/Programs/Tcl86/lib/tk86t.lib
TK_WISH:FILEPATH=F:/Programs/Tcl86/bin/wish86t.exe

```
