* [Buildroot] generating gdb for the target
@ 2009-03-18 12:47 Ruttmann
0 siblings, 0 replies; 3+ messages in thread
From: Ruttmann @ 2009-03-18 12:47 UTC (permalink / raw)
To: buildroot
Hello,
i had some difficulties in using the GDB on the target. The first message
was "Sorry Dave, i can't do that, unknown symbol format elf32-i386"
After some research i found the advice that the readelf.o object is missing,
so the debugger isn't able to read the object file.
In the gdb/config.log i found the test "checking for ELF support in BFD"
which fails because of an unresolved symbol to __lxstat in libiberty.
The base problem was the library include order: the gdb want's to link
against it's own libiberty.a but the order is
<buildroot>/build_i386/staging_dir/lib
<buildroot>/build_i386/staging_dir/usr/lib
../bfd
../libiberty
so the libiberty.a from <buildroot>/build_i386/staging_dir/usr/lib is used
which is linked against the libc of the host system.
After moving the local directories before the staging directories by
modifying the <buildroot>/toolchain_build_i386/gdb-6.8/gdb/configure, the
"checking for ELF support in BFD" was successful, the readelf.o was included
and gdb works like a dream on the target.
Hope this helps someone, maybe the gdb developers can change the library
order or the buildroot team can create a patch to do that.
--
View this message in context: http://www.nabble.com/generating-gdb-for-the-target-tp22556796p22556796.html
Sent from the BuildRoot mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] generating gdb for the target
@ 2010-03-11 13:36 Craig Lawton-Devine
2010-03-11 16:45 ` Craig Lawton-Devine
0 siblings, 1 reply; 3+ messages in thread
From: Craig Lawton-Devine @ 2010-03-11 13:36 UTC (permalink / raw)
To: buildroot
Hi,
Thanks for your post
(http://lists.busybox.net/pipermail/buildroot/2009-March/026585.html),
I'm sure it saved me a great deal of time trying to find the cause of
the problem on my system.
Unfortunately I haven't been able to solve it yet though (despite your
detailed post) as things have moved on since then.
To confirm it is the same problem here's a snippet from
./output/build/gdb-6.8-target/gdb/config.log:
configure:23001: checking for ELF support in BFD
configure:23025:
/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/usr/bin/i386-linux-uclibc-gcc
-Os -pipe -Os -I/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/usr/include
-I/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/include
--sysroot=/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/
-isysroot /home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging
-mtune=i386 -march=i386 -o conftest -Os -pipe -Os
-I/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/usr/include
-I/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/include
--sysroot=/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/
-isysroot /home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging
-mtune=i386 -march=i386
-L/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/lib
-L/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/usr/lib
--sysroot=/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/
-Wno-error -I/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/toolchain/gdb-6.8/gdb/../include
-I../bfd -I/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/toolchain/gdb-6.8/gdb/../bfd
-L../bfd -L../libiberty conftest.c -lbfd -liberty -lncurses -lm
>&5
/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/usr/lib/libiberty.a(cplus-dem.o):
In function `strtol':
/usr/include/stdlib.h:336: undefined reference to `__strtol_internal'
/home/craig/buildroot-attempt-20100302/buildroot-2010.02/output/staging/usr/lib/libiberty.a(unlink-if-ordinary.o):
In function `lstat':
/usr/include/sys/stat.h:443: undefined reference to `__lxstat'
collect2: ld returned 1 exit status
As you can see the library search path is:
output/staging/lib
output/staging/usr/lib
../bfd
../libiberty
So I altered output/toolchain/gdb-6.8/gdb/configure around line 23001
(# Add ELF support to GDB, but only if BFD includes ELF support) as
follows:
-LDFLAGS="$LDFLAGS -L../bfd -L../libiberty"
+LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
-LIBS="$LIBS -lbfd -liberty $intl"
+LIBS="-lbfd -liberty $intl $LIBS"
and then
rm output/build/gdb-6.8-target/.configured
rm output/build/gdb-6.8-target/gdb/config.cache
make
Unfortunately this resulted in the same "Symbol format `elf32-i386'
unknown." error when running gdb on the target.
So I either have not triggered the re-build properly with the altered
'configure' script or the change I made was incorrect.
I'd really appreciate if you or someone else can point me in the right
direction, as I'm beginner at buildroot.
Thanks again for your original post!
Regards,
Craig Lawton-Devine
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] generating gdb for the target
2010-03-11 13:36 Craig Lawton-Devine
@ 2010-03-11 16:45 ` Craig Lawton-Devine
0 siblings, 0 replies; 3+ messages in thread
From: Craig Lawton-Devine @ 2010-03-11 16:45 UTC (permalink / raw)
To: buildroot
I have managed to circumvent this problem, it's nasty and I don't
recommend it but it worked for me.
Look in: output/build/gdb-6.8-target/gdb/config.cache
and make the following change:
gdb_cv_var_elf=${gdb_cv_var_elf=no}
gdb_cv_var_elf=${gdb_cv_var_elf=yes}
then:
rm output/build/gdb-6.8-target/.configured
make
and you should find that gdb will now work on the target.
Craig
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-11 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-18 12:47 [Buildroot] generating gdb for the target Ruttmann
-- strict thread matches above, loose matches on Subject: below --
2010-03-11 13:36 Craig Lawton-Devine
2010-03-11 16:45 ` Craig Lawton-Devine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox