# Build VTK 9.3 with MINGW, using CMake in Debug

**URL:** https://discourse.vtk.org/t/build-vtk-9-3-with-mingw-using-cmake-in-debug/16223
**Category:** Support
**Created:** [January 12, 2026, 3:19pm UTC](https://discourse.vtk.org/t/build-vtk-9-3-with-mingw-using-cmake-in-debug/16223 "2026-01-12T15:19:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Joaquin\_Opazo](https://discourse.vtk.org/user_avatar/discourse.vtk.org/joaquin_opazo/32/10239_2.png) [@Joaquin\_Opazo](https://discourse.vtk.org/u/Joaquin_Opazo)
#### Post date: [January 12, 2026, 3:19pm UTC](https://discourse.vtk.org/t/build-vtk-9-3-with-mingw-using-cmake-in-debug/16223/1 "2026-01-12T15:19:24Z")

</div>

Hi all!  
I had tried everything to build vtk 9.3 with MINGW and cmake.

I already tried the ‘-fcommon’ flag, the ‘-Wno,mbig’, ‘-O1’, ‘-O2’, ‘-Og’. And im still getting this error

`collect2.exe: error: ld returned 1 exit status`  
`mingw32-make.exe[2]: *** [Common\DataModel\CMakeFiles\CommonDataModel.dir\build.make:4547: bin/libvtkCommonDataModel-9.3d.dll] Error 1`  
`mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:4374: Common/DataModel/CMakeFiles/CommonDataModel.dir/all] Error 2`  
`mingw32-make.exe: *** [Makefile:135: all] Error 2`

I downloaded the 9.3 source, then create the vtk/build and vtk/install. Set the install, prefix, enable the group for QT.

Set the build folder with cmake-gui and run ‘cmake –build . -j4’. But i cannot make it run for Debug mode, the release is working perfectly.

Any suggestions, Please!  
Thanks  
Great 26 to all 🙂

---

<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: [January 12, 2026, 5:14pm UTC](https://discourse.vtk.org/t/build-vtk-9-3-with-mingw-using-cmake-in-debug/16223/2 "2026-01-12T17:14:20Z")

</div>

There is probably more error context above that `collect2` line with actual error content. I suspect more object files are bigger than 2GB and need the `-bigobj` flag.

---

<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: [January 12, 2026, 5:18pm UTC](https://discourse.vtk.org/t/build-vtk-9-3-with-mingw-using-cmake-in-debug/16223/3 "2026-01-12T17:18:15Z")

</div>

If it’s failing while linking `libvtkCommonDataModel-9.3d.dll` in Debug, the problem might just be that the dll is too big and mingw32/collect2 is running out of room. When it fails, try again with `-j1` and with more verbosity. Hopefully that will provide extra information.

```plaintext
VERBOSE=1 cmake --build . -j1

```

or

```plaintext
cmake --build . --verbose -j1

```

Edit: also watch your computer’s memory during the build, to see if it might be running out.

---

<div class="post-metadata">

### Author: ![Joaquin\_Opazo](https://discourse.vtk.org/user_avatar/discourse.vtk.org/joaquin_opazo/32/10239_2.png) [@Joaquin\_Opazo](https://discourse.vtk.org/u/Joaquin_Opazo)
#### Post date: [January 13, 2026, 8:14am UTC](https://discourse.vtk.org/t/build-vtk-9-3-with-mingw-using-cmake-in-debug/16223/4 "2026-01-13T08:14:11Z")

</div>

After many many tests, it finally finished. I dont know if it going to work but it worked for me with

```auto
cmake --build . -j8 --verbose

```

And the -fcommon, -O2 flag.

Thanks for your answers
