macOS ARM64 configure error

Hi,

I am currently compiling VTK on its release branch for a project on github and I’m testing ARM64 build. The build is made on an intel mac (github actions slave) and I tested two things : setting osx architectures in cmake either to “x86_64;arm64” or “arm64”.

And here comes the problem : while it works smoothly with the first option, the cmake configure fails on hdf5 with the second option. You might check the full log here (hope you have access) : Merge pull request #92 from Inria-Empenn/stanisz-sum-truncation · Inria-Empenn/Anima-Public@517dbaf · GitHub

Otherwise the error is the following :
– Check size of __float128
– Check size of __float128 - failed
– Check size of _Quad
– Check size of _Quad - failed
CMake Error at ThirdParty/hdf5/vtkhdf5/config/cmake/ConfigureChecks.cmake:367 (list):
list index: 1 out of range (-1, 0)
Call Stack (most recent call first):
ThirdParty/hdf5/vtkhdf5/CMakeLists.txt:503 (include)

Would anyone have any idea what happens here and if there is something that could be done / a bug correction may be ?

Thanks

As a note, this is a problem with HDF5’s environment detection strategies. It does try_run kind of things to extract out information from the environment. But I guess you’re cross compiling here and not actually on an arm64 machine. I’m actually rather surprised that the former worked and the latter did not (though maybe you’re on an x86_64 host which masks the arm64 problem). This kind of gathering is completely broken for cross-compilation (you can’t generally run the binary) and multi-arch builds because running it only answers the question for one of the targets.

The take away here is that you basically cannot cross compile HDF5 due to their detection system. I went through this back in the PPC → Intel transition and I basically had to compile our software on 2 different machines for a while.

This is what you CAN do:

On intel x86_64 you can comple x86_64 code. Period. Hard Stop.

On ARM64 you can separately compile x86_64 and ARM64 and then use “lipo” to put them all together into a single binary.

What you CANNOT do is try to compile both x86_64 and ARM64 at the same time. It will not work.

I’ll just note here that CMake supports doing combined compiles, some projects just make assumptions that make that impossible (in short: anything that does try_run to determine build configuration setup).