linkage error with visual studio 2019 (with tmp solution)

Issue #134 new
Former user created an issue

Linkage error: missing symbol

https://bitbucket.org/fathomteam/moab/issues/127/moab-and-mingw64-msys2

file-handle.obj : error LNK2001: unresolved external symbol H5T_NATIVE_ULONG_g [D:\MyRepo\DAGMC_win_bld\moab\build\src\MOAB.vcxproj] file.obj : error LNK2001: unresolved external symbol H5T_NATIVE_ULONG_g [D:\MyRepo\DAGMC_win_bld\moab\build\src\MOAB.vcxproj]

    # this does not help
    if(MSVC)
        set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
    endif()

The reason is tracked downed as "libhdf5_cpp.lib" is not detected by cmake (although specify libraries via command line), modification of CMakeLists.txt seems solve the problem

HDF5 installation

official HDF5 v1.12.22 windows installation. binary package from conda has the headers, may also work, yet tested

    cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DENABLE_FORTRAN=OFF -DCMAKE_Fortran_COMPILER="D:\\Software\\mingw64\\bin\\gfortran.exe" -DENABLE_HDF5=ON -DHDF5_ROOT="C:\\Program Files\\HDF_Group\HDF5\\1.12.0" -DHDF5_INCLUDE_DIR="C:\\Program Files\\HDF_Group\HDF5\\1.12.0\\include"   -DENABLE_VTK=ON  -DVTK_VERSION="8.2" -DVTK_INCLUDE_DIR="D:\\MyRepo\\FreeCADbuild\\FreeCADLibs_12.1.4_x64_VC15\\vtk8.2\\include" -DVTK_LIBRARY_DIR="D:\\MyRepo\\FreeCADbuild\\FreeCADLibs_12.1.4_x64_VC15\\lib" -DHDF5_hdf5_LIBRARY_RELEASE="C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libhdf5_hl.lib;C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libhdf5.lib;C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libzlib.lib;C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libszip.lib;C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libhdf5_cpp.lib"
-- Could NOT find HDF5 (missing: HDF5_DIR)
-- ---   HDF5 Configuration ::
--         Directory    : C:/Program Files/HDF_Group/HDF5/1.12.0
--         IS_PARALLEL  : FALSE
--         INCLUDES     : C:/Program Files/HDF_Group/HDF5/1.12.0/include

--         LIBRARIES    : C:/Program Files/HDF_Group/HDF5/1.12.0/lib/hdf5_hl_fortran.lib;C:/Program Files/HDF_Group/HDF5/1.12.0/lib/hdf5_fortran.lib;C:/Program Files/HDF_Group/HDF5/1.12.0/lib/hdf5_hl.lib;C:/Program Files/HDF_Group/HDF5/1.12.0/lib/hdf5.lib;D:/Software/anaconda3/Library/lib/z.lib

CMake Warning (dev) at D:/Software/anaconda3/Library/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:426 (message):
  The package name passed to find_package_handle_standard_args (HDF5) does
  not match the name of the calling package (HDF5_MOAB).  This can lead to
  problems in calling code that expects find_package result variables
  (e.g., _FOUND) to follow a certain pattern.
Call Stack (most recent call first):
  config/FindHDF5_MOAB.cmake:164 (find_package_handle_standard_args)
  CMakeLists.txt:310 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

  Manually-specified variables were not used by the project:

    HDF5_hdf5_LIBRARY_RELEASE

Tmp solution

modify repo toplevel CMakeLists.txt

      find_package( HDF5_MOAB REQUIRED )
     #add following patch
      set(HDF5_LIBRARIES 
        "C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libhdf5_hl.lib"
        "C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libhdf5.lib"
        "C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libzlib.lib"
        "C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libszip.lib"
        "C:/Program Files/HDF_Group/HDF5/1.12.0/lib/libhdf5_cpp.lib"
        ) # monkey patch because find_package( HDF5_MOAB REQUIRED ) does not work properly on Windows
      set (MOAB_HAVE_HDF5 ON)

Comments (1)

  1. Log in to comment