From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32125 invoked by alias); 30 Jan 2002 02:22:34 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 32066 invoked from network); 30 Jan 2002 02:22:33 -0000 Received: from unknown (HELO relay.pair.com) (209.68.1.20) by sources.redhat.com with SMTP; 30 Jan 2002 02:22:33 -0000 Received: (qmail 88478 invoked from network); 30 Jan 2002 02:22:32 -0000 Received: from we-24-126-75-99.we.mediaone.net (HELO kegel.com) (24.126.75.99) by relay1.pair.com with SMTP; 30 Jan 2002 02:22:32 -0000 X-pair-Authenticated: 24.126.75.99 Message-ID: <3C575A3A.3959C53C@kegel.com> Date: Tue, 29 Jan 2002 18:22:00 -0000 From: Dan Kegel X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.7-10 i686) X-Accept-Language: en MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb@sources.redhat.com Subject: Re: How does one cross-compile gdbserver? References: <3C574C25.8A2F007@kegel.com> <20020129205052.B19879@nevyn.them.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-01/txt/msg00342.txt.bz2 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=, 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