Skip to content

Commit

Permalink
Remove H5detect and H5make_libsettings (#3104)
Browse files Browse the repository at this point in the history
Removes H5detect and H5make_libsettings from the build and replaces
their functionality with things that don't affect cross-compiling.

H5detect --> floating-point types are now detected on library load
H5make_libsettings --> Moved functionality to a new H5build_settings.c template file
  • Loading branch information
derobins authored Jun 13, 2023
1 parent 9e7e2f8 commit d460591
Show file tree
Hide file tree
Showing 23 changed files with 911 additions and 1,531 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1218,10 +1218,4 @@ endif ()
#-----------------------------------------------------------------------------
configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_SRC_BINARY_DIR}/H5pubconf.h @ONLY)

#-----------------------------------------------------------------------------
# Options for use by cross compiling and toolchains
#-----------------------------------------------------------------------------
option (HDF5_USE_PREGEN "Use pre-generated Files" OFF)
option (HDF5_BATCH_H5DETECT "Use a batch command for running h5detect" OFF)

include (CMakeInstallation.cmake)
20 changes: 0 additions & 20 deletions bin/batch/knl_H5detect.sl.in.cmake

This file was deleted.

6 changes: 1 addition & 5 deletions bin/checkposix
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,13 @@ foreach $arg (@ARGV) {
# Skip files that don't include H5private.h
# H5system. has to be inspected by hand since it wraps POSIX files
#
# H5detect and H5make_libsettings are created before the library exists
# so calls that link to function replacements won't work. We'll ignore
# it here.
#
# If a user specifies one file, process it no matter what so people
# can inspect files we normally skip (like H5system.c).

$ignore = 0;

# Ignored files in src/
if($#ARGV gt 0 and $filename =~ /H5FDmulti|H5FDstdio|H5VLpassthru|H5system|H5detect|H5make_libsettings/) {
if($#ARGV gt 0 and $filename =~ /H5FDmulti|H5FDstdio|H5VLpassthru|H5system/) {
$ignore = 1;
}
# Ignored atomic test files in test/
Expand Down
32 changes: 17 additions & 15 deletions config/cmake/libhdf5.settings.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Linking Options:
AM_LDFLAGS: @AM_LDFLAGS@
Extra libraries: @LINK_LIBS@
Archiver: @CMAKE_AR@
AR_FLAGS:
Ranlib: @CMAKE_RANLIB@

Languages:
Expand All @@ -44,24 +45,24 @@ Languages:
Static C Library: @H5_ENABLE_STATIC_LIB@

Fortran: @HDF5_BUILD_FORTRAN@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @CMAKE_Fortran_FLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Module Directory: @CMAKE_Fortran_MODULE_DIRECTORY@
Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@
Fortran Flags: @CMAKE_Fortran_FLAGS@
H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@
AM Fortran Flags: @AM_FCFLAGS@
Shared Fortran Library: @H5_ENABLE_SHARED_LIB@
Static Fortran Library: @H5_ENABLE_STATIC_LIB@
Module Directory: @CMAKE_Fortran_MODULE_DIRECTORY@

C++: @HDF5_BUILD_CPP_LIB@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CMAKE_CXX_FLAGS@
@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@
@BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@
@BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@
@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@
C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@
C++ Flags: @CMAKE_CXX_FLAGS@
H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@
AM C++ Flags: @AM_CXXFLAGS@
Shared C++ Library: @H5_ENABLE_SHARED_LIB@
Static C++ Library: @H5_ENABLE_STATIC_LIB@

JAVA: @HDF5_BUILD_JAVA@
@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@
JAVA: @HDF5_BUILD_JAVA@
JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@

Features:
---------
Expand All @@ -77,6 +78,7 @@ Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@
Default API mapping: @DEFAULT_API_VERSION@
With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@
I/O filters (external): @EXTERNAL_FILTERS@
Map (H5M) API: @H5_HAVE_MAP_API@
Direct VFD: @H5_HAVE_DIRECT@
Mirror VFD: @H5_HAVE_MIRROR_VFD@
Subfiling VFD: @H5_HAVE_SUBFILING_VFD@
Expand Down
24 changes: 19 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,21 @@ AM_MAINTAINER_MODE([enable])
## This allows multiple src-dir builds within one host.
AC_PREFIX_DEFAULT([`pwd`/hdf5])

## Run post processing on files created by configure.
## Run post processing on files created by configure
##
## src/H5pubconf.h:
## Generate src/H5pubconf.h from src/H5config.h by prepending H5_ to all
## macro names. This avoid name conflict between HDF5 macro names and those
## generated by another software package that uses the HDF5 library.
##
## src/libhdf5.settings:
## Remove all lines begun with "#" which are generated by CONDITIONAL's of
## configure.
## Remove all lines beginning with "#" which are generated by CONDITIONAL's
## of configure.
##
## src/H5build_settings.c
## Remove all lines beginning with "#" which are generated by CONDITIONAL's
## of configure. This uses a check for whitespace after the pound sign
## to avoid clobbering include statements.
AC_CONFIG_COMMANDS([pubconf], [
echo "creating src/H5pubconf.h"
sed 's/#define /#define H5_/' <src/H5config.h |\
Expand All @@ -105,6 +112,10 @@ AC_CONFIG_COMMANDS([pubconf], [
sed '/^#/d' < src/libhdf5.settings > libhdf5.settings.TMP
cp libhdf5.settings.TMP src/libhdf5.settings
rm -f libhdf5.settings.TMP
echo "Post process src/H5build_settings.c"
sed '/^# /d' < src/H5build_settings.c > H5build_settings.TMP
cp H5build_settings.TMP src/H5build_settings.c
rm -f H5build_settings.TMP
])

## It's possible to configure for a host other than the one on which
Expand Down Expand Up @@ -3725,9 +3736,11 @@ AC_ARG_ENABLE([embedded-libinfo],

if test "${enable_embedded_libinfo}" = "yes"; then
AC_MSG_RESULT([yes])
BUILD_SETTINGS_FILE="src/H5build_settings.autotools.c.in"
AC_DEFINE([HAVE_EMBEDDED_LIBINFO], [1],
[Define if library information should be embedded in the executables])
else
BUILD_SETTINGS_FILE="src/H5build_settings.off.c.in"
AC_MSG_RESULT([no])
fi

Expand Down Expand Up @@ -3860,10 +3873,11 @@ fi
##
AM_CONDITIONAL([HAVE_SHARED_CONDITIONAL], [test "X$enable_shared" = "Xyes"])

AC_CONFIG_FILES([src/libhdf5.settings
Makefile
AC_CONFIG_FILES([Makefile
doxygen/Doxyfile
src/Makefile
src/libhdf5.settings
src/H5build_settings.c:${BUILD_SETTINGS_FILE}
test/Makefile
test/H5srcdir_str.h
test/test_abort_fail.sh
Expand Down
9 changes: 0 additions & 9 deletions release_docs/INSTALL_CMake.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1030,15 +1030,6 @@ References:
https://stackoverflow.com/questions/54539682/how-to-set-up-cmake-to-cross-compile-with-clang-for-arm-embedded-on-windows?rq=1
https://developer.android.com/ndk/guides/cmake

Predefine H5Tinit.c file
-------------------------------
The one file that needs to be pre-generated is the H5Tinit.c file. The variables
indicated in the error log (see above) are the variables that need to match the target system.

The HDF5 CMake variables;
HDF5_USE_PREGEN: set this to true
HDF5_USE_PREGEN_DIR: set this path to the preset H5Tinit.c file


========================================================================
X: Using CMakePresets.json for compiling
Expand Down
19 changes: 0 additions & 19 deletions release_docs/README_HPC
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Section II: Obtain HDF5 source
Section III: Using ctest command to build and test
Section IV: Cross compiling
Section V: Manual alternatives
Section VI: Other cross compiling options

************************************************************************

Expand Down Expand Up @@ -184,21 +183,3 @@ or
for parallel builds.

Tests on machines using LSF will typically use "bsub ctestS.lsf", etc.

========================================================================
VI. Other cross compiling options
========================================================================
Settings for two other cross-compiling options are also in the config/toolchain
files which do not seem to be necessary with the Cray PrgEnv-* modules

1. HDF5_USE_PREGEN. This option, along with the HDF5_USE_PREGEN_DIR CMake
variable would allow the use of an appropriate H5Tinit.c file with type
information generated on a compute node to be used when cross compiling
for those compute nodes. The use of the variables in lines 110 and 111
of HDF5options.cmake file seem to preclude needing this option with the
available Cray modules and CMake option.

2. HDF5_BATCH_H5DETECT and associated CMake variables. This option when
properly configured will run H5detect in a batch job on a compute node
at the beginning of the CMake build process. It was also found to be
unnecessary with the available Cray modules and CMake options.
18 changes: 18 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ New Features

Configuration:
-------------
- Removed CMake cross-compiling variables

* HDF5_USE_PREGEN
* HDF5_BATCH_H5DETECT

These were used to work around H5detect and H5make_libsettings and
are no longer required.

- Running H5make_libsettings is no longer required for cross-compiling

The functionality of H5make_libsettings is now handled via template files,
so H5make_libsettings has been removed.

- Running H5detect is no longer required for cross-compiling

The functionality of H5detect is now exercised at library startup,
so H5detect has been removed.

- Removed long double work-around symbols and configure options

Several options and public symbols that were provided to paper over
Expand Down
Loading

0 comments on commit d460591

Please sign in to comment.