用于MIPS32的Buildroot交叉编译GDB服务器

时间:2018-05-09 12:53:55

标签: makefile cross-compiling buildroot gdbserver uclibc

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

我正在使用Buildroot uClibc编译器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

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

如何使用Buildroot交叉编译工具集交叉编译MIPS32架构的GDB服务器?

1 个答案:

答案 0 :(得分:0)

既然您无论如何使用Buildroot构建工具链,最简单的方法是使用Buildroot构建gdbserver。

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

这应该为您提供静态链接的gdbserver可执行文件。

请注意,如果更改工具链选项(线程库调试,静态库),则必须使用make clean; make进行完全重建。