Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29151 Discussions

Error when building HDF5 using ifx on Windows

ogmundur
Novice
1,240 Views

When building HDF5 1.14.6 on Windows using ifx (OneAPI 2025) I get the following error:

 

CMake Error at C:/Program Files/CMake/share/cmake-4.0/Modules/FortranCInterface.cmake:396 (message):

The Fortran compiler:

C:/Program Files (x86)/Intel/oneAPI/compiler/2025.1/bin/ifx.exe

and the C compiler:

C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe

failed to compile a simple test project using both languages. The output was:

Change Dir: 'D:/ci-cd/jenkins/lagrange-svn.de/workspace/Lagrange/lagrange_extern_up_windows/WC_extern/hdf5/build/CMakeFiles/FortranCInterface/VerifyC'

Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/devenv.com" VerifyFortranC.sln /build Release /project VerifyFortranC

Microsoft Visual Studio 2022 Version 17.9.2.

Copyright (C) Microsoft Corp. All rights reserved.

The operation could not be completed

Use: devenv [solutionfile | projectfile | folder | anyfile.ext] [switches]

 

I have selected ifx as the fortran compiler via the toolset argument of CMake (-T fortran=ifx) otherwise I am using the default settings of the HDF5 project. This same error occurs for various other fortran projects. Previous builds using ifort were successful.

0 Kudos
1 Solution
Mark_Lewy
Valued Contributor I
960 Views

Yes, there's appears to be something up with the VS 2022 integration when using oneAPI 2025.1.  Have you tried using a different generator with cmake?  I built HDF5 successfully with the Ninja generator and ifx 2025.1.1.

View solution in original post

0 Kudos
8 Replies
Mark_Lewy
Valued Contributor I
1,173 Views

If you look at release_docs/HISTORY-1_14.txt for HDF5 1.14.6 you will find that under Platforms Tested the latest ifx version they used was 2024.2.0 on Linux (and there is no mention of Fortran for Windows).  I can build HDF5 on Windows with the VS 2022 generator if my selected IFX is 2024.2.1, but it fails with 2025.1.1.  Given the release date of 1.14.6, they had no chance to verify it with OneAPI 2025.1

0 Kudos
andrew_4619
Honored Contributor III
1,163 Views
With ifx 2025 some of the folder structure changed I think.
0 Kudos
Mark_Lewy
Valued Contributor I
1,147 Views

For information, this appears to be a regression in ifx 2025.1.1; HDF5 1.14.6 builds in earlier versions of ifx.

To reproduce:

In Visual Studio 2022, set Selected compiler to 2025.0.0 in Options->Intel Compilers and Libraries->IFX Intel Fortran->Compilers

Create a folder c:\Source\hdf_inst

Unzip the hdf5-1.14.6 source into there (from Source Code - The HDF Group - ensuring long-term access and usability of HDF data and supporting users of HDF technologies)

Open a oneAPI development command prompt in c:\Source\hdf_inst

