Bug 4868

Summary: Buildroot compile failure for toolchain/gdb-7.4/intl/relocatable.c
Product: buildroot Reporter: Peter Seiderer <ps.report>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: buildroot
Priority: P5    
Version: 2012.02   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: buildroot config file
Fix gdb-7.4 intl relocation.c compile failure.
Fix gdb-7.4 intl relocatable.c compile failure.

Description Peter Seiderer 2012-03-06 19:02:06 UTC
Created attachment 4082 [details]
buildroot config file

Attached a fix/patch for the following compile failure with buildroot and gdb-7.4 (.config file attached):

make[3]: Entering directory `/tmp//build-001/build/gdb-7.4-target/libiberty'
make[4]: Entering directory `/tmp//build-001/build/gdb-7.4-target/libiberty/testsuite'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/tmp//build-001/build/gdb-7.4-target/libiberty/testsuite'
make[3]: Leaving directory `/tmp//build-001/build/gdb-7.4-target/libiberty'
make[3]: Entering directory `/tmp//build-001/build/gdb-7.4-target/intl'
rm -f stamp-h1
/bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
test -f config.h || (rm -f stamp-h1 && /usr/bin/make stamp-h1)
/tmp//build-001/host/usr/bin/x86_64-unknown-linux-uclibc-gcc -c  -pipe -Os -g2 -fPIC -DPIC -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Wno-error -DHAVE_CONFIG_H -DINSTALLDIR="\"/usr/lib\"" -I. -I/tmp//build-001/toolchain/gdb-7.4/intl /tmp//build-001/toolchain/gdb-7.4/intl/relocatable.c
/tmp//build-001/toolchain/gdb-7.4/intl/relocatable.c: In function ‘libintl_relocate’:
/tmp//build-001/toolchain/gdb-7.4/intl/relocatable.c:392:40: error: ‘INSTALLPREFIX’ undeclared (first use in this function)
/tmp//build-001/toolchain/gdb-7.4/intl/relocatable.c:392:40: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [relocatable.o] Error 1
make[3]: Leaving directory `/tmp//build-001/build/gdb-7.4-target/intl'
make[2]: *** [all-intl] Error 2
make[2]: Leaving directory `/tmp//build-001/build/gdb-7.4-target'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp//build-001/build/gdb-7.4-target'
make: *** [/tmp//build-001/build/gdb-7.4-target/gdb/gdb] Error 2
make: Leaving directory `/tmp//buildroot'


I think the relevant config options to hit this bug are:

BR2_PACKAGE_GDB=y
BR2_PACKAGE_GDB_SERVER=y
BR2_GDB_VERSION_7_4=y
BR2_GDB_VERSION="7.4"
BR2_ENABLE_LOCALE=y

Analysis: the Makefile for the gdb-7.4 embedded (lib-)intl fails to set a define for 'INSTALLPREFIX'.

Fix: see attached buildroot patch
Comment 1 Peter Seiderer 2012-03-06 19:04:57 UTC
Created attachment 4088 [details]
Fix gdb-7.4 intl relocation.c compile failure.
Comment 2 Peter Seiderer 2012-03-06 20:03:24 UTC
Created attachment 4094 [details]
Fix gdb-7.4 intl relocatable.c compile failure.

Fix typo on patch (relocation vs. relocatable).
Comment 3 Thomas Petazzoni 2013-05-26 13:51:09 UTC
Since commit 7ea1e92bdd9acf6cd5b021e61a18703e27885426, we're no longer passing -fPIC -DPIC when building on x86_64. So the particular piece of gdb code that was causing the build failure is no longer used because it is enclosed in #if defined PIC && defined INSTALLDIR.

Since the problem can no longer be hit when building gdb from Buildroot, I don't believe it's really worth carrying the gdb patch.

Thanks for your bug report! Do not hesitate to reopen if you disagree with the solution.