Building libVTK with MinGW64 or bcc64

Hello! I’m trying to compile vtk-8.2 (I need exactly 8.x) library with MinGW64 (x86_64-w64-mingw32-gcc toolchain). But I’m getting linker errors while building libvtksys (bunch of unresolved external errors).
My target purpose is to build DLL’s whose name mangling scheme would be compatible with bcc64 (bcc64 is based on Clang and ilink64 just refuses to link DLL’s built with MSVC).
If somebody here has an experience of building libVTK with MinGW or C++Builder, please help.

Could you post the errors you’re getting?

Note that MinGW is a “best effort” platform for VTK and not specifically supported (patches are accepted to support it, but it is not tested regularly by developers).

@jschueller may have seen something like this before.

Hi,

Undefined symbols have multiple causes. Can you please post some of the error messages? I’ve successfully built VTK 8.2 with MinGW64 before. Compiling VTK with MinGW64 is addressed in the manual of my project: gammaray/GammaRayManual.docx at master · PauloCarvalhoRJ/gammaray · GitHub (refer to Sections 2.4.6 and 2.4.7). Alternativelly, you can download precompiled VTK libraries with the MSYS2 environment. There, you can do a pacman -S mingw-w64-x86_64-vtk to get the VTK libraries compiled with MinGW64 (luckily, their latest version is 8.2.0-1). Usage of MSYS2 for dependency management (not only VTK) is covered by section 2.2 of that manual.

I hope this helps,

Paulo

It was my fault, I’ve specified gcc instead of g++ for CXX_COMPILER. But even MinGW produces libraries incompatible with bcc64 and ilink64 because of differences in name mangling (there are differences anyway). But vtk-8.2.0 refuses to compile with bcc64 (“target_compile_options not known for compiler Embarcadero” and “Cannot link to standard math library” (while compiling Eigen)

Please, don’t post only the part of the message that caught your attention. The primary cause is often much before in the messages log. Please, post the part of the log that contains the first error. Also, don’t post edited messages. It is important for others to have any error codes as well. Simply post the entire messages as they appear on screen. I know the intention is to help people by posting minimal messages, but important details are likely being left out.

Mixing proprocessors, compilers, linkers, assemblers, etc. from different toolchains (even different versions of the same brand) is certainly not advised. Also, linking libraries compiled with toolchain A against an executable compiled with toolchain B often doesn’t work.

Do you have an existing BCC project with which you want to use VTK or are you trying to produce a BPL?

If BCC links with CLang binaries why don’t you just build VTK with CLang?

@toddy , @Paulo_Carvalho , @ben.boeckel
Now I get this error while building vtkRenderingOpenGL2-8.2.dll

Please, enable the necessay options (verbose?) in BCC so we can see the linker commands being issued. bcc64.exe is the compiler which is likely calling the linker but its commands do not appear in the capture.

Also, I suggest you to copy and paste the enitire text instead of capturing the screen. Lots of important information can be missing in off screen parts. Redirecting the output to a text file and then pasting it here would also be better.

@Paulo_Carvalho thank you. But I solved the problem (defined missing class constructors manually, because they weren’t autogenerated with bcc64). Finally I succeeded in building libVTK with Embarcadero toolchain. If you wish I could shortly describe building process here…

1 Like

Documenting the solution would be useful for anyone coming across this thread in the future!

1 Like