Bug 646884 - 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'
Summary: kudzu fails to build after pciutils rebase: libpci.a(names-net.o): In functio...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: pciutils
Version: 5.6
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-26 14:46 UTC by Michal Nowak
Modified: 2013-03-08 02:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-13 22:38:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0045 0 normal SHIPPED_LIVE pciutils enhancement and bug fix update 2011-01-12 16:04:40 UTC

Description Michal Nowak 2010-10-26 14:46:49 UTC
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 14:55:47 UTC
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 14:14:57 UTC
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 16:04:33 UTC
(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 06:46:14 UTC
(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 22:38:01 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 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


Note You need to log in before you can comment on or make changes to this bug.