From 2b2a1d605e0f556fcdf38345420047b5776c7ba2 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 18 May 2017 16:32:26 -0500 Subject: Fix for shared fortran libraries on mac (HDFFV-2772). --- configure.ac | 6 ++---- fortran/test/fortranlib_test.F90 | 6 +++--- fortran/test/fortranlib_test_1_8.F90 | 6 +++--- fortran/test/fortranlib_test_F03.F90 | 6 +++--- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index d0aeda9..458a3d2 100644 --- a/configure.ac +++ b/configure.ac @@ -919,12 +919,10 @@ if test "X${HDF_FORTRAN}" = "Xyes" && test "X${enable_shared}" != "Xno"; then AC_MSG_CHECKING([if shared Fortran libraries are supported]) H5_FORTRAN_SHARED="yes" - ## Disable fortran shared libraries on Mac. (MAM - 03/30/11) - + ## tell libtool to do the right thing with COMMON symbols case "`uname`" in Darwin*) - H5_FORTRAN_SHARED="no" - CHECK_WARN="Shared Fortran libraries not currently supported on Mac." + H5_LDFLAGS="$H5_LDFLAGS -Wl,-commons,use_dylibs" ;; esac diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index 94b084e..8d5b32b 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -50,11 +50,11 @@ PROGRAM fortranlibtest IF(total_error .EQ. 0) THEN WRITE(*, '(" FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO") - WRITE(*, '(I1)', advance="NO") majnum + WRITE(*, '(I0)', advance="NO") majnum WRITE(*, '(".")', advance="NO") - WRITE(*, '(I1)', advance="NO") minnum + WRITE(*, '(I0)', advance="NO") minnum WRITE(*, '(" release ")', advance="NO") - WRITE(*, '(I3)') relnum + WRITE(*, '(I0)') relnum ELSE total_error = total_error + 1 ENDIF diff --git a/fortran/test/fortranlib_test_1_8.F90 b/fortran/test/fortranlib_test_1_8.F90 index 850cab9..1306da5 100644 --- a/fortran/test/fortranlib_test_1_8.F90 +++ b/fortran/test/fortranlib_test_1_8.F90 @@ -46,11 +46,11 @@ PROGRAM fortranlibtest CALL h5get_libversion_f(majnum, minnum, relnum, total_error) IF(total_error .EQ. 0) THEN WRITE(*, '(" FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO") - WRITE(*, '(I1)', advance="NO") majnum + WRITE(*, '(I0)', advance="NO") majnum WRITE(*, '(".")', advance="NO") - WRITE(*, '(I1)', advance="NO") minnum + WRITE(*, '(I0)', advance="NO") minnum WRITE(*, '(" release ")', advance="NO") - WRITE(*, '(I3)') relnum + WRITE(*, '(I0)') relnum ELSE total_error = total_error + 1 ENDIF diff --git a/fortran/test/fortranlib_test_F03.F90 b/fortran/test/fortranlib_test_F03.F90 index ae12dba..9a74120 100644 --- a/fortran/test/fortranlib_test_F03.F90 +++ b/fortran/test/fortranlib_test_F03.F90 @@ -47,11 +47,11 @@ PROGRAM fortranlibtest_F03 CALL h5get_libversion_f(majnum, minnum, relnum, total_error) IF(total_error .EQ. 0) THEN WRITE(*, '(" FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO") - WRITE(*, '(I1)', advance="NO") majnum + WRITE(*, '(I0)', advance="NO") majnum WRITE(*, '(".")', advance="NO") - WRITE(*, '(I1)', advance="NO") minnum + WRITE(*, '(I0)', advance="NO") minnum WRITE(*, '(" release ")', advance="NO") - WRITE(*, '(I3)') relnum + WRITE(*, '(I0)') relnum ELSE total_error = total_error + 1 ENDIF -- cgit v0.12 From 97ac37592b75b1f799f9b24a71ced0fa85925086 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 22 May 2017 15:45:17 -0500 Subject: Fix for shared fortran libraries on mac (HDFFV-2772). --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index 458a3d2..d8e9b9e 100644 --- a/configure.ac +++ b/configure.ac @@ -3482,6 +3482,12 @@ chmod 755 tools/src/misc/h5cc if test "X$HDF_FORTRAN" = "Xyes"; then chmod 755 fortran/src/h5fc + ## tell libtool to pass the correct argument linker, needed only for intel compiler. + case "`uname`" in + Darwin*) + cat libtool | awk '/wl=\"/{c++;if(c==3){sub("wl=\"\"","wl=\"-Wl,\"");c=0}}1' > libtool.tmp && mv libtool.tmp libtool && chmod 755 libtool + ;; + esac fi if test "X$HDF_CXX" = "Xyes"; then -- cgit v0.12 From 6301d5a6cb7527f7f2eed0d60d1faaf154ed9976 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 22 May 2017 16:03:56 -0500 Subject: Fix for shared fortran libraries on mac (HDFFV-2772). --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d8e9b9e..b6f37bc 100644 --- a/configure.ac +++ b/configure.ac @@ -3482,10 +3482,11 @@ chmod 755 tools/src/misc/h5cc if test "X$HDF_FORTRAN" = "Xyes"; then chmod 755 fortran/src/h5fc - ## tell libtool to pass the correct argument linker, needed only for intel compiler. + ## tell libtool to pass the correct argument linker, needed only for intel compiler. This script + ## replaces the 3rd occurance, which is for Fortran, of wl="" with wl="-Wl," case "`uname`" in Darwin*) - cat libtool | awk '/wl=\"/{c++;if(c==3){sub("wl=\"\"","wl=\"-Wl,\"");c=0}}1' > libtool.tmp && mv libtool.tmp libtool && chmod 755 libtool + cat libtool | awk '/wl=\"/{c++;if(c==3){sub("wl=\"\"","wl=\"-Wl,\"");c=0}}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool ;; esac fi -- cgit v0.12 From 69ccaee00a2778c7334587b6f6d51e16ff674ec9 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Tue, 23 May 2017 09:53:59 -0500 Subject: add documention comments for shared Fortran Fix on OSX --- configure.ac | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index b6f37bc..9695fe3 100644 --- a/configure.ac +++ b/configure.ac @@ -918,12 +918,13 @@ H5_FORTRAN_SHARED="no" if test "X${HDF_FORTRAN}" = "Xyes" && test "X${enable_shared}" != "Xno"; then AC_MSG_CHECKING([if shared Fortran libraries are supported]) H5_FORTRAN_SHARED="yes" - - ## tell libtool to do the right thing with COMMON symbols + ## tell libtool to do the right thing with COMMON symbols, this fixes + ## corrupt values with COMMON and EQUIVALENCE when building shared + ## Fortran libraries on OSX with gnu and Intel compilers (HDFFV-2772). case "`uname`" in Darwin*) H5_LDFLAGS="$H5_LDFLAGS -Wl,-commons,use_dylibs" - ;; + ;; esac ## Report results of check(s) @@ -3482,8 +3483,9 @@ chmod 755 tools/src/misc/h5cc if test "X$HDF_FORTRAN" = "Xyes"; then chmod 755 fortran/src/h5fc - ## tell libtool to pass the correct argument linker, needed only for intel compiler. This script - ## replaces the 3rd occurance, which is for Fortran, of wl="" with wl="-Wl," + ## libtool does not pass the correct argument linker (wl=) for the Intel Fortran compiler + ## on OS X, which is needed when building shared libraries on OS X. This script + ## replaces the 3rd occurrence, which is for Fortran, of wl="" with wl="-Wl," (HDFFV-2772) case "`uname`" in Darwin*) cat libtool | awk '/wl=\"/{c++;if(c==3){sub("wl=\"\"","wl=\"-Wl,\"");c=0}}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool -- cgit v0.12 From 57ab1e7d6945c45107ebdd945bb89951ec90b8f1 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Tue, 23 May 2017 17:14:21 -0500 Subject: add linking flag to cmake, does not fix the issue, still disabled shared with fortran --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce91052..b84cc7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -851,6 +851,11 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for option (SKIP_HDF5_FORTRAN_SHARED "Do not build the fortran shared libraries" OFF) if (HDF5_BUILD_FORTRAN) if (BUILD_SHARED_LIBS AND APPLE) + # Tell cmake to do the right thing with COMMON symbols, this fixes + # corrupt values with COMMON and EQUIVALENCE when building shared + # Fortran libraries on OSX with gnu and Intel compilers (HDFFV-2772). + # *** NOTE: Fix does not work with Cmake. *** + # set (HDF5_LINKER_FLAGS "-Wl,-commons,use_dylibs") if (NOT ALLOW_UNSUPPORTED) message (STATUS " **** Shared FORTRAN libraries are unsupported **** ") set (SKIP_HDF5_FORTRAN_SHARED ON) -- cgit v0.12