HDFGroup / HDFGroup/hdf5

Compiling with LLVM Flang on windows -> missing intrinsic functions SIZEOF or STORAGE_SIZE

Open
#4,419 11 comments 0 reactions 1 assignee Claimed by @brtnfld View on GitHub
Component - Wrappers
Dominant language
C
Stars
988
Forks
355
Avg merge
4d 2h
Merged PRs (30d)
12

Description

When attempting to compile HDF5 on windows with fortran enabled using LLVM FLang (v18.1.3 from conda-forge) I get

```
-- The Fortran compiler identification is LLVMFlang 18.1.3
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: D:/bld/hdf5_1713270629406/_build_env/Library/bin/flang-new.exe - skipped
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Verifying Fortran/C Compiler Compatibility
-- Verifying Fortran/C Compiler Compatibility - Success
-- Performing Test H5_FORTRAN_HAVE_SIZEOF
-- Performing Test H5_FORTRAN_HAVE_SIZEOF - Failed
-- Performing Test H5_FORTRAN_HAVE_C_SIZEOF
-- Performing Test H5_FORTRAN_HAVE_C_SIZEOF - Failed
-- Performing Test H5_FORTRAN_HAVE_STORAGE_SIZE
-- Performing Test H5_FORTRAN_HAVE_STORAGE_SIZE - Failed
-- Performing Test H5_FORTRAN_HAVE_ISO_C_BINDING
-- Performing Test H5_FORTRAN_HAVE_ISO_C_BINDING - Failed
-- Performing Test FORTRAN_HAVE_C_LONG_DOUBLE
-- Performing Test FORTRAN_HAVE_C_LONG_DOUBLE - Failed
-- Performing Test FORTRAN_C_LONG_DOUBLE_IS_UNIQUE
-- Performing Test FORTRAN_C_LONG_DOUBLE_IS_UNIQUE - Failed
-- Performing Test FORTRAN_C_BOOL_IS_UNIQUE
-- Performing Test FORTRAN_C_BOOL_IS_UNIQUE - Failed
-- Performing Test HAVE_ISO_FORTRAN_ENV
-- Performing Test HAVE_ISO_FORTRAN_ENV - Failed
CMake Error at config/cmake/HDF5UseFortran.cmake:128 (message):
Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE
Call Stack (most recent call first):
CMakeLists.txt:1076 (include)
```

[link to build logs](https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=916161&view=logs&j=a70f640f-cc53-5cd3-6cdc-236a1aa90802&t=6119ccbe-9301-594f-7c27-f792b80a7fcc&l=1192)

[link to conda-forge PR](https://github.com/conda-forge/hdf5-feedstock/pull/217)

However, based on

- https://github.com/llvm/llvm-project/issues/56348
- https://forum.hdfgroup.org/t/cmake-error-with-aocc-flang-compiler/10208

I had hopes that this could work on Windows given that it seems LLVM flang compiles HDF5 on linux.

**Platform (please complete the following information)**
- HDF5 versions v1.14.4.2 and v1.14.3 (both versions results in same error)
- Windows 11
- cl (MSVC 14.38) and Flang 18.1.3 (from [conda-forge](https://github.com/conda-forge/flang-feedstock))
- CMake=3.29.2
- See HDF5 build config below
- Not using mpi

**HDF5 build config**

```
mkdir build
cd build

:: Set environment variables.
set HDF5_EXT_ZLIB=zlib.lib

set "CXXFLAGS=%CXXFLAGS% -LTCG"
set FC=flang-new

:: Configure step.
cmake -G "Ninja" ^
-D CMAKE_BUILD_TYPE:STRING=RELEASE ^
-D CMAKE_PREFIX_PATH:PATH=%LIBRARY_PREFIX% ^
-D CMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^
-D HDF5_BUILD_CPP_LIB:BOOL=ON ^
-D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON ^
-D BUILD_SHARED_LIBS:BOOL=ON ^
-D BUILD_STATIC_LIBS:BOOL=OFF ^
-D ONLY_SHARED_LIBS:BOOL=ON ^
-D HDF5_BUILD_HL_LIB:BOOL=ON ^
-D HDF5_BUILD_TOOLS:BOOL=ON ^
-D HDF5_BUILD_FORTRAN:BOOL=ON ^
-D HDF5_BUILD_HL_GIF_TOOLS:BOOL=ON ^
-D HDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON ^
-D HDF5_ENABLE_THREADSAFE:BOOL=ON ^
-D HDF5_ENABLE_ROS3_VFD:BOOL=ON ^
-D HDF5_ENABLE_SZIP_SUPPORT=ON ^
-D ALLOW_UNSUPPORTED:BOOL=ON ^
%SRC_DIR%
if errorlevel 1 exit 1

:: Build C libraries and tools.
ninja
if errorlevel 1 exit 1

:: Install step.
ninja install
if errorlevel 1 exit 1
```

Let me know if there's anything I can add to help diagnose this issue?

Best Regards
Kristoffer

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.