Bug 1196527

Summary: %optflags in opensaml.pc
Product: [Fedora] Fedora Reporter: Ralf Corsepius <rc040203>
Component: opensamlAssignee: Guido Grazioli <guido.grazioli>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: bruno, guido.grazioli
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 12:52:57 UTC 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:
Bug Depends On: 1196914    
Bug Blocks: 1196917, 1196918    

Description Ralf Corsepius 2015-02-26 07:47:00 UTC
Description of problem:

/usr/lib64/pkgconfig/opensaml.pc
contains %optflags and %__global_ldflags in cflags and libs.

Packages are not supposed to add %optflags or %__global_ldflags to *.pcs.

Version-Release number of selected component (if applicable):
opensaml-devel-2.4.3-9.fc22

Steps to Reproduce:
1. Check the rpm's contents

Actual results:
...
Libs: -L${libdir} -Wl,-z,relro -lxmltooling -lxml-security-c -lxerces-c -L/usr/lib64 -llog4cpp -lnsl -lz -lsaml
Cflags: -I${includedir} -pthread -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
...


Additional info:
I haven't checked other fedora releases, but I assume this issue to be present there, too.

Comment 1 Guido Grazioli 2015-02-26 11:18:11 UTC
Thanks for the report. I am working on updating xmltooling and opensaml to latest version on rawhide, and I'll address this too.

I guess: 

Libs: -L${libdir} -Wl,-z,relro -lxmltooling -lxml-security-c -lxerces-c -L/usr/lib64 -llog4cpp -lnsl -lz -lsaml

would have to be:

Libs: -L${libdir} -lxmltooling -lsaml
Libs.private: -lxml-security-c -lxerces-c -llog4cpp -lnsl -lz 

Please correct me if I am wrong, I am not usually a pkgconfig user.

Comment 2 Ralf Corsepius 2015-02-26 13:35:04 UTC
(In reply to Guido Grazioli from comment #1)
> Thanks for the report. I am working on updating xmltooling and opensaml to
> latest version on rawhide, and I'll address this too.
> 
> I guess: 
> 
> Libs: -L${libdir} -Wl,-z,relro -lxmltooling -lxml-security-c -lxerces-c
> -L/usr/lib64 -llog4cpp -lnsl -lz -lsaml
> 
> would have to be:
> 
> Libs: -L${libdir} -lxmltooling -lsaml
> Libs.private: -lxml-security-c -lxerces-c -llog4cpp -lnsl -lz 
> 
> Please correct me if I am wrong, I am not usually a pkgconfig user.
I am not sure either. 

Likely there 2 separate issues interacting simultaneously here 
a) libs vs. libs.private + require vs. require.private
and
b) optflags, __global_ldflags incorrectly getting propagated into *.pcs.

I am only referring to the latter issue. The problem with these is they are restricting usability/generality of a package, because *.pc are only supposed to take package-specific flags and not user-specified values.

From a packaging point of view, packages which are propagating CFLAGS/LDFLAGS to *.pcs suffer from a broken configuration, which does not properly separate package and user configuration.

To work-around this issue in rpms, in many cases, simply sed-ing these values out from *.pc does the job:

E.g. presuming a XXXX.pc is generated by an autoconf-based configure script:

%configure ...
sed -i -e "s|%{optflags}||;s|%{__global_ldflags}||" XXXX.pc

Comment 3 Fedora End Of Life 2016-07-19 12:52:57 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.