Bug 190518

Summary: Changes in gcc break libxml2 compilation
Product: Red Hat Enterprise Linux 4 Reporter: Bastien Nocera <bnocera>
Component: gccAssignee: Daniel Veillard <veillard>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: jakub, tao
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0195 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-01 22:45:59 UTC Type: ---
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:    
Bug Blocks: 234547    
Attachments:
Description Flags
Patch fixing the spec file to avoid the linking problem none

Description Bastien Nocera 2006-05-03 08:53:28 UTC
gcc-3.4.5-2

While recompile libxml2-2.6.16-6:

/bin/sh ./libtool --mode=link gcc  -O2 -g -pipe -m32 -march=i386 -mtune=pentium4
-fprofile-generate -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type
-Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized
-Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-Winline -Wredundant-decls   -o xmllint  xmllint.o ./libxml2.la -lpthread -lz  -lm
gcc -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -fprofile-generate -pedantic
-W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs
-Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow
-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline
-Wredundant-decls -o .libs/xmllint xmllint.o  ./.libs/libxml2.so -lpthread -lz -lm
/usr/bin/ld: .libs/xmllint: hidden symbol `__gcov_merge_single' in
/usr/lib/gcc/i386-redhat-linux/3.4.5/libgcov.a(_gcov_merge_single.o) is
referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[2]: *** [xmllint] Error 1
make[2]: Leaving directory `/home/bnocera/Projects/packages/BUILD/libxml2-2.6.16'

Work-around is to disable profiling in the libxml2 spec file:
     77 if [ $GCC_VERSION -ge 34 ]
    78 then
    79     PROF_GEN='-fprofile-generate'
    80     PROF_USE='-fprofile-use'
    81 fi

Comment 1 Jakub Jelinek 2006-05-03 09:05:20 UTC
That sounds like libxml2 bug.
From the above error message it sounds like ./.libs/libxml2.so was compiled
with -fprofile-generate (well, at least one of the source files for that
library), yet when libxml2.so was linked, gcc was not given the needed
-fprofile-generate option, therefore -lgcov was not linked in.
I have verified that gcc 3.4.5-2 driver adds -lgcov whenever linking with
-fprofile-generate, so I'm very sure the bug is not on the gcc side.

Comment 2 Daniel Veillard 2006-05-03 09:21:55 UTC
The spec file does:

if [ $GCC_VERSION -ge 34 ]
then
    PROF_GEN='-fprofile-generate'
    PROF_USE='-fprofile-use'
fi

if [ "$PROF_GEN" != "" ]
then
    # First generate a profiling version
    CFLAGS="${RPM_OPT_FLAGS} ${PROF_GEN}"  %configure
    make

that used to work, that breaks now, I didn't changed anything.

Daniel

Comment 3 Jakub Jelinek 2006-05-03 09:28:59 UTC
If it doesn't use those flags when linking the shared library, then it is broken.
If it worked before, it was by pure accident.

Comment 4 Bastien Nocera 2006-05-03 09:42:18 UTC
Reopening and reassigning to libxml2 for fixing.

Comment 5 Daniel Veillard 2006-05-03 10:11:58 UTC
It's not used in Fedora. Only in RHEL4 package, where fixing means a respin
and I'm not try to do that unless everybody needed to get such a push line up
saying it's needed...

Daniel

Comment 8 Daniel Riek 2006-08-29 14:31:02 UTC
The component of this request is planned to be updated in Red Hat enterprise
Linux 4.5.

This enhancement request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux maintenance release.

Product Management has requested further review of this request by Red Hat
Engineering, for potential inclusion in a Red Hat Enterprise Linux Update
release for currently deployed products.

This request is not yet committed for inclusion in an Update release. 

Comment 10 Daniel Veillard 2006-12-11 17:28:04 UTC
The following patch seems to fix the link problem while keeping the profiling
in the spec, and work on my RHEL-4 U4 i386 box,

Daniel

Comment 11 Daniel Veillard 2006-12-11 17:29:29 UTC
Created attachment 143305 [details]
Patch fixing the spec file to avoid the linking problem

Comment 13 Daniel Veillard 2006-12-12 11:10:51 UTC
452596 build (dist-4E-qu-candidate, RHEL-4:libxml2-2_6_16-8)

A version with the fix has been built in dist-4E-qu-candidate,
but profiling has been deactivated for s390 since build with profiling
breaks on that platform.

Daniel

Comment 17 Red Hat Bugzilla 2007-05-01 22:45:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0195.html