首页 > 解决方案 > binutils-gdb 编译找不到 ncurses

问题描述

我正在尝试根据本教程为 i686-elf 目标编译 binutils:

我刚刚添加了该--enable-tui选项,以便我在 gdb 中获得支持。

我做了以下事情:

# get sources
git clone git://sourceware.org/git/binutils-gdb.git

# store settings
export PREFIX="`pwd`/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"

# create build folder
mkdir build-binutils
cd build-binutils

# run configure
../binutils-gdb/configure -target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror --enable-tui

# make
make

这会运行一段时间并以以下错误终止:

checking for library containing socketpair... (cached) none required
checking for ld used by GCC... (cached) ld
checking if the linker (ld) is GNU ld... (cached) yes
checking for shared library run path origin... (cached) done
checking for iconv... (cached) yes
checking for iconv declaration... (cached) 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for library containing waddstr... (cached) no
configure: error: no enhanced curses library found; disable TUI
make[1]: *** [Makefile:11329: configure-gdb] Error 1
make[1]: Leaving directory '/home/noexpandtab/dev/build-binutils'
make: *** [Makefile:853: all] Error 2

对我来说,似乎找不到 ncurses 库。

我有一个 Debian 10 正在运行并安装了以下附加软件包:

我必须安装额外的软件包吗?还是我错过了配置脚本的一些选项?

标签: compilationgdbncursesbinutils

解决方案


您正在交叉编译到与i686-elf您正在运行的任何架构不同的架构 ( ) —$TARGET问题中提到的。gdb 必须与为该架构构建的库链接。

Debian 提供了在当前架构上运行的ncurses 包,但没有为交叉编译的应用程序提供合适的包。所以你可以为自己做这件事。

交叉编译 ncurses 时,您必须记住它的一部分在当前架构上构建/运行(以生成源文件以供交叉编译器编译)。这在环境中定义为$BUILD_CC(而不是),正如您在阅读mingw 交叉编译$CC脚本时可能看到的那样。文件中有一个部分(在 ncurses 源中)概述了该过程。INSTALL

没有教程(无论如何这将是题外话),但其他人已经阅读了说明和交叉编译的 ncurses,正如最近的错误报告所证明的那样。


推荐阅读