Bug 646884

Summary: kudzu fails to build after pciutils rebase: libpci.a(names-net.o): In function `pci_id_net_lookup': (.text+0x167): undefined reference to `__res_query'
Product: Red Hat Enterprise Linux 5 Reporter: Michal Nowak <mnowak>
Component: pciutilsAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED ERRATA QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.6CC: ddumas, notting, ohudlick
Target Milestone: rcKeywords: Rebase, Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 17:38:01 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Michal Nowak 2010-10-26 10:46:49 EDT
Description of problem:

kudzu-1.2.57.1.24-1, which buildrequires pciutils-devel, fails to build after 5.6 rebase of pciutils (and it's -devel sub-package) on various archs:

‣ i386, ia64, s390x

cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -I. -Wall -D_GNU_SOURCE -g -I. -DVERSION=\"1.2.57.1.24\"  hwconf.o  -o kudzu -L. -lkudzu -L. -lpci -Wl,-Bstatic -lpopt -Wl,-Bdynamic
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libpci.a(names-net.o): In function `pci_id_net_lookup':
(.text+0x167): undefined reference to `__res_query'
collect2: ld returned 1 exit status
make: *** [kudzu] Error 1

‣ x86_64

kudzumodule.c:68: warning: 'numClassEntries' defined but not used
kudzumodule.c:96: warning: 'numBusEntries' defined but not used
kudzumodule.c:104: warning: 'numModeEntries' defined but not used
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libpci.a(init.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libpci.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [_kudzumodule.so] Error 1

‣ ppc - infrastructure problems; result: N/A

Building against former pciutils-2.2.3-8.el5 works.

Version-Release number of selected component (if applicable):

kudzu-1.2.57.1.24-1
pciutils-3.1.7-2.el5

How reproducible:

always

Steps to Reproduce:
1. rebuild kudzu with new pciutils
  
Additional info:

- One might want to do the build in mock.

- There may be two problems the one with pci_id_net_lookup() and the one specific to x86_64 re -fPIC, feel free to divide to two bugs.
Comment 1 Bill Nottingham 2010-10-26 10:55:47 EDT
The one specific to -fPIC certainly needs fixed in pciutils; the library needs to be built with -fPIC.

The first could probably be relnoted such that 'any app that links against libpci now needs to link against libresolv'.
Comment 4 Michal Hlavinka 2010-10-27 10:14:57 EDT
1)(.text+0x167): undefined reference to `__res_query'

pciutils does not use pkg-config so the way how to fix this is just to append "-lresolv" to build line: 

cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -I. -Wall -D_GNU_SOURCE -g -I.
-DVERSION=\"1.2.57.1.24\"  hwconf.o  -o kudzu -L. -lkudzu -L. -lpci -lresolv

which I tested and it fixed the problem

2)/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libpci.a(init.o):
relocation R_X86_64_32S against `a local symbol' can not be used when making a
shared object; recompile with -fPIC

this is also odd, because pciutils provides only static library for which -fPIC should not be needed and also old version of pciutils did not use -fPIC

problem can be fixed if -fPIC is added to pciutils build or by modifying following kudzu's build command:

cc -o $ver/_kudzumodule.so $ver/kudzumodule.o -shared -Wl,soname,_kudzumodule.so -L. -lkudzu -lpci

just swap order of -lkudzu -lpci to -lpci -lkudzu
Comment 5 Bill Nottingham 2010-10-27 12:04:33 EDT
(In reply to comment #4)

> 2)/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libpci.a(init.o):
> relocation R_X86_64_32S against `a local symbol' can not be used when making a
> shared object; recompile with -fPIC
> 
> this is also odd, because pciutils provides only static library for which -fPIC
> should not be needed and also old version of pciutils did not use -fPIC

Yes, they did. See the changelog and the patches (pciutils-strip.patch is the one where this was set.)
Comment 6 Michal Hlavinka 2010-10-29 02:46:14 EDT
(In reply to comment #5)
> (In reply to comment #4)
> 
> > this is also odd, because pciutils provides only static library for which -fPIC
> > should not be needed and also old version of pciutils did not use -fPIC
> 
> Yes, they did. See the changelog and the patches (pciutils-strip.patch is the
> one where this was set.)

you're right, my bad, I did not expect that strip patch would contain this
Comment 12 errata-xmlrpc 2011-01-13 17:38:01 EST
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 therefore 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/RHEA-2011-0045.html