简体   繁体   中英

compilation of binutils-gdb can't find ncurses

I'm trying to compile the binutils for the i686-elf target according to this tutorial:

I just added the --enable-tui option, so that I have the support in the gdb.

I did the following:

# 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

This runs for some time and terminates with the following error:

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

For me it seems, that the ncurses library cannot be found.

I have a Debian 10 running and installed the following additional packages:

  • libncurses-dev
  • ncurses-base
  • ncurses-doc
  • libncurses5-dev

Do I have to install additional packages? Or am I missing some options for the configure script?

You're cross-compiling to a different architecture ( i686-elf ) than whatever you're running on—the $TARGET mentioned in the question. gdb will have to be linked with libraries which are built for that architecture.

Debian provides ncurses packages which run on the current architecture, but does not provide a suitable package for the cross-compiled application. So you get to do this for yourself.

When cross-compiling ncurses, you'll have to keep in mind that part of it builds/runs on the current architecture (to generate source-files for compiling by the cross-compiler). That's defined in the environment as $BUILD_CC (rather than $CC ), as you might see when reading the script for the mingw cross-compiling . There's a section in the INSTALL file (in the ncurses sources) which outlines the process.

There's no tutorial (that would be off-topic here anyway), but others have read the instructions and cross-compiled ncurses as evidenced by a recent bug report .

I retried the whole compilation, and suddenly it works: I tested a bit and I assume I found my fault: I executed configure without --enable-tui , where make worked. Then I executed configure with --enable-tui in the same folder without cleaning it. After cleaning or running in a new folder it compiled.

Thanks to the one user who posted to delete the contents of opt/cross . (The comment itself was already somehow deleted in between.) This wasn't the solution, but leaded me in the right direction.

TL;DR: Clean the build folder before running configure with different parameters again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM