Compile HDF5 Library in MultiThreadedDebug, doubts about libaec

Hi,

really glad to have found this community, hope I’ll find some help.
I’m trying so hard to compile the HDF5 Library via CMake but I’ve come up short.
I’ve downloaded libaec and zlib and built those via CMake GUI (CMAKE_MSVC_RUNTIME_LIBRARY = MultiThreadedDebug).
I wasn’t able to link libaec at first since I’m using MSVC and had to force HIDE_VISIBILITY = 0 and C_STANDARD 11.
Still I’m not sure about what SZIP libraries I’ve to link in the CMake GUI since I have sz.lib, aec.lib, aec-static.lib, etc.
I was able to configure and generate a solution (.sln) to compile via VS 17 2022 but ended up in LINK2019 errors related to _imp_SZ_Encoded and _imp_BuffToBuff methods.

Thanks a ton in advance, any help would be really appreciated! :slight_smile:

Hi, @danieleleo.tutor !

Have you tried vcpkg by Microsoft?

The following 4 lines on Command Prompt will install hdf5 with libaec:

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg install hdf5

I’ve not tried to do that…as far as I know that should be the Library MultiThread (Release) version

I think they install both debug & release by default:

  c:/Users/JoeLee/tmp/vcpkg/installed/x64-windows:
  drwxrwxrwx  1 JoeLee JoeLee     0 05-01 23:28 ..
  drwxrwxrwx  1 JoeLee JoeLee     0 05-02 00:18 .
  drwxrwxrwx  1 JoeLee JoeLee  4096 05-02 00:18 bin
  drwxrwxrwx  1 JoeLee JoeLee     0 05-01 23:29 debug
  drwxrwxrwx  1 JoeLee JoeLee 12288 05-02 00:18 include
  drwxrwxrwx  1 JoeLee JoeLee  4096 05-02 00:18 lib
  drwxrwxrwx  1 JoeLee JoeLee  4096 05-02 00:18 share
  drwxrwxrwx  1 JoeLee JoeLee     0 05-02 00:18 tools

“Also note that the Windows binary distributions are built in Release mode with debugging symbols.”

This is what I get from the Download page on The HDF Group website. What am I missing?
Also, I’m trying to compile statically in MultiThreadedDebug.

I managed to compile via CMake using MSVC:

  • compiled ZLIB adding CMAKE_MSVC_RUNTIME_LIBRARY = MultiThreadedDebug directly in the CMake GUI

  • compiled libaec first forcing C11 on MSVC, then setting HAVE_VISIBILITY OFF. Also, hardcoded PATHS to search for libraries in the cmake_config file. Finally set MultiThreadedDebug as above.

  • lastly compiled HDF5 by first telling CMake to use the static libraries for both ZLIB and libaec (there are variables named HDF5_USE_ZLIB_STATIC and HDF5_USE_SZIP_STATIC). Remember to link aec-static.lib against libaec_LIBRARY and szip_static.lib against SZIP_LIBRARY.
    Finally set MultiThreadedDebug as above.

I’ve now run into an issue linked to __imp_StrStrIA and I’m completely lost.
There shouldn’t be any _imp whatsoever having statically compiled everything…any idea?

hdf5 needs the windows library “shlwapi”, see ConfigureChecks.cmake file;

if (WINDOWS)
  CHECK_INCLUDE_FILE_CONCAT ("shlwapi.h"         ${HDF_PREFIX}_HAVE_SHLWAPI_H)
  # Checking for StrStrIA in the library is not reliable for mingw32 to stdcall
  set (LINK_PUB_LIBS ${LINK_PUB_LIBS} "shlwapi")
endif ()