0

我正在尝试从MIPS32架构的源代码交叉编译 GDB 服务器的一个版本。我正在使用 x86_64 机器。

我正在为( )使用 BuildrootuClibc编译器。MIPSmips-buildroot-linux-uclibc-gcc

从 GDB 服务器目录我运行./configure命令:

./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

拥有$CROSS价值mips-buildroot-linux-uclibc-

./configure运行,但我注意到它提到的输出中checking whether we are cross compiling... no。我似乎没有./configure意识到我正在尝试交叉编译。

然后我运行make LDFLAGS=-static它会产生错误:

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

我读到您可以删除lthread_dbGDB 服务器中的依赖项,makefile但是我需要调试线程应用程序。

如何MIPS32使用 Buildroot 交叉编译工具集为体系结构交叉编译 GDB 服务器?

4

1 回答 1

1

由于无论如何您都是使用 Buildroot 构建工具链,因此最简单的方法是也使用 Buildroot 构建 gdbserver。

  • BR2_PTHREAD_DEBUG确保您在工具链菜单中启用了线程库调试 ( )。
  • 从目标包中选择 gdb -> 调试。然后默认选择 gdbserver。您不需要完整的 gdb。
  • 您显然想要一个静态可执行文件,因此请从 Build options -> libraries 中选择 Static only。

这应该给你一个静态链接的 gdbserver 可执行文件。

请注意,如果您更改工具链选项(线程库调试、静态库),则必须使用make clean; make.

于 2018-05-10T11:15:52.320 回答