Run cmake-gui (I have cmake 3.29.2 installed):

 Select hdf5-1.14.6 as the source code location

 Set preset to ci-StdShar-Intel

 Set HDF5_BUILD_JAVA to OFF (I don't have Java installed)

 Configure

   Specify the generator for this project "Visual Studio 17 2022" (I have 17.12.4 LTSC installed)

   Optional toolset to to use (argument to -T): fortran=ifx

   Use default preset compilers

 Finish

 Generate

cd build114\ci-StdShar-Intel

devenv hdf5.sln

In the solution build project hdf5-fortran-shared (in libraries/fortran), this should succeed.

Now select ifx 2025.1.1 as compiler and try rebuilding only the project:

Rebuild started at 15:58...
1>------ Rebuild All started: Project: hdf5_fortran-shared (IFX), Configuration: Debug x64 ------
Deleting intermediate files and output files for project 'hdf5_fortran-shared', configuration 'Debug|x64'.
Compiling with Intel® Fortran Compiler 2025.1.1 [Intel(R) 64]...
H5_gen.F90
ifx: command line warning #10161: unrecognized source type 'Files\Microsoft'; object file assumed
ifx: command line warning #10161: unrecognized source type 'Visual'; object file assumed
fpp: fatal: can't fopen file: Studio\2022\Professional\VC\Tools\MSVC\14.42.34433\bin\HostX64\x64 /Qm64 C:\Source\hdf_inst\build114\ci-StdShar-Intel\fortran\shared\H5_gen.F90
H5fortran_types.F90
ifx: command line warning #10161: unrecognized source type 'Files\Microsoft'; object file assumed
ifx: command line warning #10161: unrecognized source type 'Visual'; object file assumed
fpp: fatal: can't fopen file: Studio\2022\Professional\VC\Tools\MSVC\14.42.34433\bin\HostX64\x64 /Qm64 C:\Source\hdf_inst\build114\ci-StdShar-Intel\fortran\shared\H5fortran_types.F90
<elided>

However, the H5_buildiface project does build with 2025.1.1.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,145 Views

Have you first launched the oneAPI command prompt to get to your CMD window?

jimdempseyatthecove_0-1748963053027.png

:: initializing oneAPI environment...
   Initializing Visual Studio command-line environment...
   Visual Studio version 17.8.2 environment configured.
   "C:\Program Files\Microsoft Visual Studio\2022\Community\"
   Visual Studio command-line environment initialized for: 'x64'
:  advisor -- latest
:  compiler -- latest
:  dal -- latest
:  debugger -- latest
:  dev-utilities -- latest
:  dnnl -- latest
:  dpcpp-ct -- latest
:  dpl -- latest
:  inspector -- latest
:  ipp -- latest
:  ippcp -- latest
:  itac -- latest
:  mkl -- latest
:  mpi -- latest
:  ocloc -- latest
:  pti -- latest
:  tbb -- latest
:  umf -- latest
:  vtune -- latest
:: oneAPI environment initialized ::

C:\Program Files (x86)\Intel\oneAPI>

 Then from there CD to the desired folder, and set any additional environment variables.

 

Jim Dempsey 

0 Kudos
Mark_Lewy
Valued Contributor I
1,139 Views

I assume that's a reply to the OP @jimdempseyatthecove ?  In my repro steps above, I specify the use of a oneAPI command prompt.  I got HDF5 to build using cmake and a preset file with IFX 2025.0 and 2024.2. 

 

Also, in releases/INSTALL_CMake.txt, they describe how to build HDF5 with a ctest build script, but I couldn't persuade that to use ifx instead of ifort, which wouldn't be of much use for anyone with OneAPI 2025.0 or later

 

My suggestion to the OP is to either get hold of a copy of oneAPI 2025.0 or 2024.2 or to install a pre-compiled binary.

0 Kudos
ogmundur
Novice
1,008 Views

Thanks for the suggestions; I'm afraid I don't have the option to revert to an older version of oneAPI as the machine isn't adminstered by me  so I was interested to hear if anyone else was experiencing the same issue and perhaps knew of a workaround.

 

Regarding persuading the ctest build script to use ifx instead of ifort (raised by @Mark_Lewy ), if you add

set (CMAKE_GENERATOR_TOOLSET "fortran=ifx")

To the HDF5config.cmake file, it has the same effect as the -T command line option of cmake.

 

My build environment is initialised using the setvars.bat script:

 

C:\Program Files (x86)\Intel\oneAPI\setvars.bat
:: initializing oneAPI environment...
Initializing Visual Studio command-line environment...
Visual Studio version 17.9.2 environment configured.
"C:\Program Files\Microsoft Visual Studio\2022\Professional\"
Visual Studio command-line environment initialized for: 'x64'
: advisor -- latest
: compiler -- latest
: dal -- latest
: debugger -- latest
: dev-utilities -- latest
: dnnl -- latest
: dpcpp-ct -- latest
: dpl -- latest
: ipp -- latest
: ippcp -- latest
: mkl -- latest
: mpi -- latest
: ocloc -- latest
: pti -- latest
: tbb -- latest
: umf -- latest
: vtune -- latest
:: oneAPI environment initialized ::
 
Attempting to build arpack-ng via cmake --build results in the same error as for HDF5 1.14.6 (i.e. "The operation could not be completed" reported by devenv). Executing devenv by hand using the solution file generated by CMake results in some really strange errors:
 
devenv arpack.sln /build Debug
Microsoft Visual Studio 2022 Version 17.9.2.
Copyright (C) Microsoft Corp. All rights reserved.
Build started at 19:34...
1>------ Build started: Project: arpack, Configuration: Debug x64 ------
Compiling with Intel Fortran Compiler 2025.1.1 [Intel(R) 64]...
staini.f
ifx: command line warning #10161: unrecognized source type 'Files\Microsoft'; object file assumed
ifx: command line warning #10161: unrecognized source type 'Visual'; object file assumed
fpp: fatal: can't fopen file: Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64 /Qm64
 
etc. etc.



0 Kudos
Mark_Lewy
Valued Contributor I
961 Views

Yes, there's appears to be something up with the VS 2022 integration when using oneAPI 2025.1.  Have you tried using a different generator with cmake?  I built HDF5 successfully with the Ninja generator and ifx 2025.1.1.

0 Kudos
ogmundur
Novice
870 Views

That's brilliant - I hadn't thought of that! Using Ninja I'm now able to build successfully.

0 Kudos
Reply