From: Dan Kegel <dank@kegel.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb@sources.redhat.com
Subject: Re: How does one cross-compile gdbserver?
Date: Tue, 29 Jan 2002 18:22:00 -0000 [thread overview]
Message-ID: <3C575A3A.3959C53C@kegel.com> (raw)
In-Reply-To: <20020129205052.B19879@nevyn.them.org>
Daniel Jacobowitz wrote:
>
> On Tue, Jan 29, 2002 at 05:28:05PM -0800, Dan Kegel wrote:
> > I'm going crazy trying to build gdb 5.1.1's gdbserver
> > in a cross-development environment.
> >
> > Has anyone here build one recently?
> > If so, can you please post your recipe?
>
> Same way as anything else! You need to have a compiler capable of
> building target userland binaries, and a development environment set up
> for same. You may need to run configure in the gdbserver directory
> manually, with CC set appropriately. Note that you want a gdb
> configured --host=<your target>, not --target=<>!
>
> I don't give it good odds of compiling. I've tried several times to
> clean that up and gotten stymied in various people's objections to my
> methods (sorry Andrew). I'll be taking another stab at it this week I
> think.
Glad someone's working on it. (I'm hoping my company can funnel some
money to mvista soon. Every time I turn around, Montavista is doing things
that help us.)
All I'm trying to do is build
gdbserver to run on the embedded system. It appears that gdbserver
won't build unless you also build gdb *for the exact same environment*,
as it shares gdb's config.h, so I build a sacrificial gdb for the
embedded system even though I never plan to run gdb itself there.
(Just configuring it should be enough, but I think it turned
out I ran into trouble if I didn't actually build it.)
Here's what I'm doing at the moment, and where I get stuck. (This is
using Montavista Journeyman Linux 2.0 for the PowerPC 405, which does
not have floating point registers.)
1. Unpack gdb-5.1.1.
2. Apply three kludges to get around build problems:
Edit gdb/Makefile.in to keep gdb-all from building sim.
Edit gdb/low-linux.c to define NUM_FREGS 0 if it's not defined.
Edit gdb/low-linux.c to redefine BYTES_REGISTER to 32000 instead
of the nonconstant it has by default.
3. Build as follows:
mkdir nativeppc405
cd nativeppc405
CC=/opt/hardhat/devkit/ppc/405/bin/ppc_405-gcc CFLAGS="-mcpu=403" /bin/sh ../gdb-5.1.1/configure powerpc-foo-linux-gnu
CC=/opt/hardhat/devkit/ppc/405/bin/ppc_405-gcc CFLAGS="-mcpu=403" make all-gdb
cd ..
cd nativeppc405/gdb/gdbserver
CC=/opt/hardhat/devkit/ppc/405/bin/ppc_405-gcc CFLAGS="-mcpu=403" /bin/sh ../../../gdb-5.1.1/gdb/gdbserver/configure powerpc-foo-linux-gnu
CC=/opt/hardhat/devkit/ppc/405/bin/ppc_405-gcc CFLAGS="-mcpu=403" make
This works right up until it tries to link gdbserver, at which point it fails
with undefined symbols and bad relocations:
/opt/hardhat/devkit/ppc/405/bin/ppc_405-gcc -o gdbserver utils.o low-linux.o server.o remote-utils.o \
low-linux.o: In function `register_addr':
/home/dank/ixia/Software/Source/linux/3rdParty/gdb/nativeppc405/gdb/gdbserver/../../../gdb-5.1.1/gdb/gdbserver/low-linux.c:555: undefined reference to
`current_gdbarch'
/home/dank/ixia/Software/Source/linux/3rdParty/gdb/nativeppc405/gdb/gdbserver/../../../gdb-5.1.1/gdb/gdbserver/low-linux.c:555: undefined reference to
`current_gdbarch'
/home/dank/ixia/Software/Source/linux/3rdParty/gdb/nativeppc405/gdb/gdbserver/../../../gdb-5.1.1/gdb/gdbserver/low-linux.c:555: undefined reference to
`gdbarch_num_regs'
/home/dank/ixia/Software/Source/linux/3rdParty/gdb/nativeppc405/gdb/gdbserver/../../../gdb-5.1.1/gdb/gdbserver/low-linux.c:555: relocation truncated to fit:
R_PPC_REL24 gdbarch_num_regs
/home/dank/ixia/Software/Source/linux/3rdParty/gdb/nativeppc405/gdb/gdbserver/../../../gdb-5.1.1/gdb/gdbserver/low-linux.c:558: undefined reference to
`ppc_register_u_addr'
/home/dank/ixia/Software/Source/linux/3rdParty/gdb/nativeppc405/gdb/gdbserver/../../../gdb-5.1.1/gdb/gdbserver/low-linux.c:558: relocation truncated to fit:
R_PPC_REL24 ppc_register_u_addr
...
Any suggestions?
Thanks,
Dan
next prev parent reply other threads:[~2002-01-30 2:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-29 17:22 Dan Kegel
2002-01-29 17:50 ` Daniel Jacobowitz
2002-01-29 18:22 ` Dan Kegel [this message]
2002-01-29 19:24 ` Andrew Cagney
2002-01-29 19:38 ` Dan Kegel
2002-01-29 21:20 ` Andrew Cagney
2002-01-29 21:23 ` Daniel Jacobowitz
2002-01-29 20:33 ` Daniel Jacobowitz
2002-01-29 20:44 ` Dan Kegel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3C575A3A.3959C53C@kegel.com \
--to=dank@kegel.com \
--cc=drow@mvista.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox