Build VTK 9.3 with MINGW, using CMake in Debug

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 :slight_smile:

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.

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.

VERBOSE=1 cmake --build . -j1

or

cmake --build . --verbose -j1

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

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

cmake --build . -j8 --verbose

And the -fcommon, -O2 flag.

Thanks for your answers