Description of problem: The compiler driver program 'h5cc' includes what appear to be the CFLAGS from the package build process. This causes problems because those flags include things which meaningfully change the interpretation of source code (-D_BSD_SOURCE), as well as other things that should be chosen by the user such as optimisation and debug flags (-O2, -g and others). I believe this happens because the HDF5 library's autotools build process copies CFLAGS into the output of h5cc. It expects H5_CFLAGS to be used instead, for flags to be used for building HDF5 itself but not to be passed through to h5cc. I noticed the problem because Meson uses the output of h5cc as one way to detect HDF5, in the absence of a pkg-config file. Stripping out the extra flags in Meson was discussed as a potential solution, but is really more of a band-aid/hacky solution: https://github.com/mesonbuild/meson/issues/8932 - see that issue for some more background. I believe this is exactly the same problem as reported and fixed earlier for Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1794625 Here's the fix used over there: https://src.fedoraproject.org/rpms/hdf5/c/6a442e16217e3eee5ecd670a57297c73cd81cdc5?branch=rawhide Version-Release number of selected component (if applicable): Version : 1.8.12 Release : 12.el7 How reproducible: 100% Steps to Reproduce: 1. Run h5cc -c -show Actual results: $ h5cc -c -show gcc -I/usr/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_BSD_SOURCE -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c Expected results: $ h5cc -c -show gcc -I/usr/include -c Additional info:
FEDORA-EPEL-2021-cac52e951e has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-cac52e951e
FEDORA-EPEL-2021-cac52e951e has been pushed to the Fedora EPEL 7 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-cac52e951e See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2021-cac52e951e has been pushed to the Fedora EPEL 7 stable repository. If problem still persists, please make note of it in this bug report.
The situation has improved, but there are still some incorrect flags in the h5cc output: $ rpm -q hdf5-devel hdf5-devel-1.8.12-13.el7.x86_64 $ /usr/bin/h5cc -c -show gcc -I/usr/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_BSD_SOURCE -c $ These (particularly -D_BSD_SOURCE) break programs trying to use the library. On a Fedora (35) system, there are no extra flags: $ rpm -q hdf5-devel hdf5-devel-1.10.7-2.fc35.x86_64 $ h5cc -c -show gcc -I/usr/include -c