Skip to content
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

[hdf5] Update to 1.14.3 and fix compilation error under arm64-windows #37531

Closed
wants to merge 14 commits into from
162 changes: 162 additions & 0 deletions ports/hdf5/fix_arm_build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
index f36b662..f5b5335 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -901,8 +901,8 @@ if (HDF5_ENABLE_THREADSAFE)
message (VERBOSE " **** Allowing unsupported HL and thread-safety options **** ")
endif ()
endif ()
- if (H5_HAVE_IOEO)
- message (VERBOSE " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ")
+ if (WIN32)
+ # When Win32 is available, we use those threads
set (H5_HAVE_WIN_THREADS 1)
else ()
if (NOT H5_HAVE_PTHREAD_H)
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 3d4c23b..4ea0fdc 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -292,6 +292,12 @@ if (MINGW OR NOT WINDOWS)
endif ()
endif ()

+# MinGW and Cygwin
+if (MINGW OR CYGWIN)
+ set (CMAKE_REQUIRED_DEFINITIONS
+ "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
+ )
+endif ()
#-----------------------------------------------------------------------------
# Check the size in bytes of all the int and float types
#-----------------------------------------------------------------------------
@@ -872,35 +878,46 @@ if (HDF5_BUILD_FORTRAN)
endif()

#-----------------------------------------------------------------------------
-# Macro to determine the various conversion capabilities
+# Macro to determine long double conversion properties
#-----------------------------------------------------------------------------
-macro (H5ConversionTests TEST msg)
+macro (H5ConversionTests TEST def msg)
if (NOT DEFINED ${TEST})
- TRY_RUN (${TEST}_RUN ${TEST}_COMPILE
- ${CMAKE_BINARY_DIR}
- ${HDF_RESOURCES_DIR}/ConversionTests.c
- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST
- OUTPUT_VARIABLE OUTPUT
- )
- if (${TEST}_COMPILE)
- if (${TEST}_RUN EQUAL "0")
- set (${TEST} 1 CACHE INTERNAL ${msg})
- message (VERBOSE "${msg}... yes")
+ if (NOT CMAKE_CROSSCOMPILING)
+ # Build and run the test code if not cross-compiling
+ TRY_RUN (${TEST}_RUN ${TEST}_COMPILE
+ ${CMAKE_BINARY_DIR}
+ ${HDF_RESOURCES_DIR}/ConversionTests.c
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if (${TEST}_COMPILE)
+ if (${TEST}_RUN EQUAL "0")
+ set (${TEST} 1 CACHE INTERNAL ${msg})
+ message (VERBOSE "${msg}... yes")
+ else ()
+ set (${TEST} "" CACHE INTERNAL ${msg})
+ message (VERBOSE "${msg}... no")
+ file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+ "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n"
+ )
+ endif ()
else ()
set (${TEST} "" CACHE INTERNAL ${msg})
message (VERBOSE "${msg}... no")
file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n"
+ "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n"
)
endif ()
else ()
- set (${TEST} "" CACHE INTERNAL ${msg})
- message (VERBOSE "${msg}... no")
- file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n"
- )
+ # Use the default if there's no cache variable and cross-compiling
+ if (${def})
+ message (VERBOSE "${msg}... yes (cross-compile default)")
+ set (${TEST} 1 CACHE INTERNAL ${msg})
+ else ()
+ message (VERBOSE "${msg}... no (cross-compile default)")
+ set (${TEST} "" CACHE INTERNAL ${msg})
+ endif ()
endif ()
-
endif ()
endmacro ()

