[Buildroot] nano package fail to build; cannot include curses.h

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sat May 9 14:27:22 UTC 2020

On Sat, 9 May 2020 09:43:44 -0400
William Tambe <tambewilliam at gmail.com> wrote:

> > In any case, since we don't have access to your toolchain, we have no
> > way to reproduce/investigate. On other architectures, nano builds fine.  
> My issue seems to be that it is not able to find curses.h headers
> which buildroot already installed at the following path:
> ./target/usr/include/curses.h
> ./target/usr/include/ncurses.h
> ./host/iron-buildroot-linux-gnu/sysroot/usr/include/curses.h
> ./host/iron-buildroot-linux-gnu/sysroot/usr/include/ncurses.h
> ./host/include/ncurses/curses.h
> ./host/include/ncurses/ncurses.h
> Using something like this in nano.mk didn't help either:
>         $(TARGET_MAKE_ENV) \
>         CFLAGS="$(TARGET_CFLAGS) -I$(HOST_DIR)/include/ncurses"

This is terribly wrong: you are point to the headers of host libraries,
while cross-compiling code for the target.

> Any other suggestion I could try in debugging the issue I am having ?

Can we have access to your "iron" toolchain to reproduce ?

Normally, the way it works is that Buildroot generates a toolchain
wrapper, which calls your toolchain "gcc" after adding
--sysroot=$(STAGING_DIR), and therefore, gcc should automatically find
headers in $(STAGING_DIR)/usr/include.

I'd suggest to create a simple C file with just #include <ncurses.h>,
and try to build it with $(HOST_DIR)/bin/iron-...-gcc. If that doesn't
work, pass BR2_DEBUG_WRAPPER=2 when calling gcc, and check what gets
passed to the gcc of your toolchain.

Best regards,

Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering

More information about the buildroot mailing list