-
-
Notifications
You must be signed in to change notification settings - Fork 306
Rework Fortran configure to allow cross compile overrides #5720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
set (PAC_FC_ALL_INTEGER_KINDS "\{1,2,4,8,16\}" CACHE INTERNAL "Find available INTEGER KINDs for Fortran") | ||
set (PAC_FC_ALL_REAL_KINDS "\{4,8,10,16\}" CACHE INTERNAL "Find available REAL KINDs for Fortran") | ||
set (${HDF_PREFIX}_PAC_FC_MAX_REAL_PRECISION 33 CACHE INTERNAL "Maximum decimal precision for REALs in Fortran") | ||
set (PAC_FORTRAN_NUM_INTEGER_KINDS "5" CACHE INTERNAL "Number of valid integer kinds for Fortran") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the cross‐compile default branch, the default integer kinds count is inconsistent: 'PAC_FORTRAN_NUM_INTEGER_KINDS' is set to 5, but H5CONFIG_F_NUM_IKIND is hard‐coded to 4. Please align these values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are two different items.
else () | ||
# Use the default if there's no cache variable and cross-compiling | ||
message (VERBOSE "Find available REAL KINDs for Fortran... yes (cross-compile default)") | ||
set (PAC_FC_ALL_REAL_KINDS_SIZEOF "\{4,8,16,16\}" CACHE INTERNAL "Find available REAL KINDs for Fortran") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default REAL KIND SIZEOF value contains a duplicate '16' (i.e. "{4,8,16,16}"). Verify if this duplication is intentional or if it should differ (e.g. perhaps "{4,8,10,16}").
set (PAC_FC_ALL_REAL_KINDS_SIZEOF "\{4,8,16,16\}" CACHE INTERNAL "Find available REAL KINDs for Fortran") | |
set (PAC_FC_ALL_REAL_KINDS_SIZEOF "\{4,8,10,16\}" CACHE INTERNAL "Find available REAL KINDs for Fortran") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are correct values for linux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not Linux that determines this, but the compiler. Interpretation of KIND values depends on the compiler. For example, NAG, by default, uses sequential kind numbering, which is not what GNU does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the idea is that toolchain specific overrides will modify this. This is just a simple default - the other option will be to skip the default and require an override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could also change the "(cross-compile default)" to "(cross-compile gfortran default)"
The mingw dross-compile gets past the configure stage and then chokes on: because the values from the defaults are not correctly formatted. Once the syntax is correct then we can update the toolchain with the correct values. |
The latest update fixes the Fortran configuration issue with PRE-GENERATED files. And the build succeeds. The tests fail because they are failing with the WINE emulator - maybe someone can suggest a fix? |
CMake applies the CMAKE_CROSSCOMPILING_EMULATOR for cross compiling and does not need to be specified in the command line. The WINEPATH ENV must be added to calls involving wine emulator. Added this to the mingw toolchain. Only 24 tests failed mostly h5_test_api and hl_test tests. Will need to investigate which of these tests are expected to fail with wine emulator. |
Fixed the h5_api_test by excluding them if cross-compiling. |
Note that 3 - H5TEST-testhdf5-base (Failed) is because : |
Although the CI doesn't show it - there are only 4 failing tests on my local fedora system. The ubuntu runner seems to have a char set issue causing problems. Likely a missing system dependency? |
16k lines!!!! I really hope this is "improving things" beyond just "cross compilation workflows". I really think cross compilation is critical, but this has definitely gone "beyond" the scope I originally imaged this being. |
So the big change is that CMake will apply the CMAKE_CROSS_COMPILING_EMULATER as needed - had to remove that from the commands |
Are you able to provide points and tips to the failures in: conda-forge/hdf5-feedstock#268 |
I haven't tried mpi and cross-compiling - is that the issue? |
Note that the supplied pre-gen files and configure defaults were specific for mingw-gfortran. Other compilers will likely need other values and files. The best thing would be to create a stable of toolchain files and dirs. |
i'm honestly not sure how much time i have to troubleshoot this with you all. i'm really sorry. you can see my checklist, i got pretty far. but i need some hands on keyboard debugging from some1 who is willing to look at things from a conda-forge standpoint. Its free to make a PR, which will run on our infrastructure. To be honest, it is very likely that we will be able to, by 2026, to run on native runners for OSX on conda-forge. I'm willing to wait, or simply to stick on the HDF5 V1, and "not accelerate" its deployment. |
Yes I believe that running on native machines is the best plan. Our use of native runners has been very beneficial. |
@hmaarrfk Do you know when in 2026 this may happen? |
Another possibility using defaults and toolchain file could overwrite.
See #5709 and #5718
The expectation is that cross-compiling will use a toolchain file to provide the correct values.
The defaults are only one way to provide defaults for a specific compiler.
NOTE: The supplied toolchain and Fortran pre-gen files are specific for mingw/gfortran - each platform/compiler will need to supply its own set of files/values.
Important
Rework
HDF5UseFortran.cmake
to support cross-compilation by providing default KINDs and sizes.HDF5UseFortran.cmake
to handle cross-compilation by providing default KINDs and sizes whenCMAKE_CROSSCOMPILING
is true.CMAKE_CROSSCOMPILING
to determine if default values should be used.{1,2,4,8,16}
and REAL KINDs{4,8,10,16}
.This description was created by
for 0b8f640. You can customize this summary. It will automatically update as commits are pushed.