@@ -917,7 +934,7 @@ endmacro ()
# The machine's conversion gets the correct value. We define the macro and disable
# this kind of test until we figure out what algorithm they use.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm")
+H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL FALSE "Checking IF your system converts long double to (unsigned) long values with special algorithm")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine is using a special algorithm
# to convert some values of '(unsigned) long' to 'long double' values.
@@ -926,7 +943,7 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your syst
# ..., 7fffff..., the compiler uses a unknown algorithm. We define a
# macro and skip the test for now until we know about the algorithm.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm")
+H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL FALSE "Checking IF your system can convert (unsigned) long to long double values with special algorithm")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine can accurately convert
# 'long double' to '(unsigned) long long' values. (This flag should be set for
@@ -936,7 +953,7 @@ H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL "Checking IF your syste
# 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted
# values wildly wrong. This test detects this wrong behavior and disable the test.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly converting long double to (unsigned) long long values")
+H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE TRUE "Checking IF correctly converting long double to (unsigned) long long values")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine can accurately convert
# '(unsigned) long long' to 'long double' values. (This flag should be set for
@@ -944,9 +961,9 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctl
# 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice
# as big as they should be.
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values")
+H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT TRUE "Checking IF correctly converting (unsigned) long long to long double values")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine can accurately convert
# some long double values
#-----------------------------------------------------------------------------
-H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV "Checking IF the cpu is power9 and cannot correctly converting long double values")
+H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV FALSE "Checking IF the cpu is power9 and cannot correctly converting long double values")
diff --git a/config/cmake/HDFTests.c b/config/cmake/HDFTests.c
index 3897390..18f2edb 100644
--- a/config/cmake/HDFTests.c
+++ b/config/cmake/HDFTests.c
@@ -197,21 +197,3 @@ int main(void)
return 0;
}
#endif
-
-#ifdef HAVE_IOEO
-
-#include <windows.h>
-typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
-int main ()
-{
- PGNSI pGNSI;
-
- pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "InitOnceExecuteOnce");
-
- if (NULL == pGNSI)
- return 1;
- else
- return 0;
-}
-
-#endif /* HAVE_IOEO */
10 changes: 4 additions & 6 deletions ports/hdf5/pkgconfig-requires.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index 141ab44..66b7efa 100644
index bc10c77..d70599a 100644
--- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake
@@ -95,6 +95,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
@@ -83,6 +83,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
+ set (zlib_PC_LIBS_PRIVATE "${ZLIB_LIBRARIES}")
endif ()
else ()
if (BUILD_ZLIB_WITH_FETCHCONTENT)
@@ -148,6 +148,7 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
@@ -132,6 +133,7 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
if (TARGET szip-shared)
set(SZIP_LIBRARIES szip-shared)
endif()
+ set(szip_PC_LIBS_PRIVATE "${SZIP_LIBRARIES}")
if (NOT SZIP_FOUND)
find_package (SZIP) # Legacy find
endif ()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b75fdd2..a2e88fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -711,5 +711,8 @@ if (H5_HAVE_PARALLEL)
Expand Down
5 changes: 3 additions & 2 deletions ports/hdf5/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO HDFGroup/hdf5
REF "${hdf5_ref}"
SHA512 9b44993bcdc1493a22da61c77a1bd962c0088ff8e7fb75c00568617386cfc296a73bbdae79c05847109bf1984e95660bbe459f8a96950f6cf71002800eed23f8
SHA512 4c74d2a1499a5f8bfcc1bf32b5901e413ccf46714a5ccdb4e190f51479c96a0d05ce47aae700945a45dc69f3bb0f3891c02bb522abd29cf16e8cb3a2fea8013c
HEAD_REF develop
PATCHES
hdf5_config.patch
szip.patch
pkgconfig-requires.patch
fix_arm_build.patch #https://github.com/HDFGroup/hdf5/pull/3683 https://github.com/HDFGroup/hdf5/pull/4160
jimwang118 marked this conversation as resolved.
Show resolved Hide resolved
)

set(ALLOW_UNSUPPORTED OFF)
Expand Down Expand Up @@ -167,4 +168,4 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/H5public.h" "#define H5public_H" "#define H5public_H\n#ifndef H5_BUILT_AS_DYNAMIC_LIB\n#define H5_BUILT_AS_DYNAMIC_LIB\n#endif\n")
endif()

file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/data/COPYING" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright")
vcpkg_install_copyright(FILE_LIST "${CURRENT_PACKAGES_DIR}/share/${PORT}/data/COPYING")
2 changes: 1 addition & 1 deletion ports/hdf5/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hdf5",
"version": "1.14.2",
"version": "1.14.3",
"description": "HDF5 is a data model, library, and file format for storing and managing data",
"homepage": "https://www.hdfgroup.org/downloads/hdf5/",
"license": "BSD-3-Clause",
Expand Down
4 changes: 0 additions & 4 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,6 @@ gz-tools2:x64-android=fail
gz-tools2:arm64-android=fail
gz-gui7:x64-osx=fail
halide:x64-windows-static=fail
hdf5:arm64-windows=fail
hdf5:arm-neon-android=fail
hdf5:arm64-android=fail
hdf5:x64-android=fail
hexl:x64-android=fail
highs:arm-neon-android=fail
highs:arm64-android=fail
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3345,7 +3345,7 @@
"port-version": 0
},
"hdf5": {
"baseline": "1.14.2",
"baseline": "1.14.3",
"port-version": 0
},
"healpix": {
Expand Down
5 changes: 5 additions & 0 deletions versions/h-/hdf5.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0a3e087aea34cdc3e867fe9dee7d8300dc850729",
"version": "1.14.3",
"port-version": 0
},
{
"git-tree": "24055818f16022ee4fe1feca4008df0a20d2cdb1",
"version": "1.14.2",
Expand Down
Loading