【问题标题】:Buildroot Cross Compiling GDB Server for MIPS32Buildroot 为 MIPS32 交叉编译 GDB 服务器
【发布时间】:2018-10-19 14:30:46
【问题描述】:

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

我正在为 MIPS (mips-buildroot-linux-uclibc-gcc) 使用 Buildroot uClibc 编译器。

我从 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 服务器 makefile 中的 lthread_db 依赖项,但是我需要调试线程应用程序。

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

【问题讨论】:

  • 您确定configure 脚本的--host 选项不是您的主机PC?
  • @RenaudPacalet 不,那是 --build。但是,@CS-Student,您也应该传递 --target=mips-buildroot-linux-uclibc 。这应该可以解决您的checking whether we are cross compiling... 问题。

标签: makefile cross-compiling buildroot gdbserver uclibc


【解决方案1】:

既然你还是用 Buildroot 构建了工具链,最简单的方法就是用 Buildroot 构建 gdbserver。

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-26
    • 1970-01-01
    • 1970-01-01
    • 2013-09-13
    • 2021-10-26
    相关资源
    最近更新 更多