I’ve just tried building current VTK master + current ITK master then building my own app against them. The result is about 150 link errors, all along the lines of:
duplicate symbol _H5_libinit_g in:
/path/to/ITK/lib/libitkhdf5_debug.a(H5.c.o)
/path/to/VTK/lib/libvtkhdf5.a(H5.c.o)
duplicate symbol _H5_libterm_g in:
/path/to/ITK/lib/libitkhdf5_debug.a(H5.c.o)
/path/to/VTK/lib/libvtkhdf5.a(H5.c.o)
I checked a handful, and indeed they are in neither VTK’s nor ITK’s HDF mangling file. In addition, they all seem to be global variables (not functions).
This is on macOS, not sure if that matters.
If I run the command at the top of the ITK mangle file:
Doing it on the three platforms might not be enough for ALL purposes. Depending on exact compiler versions, CMake configuration, other build settings and defines, the resulting list of symbols will probably vary. Doing all these combinations is not practical, given that there are thousands of symbols in HDF5 and they somewhat change between versions.
But generating the list for mangling on three platforms and taking the union is an excellent first step Then make additional fixes as needed.
As I use Mac the least, I probably didn’t add its specific symbols to the mangling list.
I am really going to show my naivety on this: Why do we have to mangle the symbols? What does this guard against? I guess so that different libraries can compiled against different versions of HDF5?
If SomeApp™ already links against HDF5 (because it already uses it), then it wouldn’t be easy for that app to start using ITK because it’d get duplicate symbol link errors.