Closed shawnlaffan closed 1 year ago
Update: Starting afresh and limiting the changes to removal of the fortran components and the duplicate -DBUILD_SHARED_LIBS=ON
and using Unix makefiles with gmake produces a working build. The use of gmake might be unnecessary and the duplicate shared libs call might have no effect, but so long as it works...
diff --git a/build.sh b/build.sh
index 56a5af9..c4bfddb 100755
--- a/build.sh
+++ b/build.sh
@@ -1162,10 +1162,10 @@ echo "IF (BUILD_SHARED_LIBS)" >> CMakeLists.txt
echo "SET_TARGET_PROPERTIES (\${HDF4_SRC_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
echo "SET_TARGET_PROPERTIES (\${HDF4_MF_XDR_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
echo "SET_TARGET_PROPERTIES (\${HDF4_MF_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
-echo "SET_TARGET_PROPERTIES (\${HDF4_MF_FCSTUB_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
-echo "SET_TARGET_PROPERTIES (\${HDF4_MF_FORTRAN_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
-echo "SET_TARGET_PROPERTIES (\${HDF4_SRC_FCSTUB_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
-echo "SET_TARGET_PROPERTIES (\${HDF4_SRC_FORTRAN_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
+#echo "SET_TARGET_PROPERTIES (\${HDF4_MF_FCSTUB_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
+#echo "SET_TARGET_PROPERTIES (\${HDF4_MF_FORTRAN_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
+#echo "SET_TARGET_PROPERTIES (\${HDF4_SRC_FCSTUB_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
+#echo "SET_TARGET_PROPERTIES (\${HDF4_SRC_FORTRAN_LIBSH_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
###old
#echo "SET_TARGET_PROPERTIES (\${HDF4_SRC_LIB_NAME} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
#echo "SET_TARGET_PROPERTIES (\${HDF4_MF_XDR_LIB_TARGET} PROPERTIES SUFFIX $DLLSUFFIX.dll)">> CMakeLists.txt
@@ -1178,14 +1178,13 @@ echo "ENDIF ()" >> CMakeLists.txt
mkdir MY_BUILD
cd MY_BUILD
cp ../COPYING.txt ./
-xxrun cmake -G 'MSYS Makefiles' -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$OUT \
- -DBUILD_SHARED_LIBS=ON \
+xxrun cmake -G 'Unix Makefiles' -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$OUT \
-DHDF4_BUILD_XDR_LIB=ON \
-DHDF4_ENABLE_SZIP_SUPPORT=ON \
-DHDF4_ENABLE_SZIP_ENCODING=ON \
-DHDF4_ENABLE_JPEG_LIB_SUPPORT=ON \
-DHDF4_ENABLE_Z_LIB_SUPPORT=ON \
- -DHDF4_BUILD_FORTRAN=ON \
+ -DHDF4_BUILD_FORTRAN=OFF \
-DHDF4_BUILD_TOOLS=OFF \
-DHDF4_BUILD_UTILS=OFF \
-DHDF4_BUILD_EXAMPLES=OFF \
@@ -1194,8 +1193,8 @@ xxrun cmake -G 'MSYS Makefiles' -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$O
-DSZIP_INCLUDE_DIR=$OUT/include \
-DSZIP_LIBRARY=$OUT/lib/libsz.dll.a \
..
-xxrun make
-xxrun make install
+xxrun gmake
+xxrun gmake install
# names:
# cp hdf_fcstub-shared.dll.a libhdf_fcstub.dll.a
# cp hdf_fortran-shared.dll.a libhdf_fortran.dll.a
diff --git a/sources.list b/sources.list
index 35c9634..a293da5 100755
--- a/sources.list
+++ b/sources.list
@@ -320,6 +320,7 @@ http://www.hdfgroup.org/ftp//HDF/prev-releases/HDF4.2.11/src/hdf-4.2.11.tar.gz
http://www.hdfgroup.org/ftp//HDF/prev-releases/HDF4.2.1/src/hdf-4.2.11.tar.gz
https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.12/src/hdf-4.2.12.tar.gz
https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.14/src/hdf-4.2.14.tar.gz
+https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.15/src/hdf-4.2.15.tar.gz
#URL http://www.netlib.org/lapack/
http://www.netlib.org/lapack/lapack-3.6.0.tgz
@mohawk2 - is there anything in PDL that needs the fortran interface to HDF4?
Sorry but this still needs work. The successful build was with HDF 4.2.14, for which the logs show it is not finding szip. The build with 4.2.15 does find szip but then throws the errors above.
Updating the patch files for 4.2.15 gets compilation working. This is a mix of the existing patches for 4.2.14 and the patches in use for MSYS2 packaging.
@mohawk2 - is there anything in PDL that needs the fortran interface to HDF4?
Not to my knowledge!
PR #12 merged, so closing
TLDR: libhdf4 compilation seems reasonably complex. It appears there are conflicts between static and shared libraries. Hopefully someone more knowledgeable about such things can chime in.
build commands and modifications from the repo
This build is using HDF 4.2.15, which is the most recent release. The StrawberryPerl/build-extlibs repo currently targets 4.2.14.
I've modified my version of the build script to not build fortran. This is under the assumption compilation of fortran code using hdf4 is not needed, and also because the HDF FAQ suggests not to for shared builds: https://docs.hdfgroup.org/archive/support/products/hdf4/HDF-FAQ.html#11share . It seems unrelated to the failures but does make things a little faster.
I have updated the code to append to CMakeLists.txt wrapped in an if condition to allow it to be skipped using an env var. It makes no apparent difference if it is excluded or not, but the last four need to be skipped if fortran is disabled.
COPYING.txt is not in the distribution now.
build errors
Build errors are below.
So far as I can tell they are issues with static libs being loaded into dynamic libs.
https://stackoverflow.com/questions/66314384/undefined-reference-to-imp-in-minwg https://stackoverflow.com/questions/10059200/how-do-i-fix-undefined-reference-to-imp
Fixing such issues needs different expertise to mine. Hopefully someone can chime in with a solution, or a recommendation it be reported upstream.
(Changing the
-DSZIP_LIBRARY=$OUT/lib/libsz.dll.a
to point to.../bin/libsz.dll
had no effect).