# Cross compile VTK with vcpkg for windows on linux (Ubuntu 20.04)

**URL:** https://discourse.vtk.org/t/cross-compile-vtk-with-vcpkg-for-windows-on-linux-ubuntu-20-04/13195
**Category:** Support
**Created:** [January 30, 2024, 9:38pm UTC](https://discourse.vtk.org/t/cross-compile-vtk-with-vcpkg-for-windows-on-linux-ubuntu-20-04/13195 "2024-01-30T21:38:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![alamin-research](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alamin-research/32/8379_2.png) [@alamin-research](https://discourse.vtk.org/u/alamin-research)
#### Post date: [January 30, 2024, 9:38pm UTC](https://discourse.vtk.org/t/cross-compile-vtk-with-vcpkg-for-windows-on-linux-ubuntu-20-04/13195/1 "2024-01-30T21:38:37Z")

</div>

I am trying to cross compile VTK through vcpkg on Ubuntu 20.04 for windows. I am using mingw through ubuntu repository as well as MXE. The compilation is failing due to hdf5 not able to successfully compile.

I am issuing the following command on vcpkg

`vcpkg install vtk:x64-mingw-dynamic`

How did you cross compile vtk considering hdf5?

---

<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: [February 7, 2024, 9:02pm UTC](https://discourse.vtk.org/t/cross-compile-vtk-with-vcpkg-for-windows-on-linux-ubuntu-20-04/13195/2 "2024-02-07T21:02:08Z")

</div>

Note that cross-compiling VTK requires compiling the host tools separately (see the `VTK_BUILD_COMPILE_TOOLS_ONLY` option). Other than that, it may involve hard-coding some `try_compile` results (HDF5 is one perennial culprit of `try_run` as well). You might be able to get away by setting [`CMAKE_CROSSCOMPILING_EMULATOR`](https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html) to `wine` so that compiled things can be run “natively”.
