Dear VTK Users and Developers,
My apologies if this is not the right place to report this issue, I’d be happy to move the subject in another forum if needed.
I have spent now two days trying to compile VTK from source as I need to switch from GCC 8 to GCC 11.2, and I am getting all sorts of weird things going on.
I have downloaded the source from the VTK website (https://vtk.org/download/, VTK-9.1.0.tar.gz). I have CMake 3.17.3, Windows 10 and I use the MinGW64 distribution to compile the source (with GCC 11.2).
GCC 11.2 has been obtained from WinLibs MinGW (GitHub - brechtsanders/winlibs_mingw: winlibs standalone build of GCC compiler and MinGW-w64, filename “winlibs-x86_64-posix-seh-gcc-11.2.0-llvm-13.0.0-mingw-w64ucrt-9.0.0-r2.7z”) - and to me it looks like a standard MinGW64 distribution - but I’d love to be proven wrong of course.
I also need to compile with Python support and - although I am still on Python 2.7 for legacy reasons - this is not the problem here. I had compiled VTK 9.0.0 a few weeks ago with GCC 8 and I had no problems whatsoever. And the error I am getting does not seem to be related to wrapping Python or not.
It takes quite some time to rebuild VTK - I can’t really use the parallel builds as I am not sure whether the errors the compiler gives are going to be easy to spot, so I re-run (once again) a serial build. Please bear in mind that I deleted the cache in CMake, removed the build folder, cleaned everything multiple times and restarted the whole thing again and again.
Everything works fine until about 34% of the build, where I start getting a bunch of warnings related to libtiff:
C:\Users\USER\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\vtk_tiff_mangle.h:5:28: warning: array 'vtktiff__TIFFBuiltinCODECS' assumed to have one element
5 | #define _TIFFBuiltinCODECS vtktiff__TIFFBuiltinCODECS
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\USER\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\tiffiop.h:434:32: note: in expansion of macro '_TIFFBuiltinCODECS'
434 | vtktiff_EXPORT const TIFFCodec _TIFFBuiltinCODECS[];
| ^~~~~~~~~~~~~~~~~~
In file included from C:\Users\J0514162\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\tiff.h:28,
from C:\Users\J0514162\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\tiffio.h:31,
from C:\Users\J0514162\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\tiffiop.h:49,
from C:\Users\J0514162\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\tif_zstd.c:25:
C:\Users\USER\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\vtk_tiff_mangle.h:5:28: warning: array 'vtktiff__TIFFBuiltinCODECS' assumed to have one element
And so on, until the build breaks with the error I am attaching (summary: collect2.exe: error: ld returned 1 exit status).
I am by no means an expert in compiler flags or compilation stuff, on the contrary, so I am completely lost. Could someone please point me in a possible direction on how to investigate this issue - and potentially solve it?
I will appreciate any suggestion you may have, and I thank you very much in advance for your help.
Andrea.
Compiler Error (start and end only)
C:\Users\USER\Downloads\VTK-9.1.0\ThirdParty\tiff\vtktiff\libtiff\tiffiop.h:434:32: note: in expansion of macro '_TIFFBuiltinCODECS'
434 | vtktiff_EXPORT const TIFFCodec _TIFFBuiltinCODECS[];
| ^~~~~~~~~~~~~~~~~~
c:/users/USER/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\tiff.dir/objects.a(tif_close.c.obj):tif_close.c:(.rdata+0x10): multiple definition of `vtktiff__TIFFBuiltinCODECS'; CMakeFiles\tiff.dir/objects.a(tif_aux.c.obj):tif_aux.c:(.rdata+0x270): first defined here
c:/users/USER/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\tiff.dir/objects.a(tif_close.c.obj):tif_close.c:(.bss+0x0): multiple definition of `vtktiff__TIFFerrorHandlerExt'; CMakeFiles\tiff.dir/objects.a(tif_aux.c.obj):tif_aux.c:(.bss+0x0): first defined here
... many more similar lines ...
collect2.exe: error: ld returned 1 exit status
make[2]: *** [ThirdParty\tiff\vtktiff\libtiff\CMakeFiles\tiff.dir\build.make:768: bin/libvtktiff-9.1.dll] Error 1
make[1]: *** [CMakeFiles\Makefile2:11985: ThirdParty/tiff/vtktiff/libtiff/CMakeFiles/tiff.dir/all] Error 2
make: *** [makefile:152: all] Error 2
vtk9.1.0_error.txt (64.5 KB)