Skip to content

Conversation

byrnHDF
Copy link
Contributor

@byrnHDF byrnHDF commented Aug 11, 2025

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.

  • Behavior:
    • Modify HDF5UseFortran.cmake to handle cross-compilation by providing default KINDs and sizes when CMAKE_CROSSCOMPILING is true.
    • Default values for INTEGER and REAL KINDs and their sizes are set when cross-compiling.
    • Error messages are adjusted to reflect cross-compilation scenarios.
  • Logic:
    • Conditional checks added for CMAKE_CROSSCOMPILING to determine if default values should be used.
    • Default values include INTEGER KINDs {1,2,4,8,16} and REAL KINDs {4,8,10,16}.
    • Default sizes for native kinds are set to 4 for INTEGER and REAL, and 8 for DOUBLE PRECISION when cross-compiling.
  • Misc:
    • Adjustments to verbose messages to indicate when defaults are used during cross-compilation.

This description was created by Ellipsis for 0b8f640. You can customize this summary. It will automatically update as commits are pushed.

@byrnHDF
Copy link
Contributor Author

byrnHDF commented Aug 12, 2025

The mingw cross-compile gets past the configure stage and then chokes on:
FAILED: [code=1] fortran/src/CMakeFiles/H5_buildiface.dir/H5_buildiface.F90.obj
FAILED: [code=1] fortran/src/CMakeFiles/H5match_types.dir/H5match_types.c.obj

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.

@byrnHDF
Copy link
Contributor Author

byrnHDF commented Sep 30, 2025

Potential issue: These defaults may not work for all compilers

The requirement is to specify the correct values in a toolchain file. gfortran defaults are just in case.
The other choice is to halt the config if cross-compile is indicated and no values are provided.

@brtnfld
Copy link
Collaborator

brtnfld commented Oct 9, 2025

Where is CROSSCOMPILING_PATH defined?

set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set (CMAKE_CROSSCOMPILING_EMULATOR wine64)
set (CROSSCOMPILING_PATH "WINEPATH=/usr/${TOOLCHAIN_PREFIX}/sys-root/mingw/bin/")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toolchain defines CROSSCOMPILING_PATH or it must be on the command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Build CMake, Autotools

Projects

Status: Scheduled/On-Deck

Development

Successfully merging this pull request may close these issues.

7 participants