-- Building for: Unix Makefiles
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: C:/msys64/mingw64 (found version "4.2.0")
-- Configuring done
CMake Error at CMakeLists.txt:3 (add_executable):
Target "hello" links to target "hdf5::hdf5-shared" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:3 (add_executable):
Target "hello" links to target "hdf5::hdf5_cpp-shared" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:3 (add_executable):
Target "hello" links to target "hdf5::hdf5-shared" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:3 (add_executable):
Target "hello" links to target "hdf5::hdf5_cpp-shared" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
I have build itk 5.1.0 with ITK_USE_SYSTEM_HDF5=ON. And now this project could be built, but fail to run. Error log:
D:/Projects/hello/build-system-hdf5/hello.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
It did not show me which lib is missing.
I also try ITK_USE_SYSTEM_HDF5=OFF, there is a file conflict (/mingw64/lib/libhdf5.settings) with hdf5 from the system. I manual remove it from the final itk pkg to avoid file conflict. I could build this helloworld project, but could not run it, with same error.
The build a hello world without worrying about determining the dependent libraries and setting up the run time environment to find them, build ITK independently from the MSYS package with its default build configuration. It will build ITK and third party static libraries that get embedded into the executable.
So you mean if I build itk with ITK_USE_SYSTEM_HDF5=OFF, then itk will build hdf5 and statically link to it. Then maybe itk should not install /mingw64/lib/libhdf5.settings to the system, right?
# Open an MSYS shell
git clone https://github.com/InsightSoftwareConsortum/ITK
cd ITK
git checkout v5.1.0
cd ..
mkdir ITK-build
cd ITK-build
cmake -GNinja -DBUILD_TESTING=OFF ../ITK
ninja
cd ..
cd hello-world-build
cmake -DITK_DIR=$PWD/../ITK-build -GNinja ../hello-world
ninja
Then maybe itk should not install /mingw64/lib/libhdf5.settings to the system, right?
Yes, this should not be the case if ITK_USE_SYSTEM_HDF5 is OFF.