FS#58150 - [hdf5] build with cmake need keep static libs in the package

Attached to Project: Community Packages
Opened by Gustavo Alvarez (sl1pkn07) - Friday, 06 April 2018, 22:51 GMT
Last edited by Bruno Pagani (ArchangeGabriel) - Tuesday, 25 September 2018, 10:27 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Ronald van Haren (pressh)
Bruno Pagani (ArchangeGabriel)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No


build hdf5 with cmake needs keep static libs in the package because not exist any option for disable it like if build with autotools

by default, hdf5 build with cmake builds static and shared libs in the same time. only can disable shared libs with -DBUILD_SHARED_BUILDS, enabled by default

if not. projects like freecad can't find hdf5 requeriemts

- Checking for one of the modules 'hdf5-serial'
CMake Error at /usr/share/cmake/hdf5/hdf5-targets.cmake:293 (message):
The imported target "hdf5::hdf5_tools-static" references the file


but this file does not exist. Possible reasons include:

* The file was deleted, renamed, or moved to another location.

* An install or uninstall procedure did not complete successfully.

* The installation package was faulty and contained


but not all the files it references.

Call Stack (most recent call first):
/usr/share/cmake/hdf5/hdf5-config.cmake:138 (include)
/usr/share/cmake-3.10/Modules/FindHDF5.cmake:449 (find_package)
CMakeLists.txt:700 (find_package)

-- Configuring incomplete, errors occurred!

keep static libs with options=('staticlibs') in the pkgbuild of hdf5 1.10.2-1 [testing] solve the problem

or open issue in upstream tracker issue about missing cmake option for disable static libs like do in autotools

This task depends upon

Closed by  Bruno Pagani (ArchangeGabriel)
Tuesday, 25 September 2018, 10:27 GMT
Reason for closing:  Fixed
Additional comments about closing:  1.10.3-2 in repos bundles the best of both CMake and autotools builds.
Comment by Gustavo Alvarez (sl1pkn07) - Saturday, 07 April 2018, 00:30 GMT
only as note, python-h5py and netcdf needs rebuild with hdf5 from testing ('im not sure if need others, only test the freecad dependencies)
Comment by Bruno Pagani (ArchangeGabriel) - Sunday, 08 April 2018, 19:04 GMT
Seems I missed an ABI bump because upstream did strange things w.r.t. .so numbers.

I’m opening a ticket with them regarding the multiple differences (and thus issues) between autotools and CMake build, however I’m not really decided about what to do here. If I keep the static libs, how will FreeCAD behave: compile with static libs or shared ones?
Comment by Gustavo Alvarez (sl1pkn07) - Sunday, 08 April 2018, 19:20 GMT
freecad is builded with shared libs

└───╼ ldd * | grep hd
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007f83c3e51000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007f83c3828000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007f08becfe000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007f08be6d5000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007fd6ba191000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007fd6b9a1f000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007f2621113000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007f26209a1000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007efe30817000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007efe300a5000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007f308997e000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007f3089355000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007f1bd6d1a000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007f1bd65a8000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007f87ba4a2000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007f87b9e79000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007f484e8ab000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007f484e139000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007fd8cfaa5000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007fd8cf47c000)
libhdf5.so.101 => /usr/lib/libhdf5.so.101 (0x00007fe6ec77e000)
libhdf5_hl.so.101 => /usr/lib/libhdf5_hl.so.101 (0x00007fe6ec210000)

the preblem is in cmake files generated by hdf5 installation (used by freecad or anhoter project with hdf5 as need). spect both lib types

in the file usr/share/cmake/hdf5/hdf5-config.cmake

set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES hdf5-static;hdf5-shared;hdf5_tools-static;hdf5_tools-shared;hdf5_hl-static;hdf5_hl-shared;hdf5_f90cstub-static;hdf5_f90cstub-shared;hdf5_fortran-static;hdf5_fortran-shared;hdf5_hl_f90cstub-static;hdf5_hl_f90cstub-shared;hdf5_hl_fortran-static;hdf5_hl_fortran-shared;hdf5_cpp-static;hdf5_cpp-shared;hdf5_hl_cpp-static;hdf5_hl_cpp-shared)

and in the file usr/share/cmake/hdf5/hdf5-targets.cmake

foreach(_expectedTarget hdf5::hdf5-static hdf5::hdf5-shared hdf5::hdf5_tools-static hdf5::hdf5_tools-shared hdf5::h5diff hdf5::h5diff-shared hdf5::h5ls hdf5::h5ls-shared hdf5::h5debug hdf5::h5repart hdf5::h5mkgrp hdf5::h5clear hdf5::h5import hdf5::h5repack hdf5::h5repack-shared hdf5::h5jam hdf5::h5unjam hdf5::h5copy hdf5::h5copy-shared hdf5::h5stat hdf5::h5stat-shared hdf5::h5dump hdf5::h5dump-shared hdf5::h5format_convert hdf5::hdf5_hl-static hdf5::hdf5_hl-shared hdf5::gif2h5 hdf5::h52gif hdf5::h5watch hdf5::hdf5_f90cstub-static hdf5::hdf5_f90cstub-shared hdf5::hdf5_fortran-static hdf5::hdf5_fortran-shared hdf5::hdf5_hl_f90cstub-static hdf5::hdf5_hl_f90cstub-shared hdf5::hdf5_hl_fortran-static hdf5::hdf5_hl_fortran-shared hdf5::hdf5_cpp-static hdf5::hdf5_cpp-shared hdf5::hdf5_hl_cpp-static hdf5::hdf5_hl_cpp-shared)

this is a little snip. this cmake files contains a tons of static libs references

instead of remove those tons of references by hand, is better keep the static libs

or switch again to autotools until the upstream add a cmake option for disable the static libs (if no exist, idk if is can disable by internal cmake option)

Comment by Bruno Pagani (ArchangeGabriel) - Sunday, 08 April 2018, 20:22 GMT
I’ll keep the static libs then. Reverting to auto-tools means not providing any CMake file at all, as well as not pkg-config file either. Yes, that’s right, the autotools version does not provides them, but it does provide the example files and a way to disable static libs (which we might want to keep after all), which the CMake one does not…

I’ll delete the -testing package tomorrow and publish new builds in staging for the ABI bump, with static libs included.
Comment by Bruno Pagani (ArchangeGabriel) - Monday, 09 April 2018, 13:55 GMT

CMake build:

Autotools build:

I will revert to autotools then, pkgconfig file will be manually provided for now.
Comment by Bruno Pagani (ArchangeGabriel) - Wednesday, 09 May 2018, 18:53 GMT
Well, this is now blocked by failure to build with GCC 8.1…