Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1980549

Summary: h5cc passes through flags from package build process
Product: [Fedora] Fedora EPEL Reporter: taw-rhb
Component: hdf5Assignee: Orion Poplawski <orion>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: epel7CC: dakingun, igor.raits, orion, scitech-bugs, trpost
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description taw-rhb 2021-07-08 20:00:16 UTC
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: