CS Student
CS Student

Reputation: 1633

Buildroot Cross Compiling GDB Server for MIPS32

I'm trying to cross compile a version of GDB server from source for the MIPS32 architecture. I'm using an x86_64 machine.

I'm using the Buildroot uClibc compiler for MIPS (mips-buildroot-linux-uclibc-gcc).

From the GDB server directory I run the ./configure command:

./configure --host=mips-buildroot-linux-uclibc AR=${CROSS}ar LD=${CROSS}ld CC=${CROSS}gcc CXX=${CROSS}g++ RANLIB=${CROSS}ranlib LIBS=-L/root/Desktop/buildroot/buildroot-2018.02.2/output/host/lib

With $CROSS having the value mips-buildroot-linux-uclibc-

./configure runs but I noticed in the output it mentions checking whether we are cross compiling... no. It doesn't seem like ./configure is picking up that I'm trying to cross compile.

I then run make LDFLAGS=-static which produces the error:

ld: cannot find -lthread_db
collect2: error: ld returned 1 exit status
Makefile:379: recipe for target 'gdbserver' failed
make: *** [gdbserver] Error 1

I read that you can remove the lthread_db dependencies in the GDB server makefile however I need to debug threaded applications.

How can I cross compile GDB server for the MIPS32 architecture using the Buildroot cross compilation tool set?

Upvotes: 0

Views: 3324

Answers (1)

Arnout
Arnout

Reputation: 3464

Since you anyway build the toolchain with Buildroot, the easiest is to also build gdbserver with Buildroot.

  • Make sure you have Thread library debugging (BR2_PTHREAD_DEBUG) enabled in the toolchain menu.
  • Select gdb from Target packages -> Debugging. gdbserver is then selected by default. You don't need full gdb.
  • You apparently want a static executable, so select Static only from Build options -> libraries.

This should give you a statically linked gdbserver executable.

Note that if you change the toolchain options (Thread library debugging, static libraries), you have to do a full rebuild with make clean; make.

Upvotes: 1

Related Questions