The CMake build system for building the third part library - HDF5, does not work in cross-compile mode
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The build system for HDF5, executes compiled code that generates new source files which are then also built into the library. This fails in cross-compile mode if the target binaries cannot be executed on the host machine. (Interestingly, because of the use of redirection '>' the source files are still generated though they are empty. If 'make' is run again the build continues but this will result in linker errors later).
The culprit programs are:
- H5make_libsettings which generates H5lib_settings.c
- H5detect which generates H5Tinit.c
Following are the errors generated:
Scanning dependencies of target H5make_libsettings [ 65%] Building C object ThirdParty/hdf5/vtkhdf5/src/CMakeFiles/H5make_libsettings.dir/H5make_libsettings.c.o Linking C executable ../../../../bin/H5make_libsettings [ 65%] Built target H5make_libsettings [ 65%] Generating ../H5lib_settings.c /bin/sh: ../../../../bin/H5make_libsettings: cannot execute binary file make[2]: *** [ThirdParty/hdf5/vtkhdf5/H5lib_settings.c] Error 126 make[1]: *** [ThirdParty/hdf5/vtkhdf5/src/CMakeFiles/vtkhdf5.dir/all] Error 2 make: *** [all] Error 2
[ 16%] Generating ../H5Tinit.c /bin/sh: ../../../../bin/H5detect: cannot execute binary file make[2]: *** [ThirdParty/hdf5/vtkhdf5/H5Tinit.c] Error 126 make[1]: *** [ThirdParty/hdf5/vtkhdf5/src/CMakeFiles/vtkhdf5.dir/all] Error 2 make: *** [all] Error 2
A possible fix would be to do the system introspection and code generation through cmake facilities instead of relying on compiled code.
A workaround for this is to use the system provided version of the library where available.