hishamhm / htop

htop is an interactive text-mode process viewer for Unix systems. It aims to be a better 'top'.
GNU General Public License v2.0
5.83k stars 581 forks source link

Cross-compilation using Yocto fails on ncurses check #671

Open cmcqueen opened 6 years ago

cmcqueen commented 6 years ago

I'm trying to use Yocto to cross-compile htop 2.0.2 for an ARM-based system (BeagleBone Black). I'm using configure option --disable-unicode since I have disabled wchar support.

It fails with the message:

... checking for refresh in -lncurses... no checking for refresh in -lncurses6... no checking for refresh in -lncurses... (cached) no checking for curses.h... (cached) yes configure: error: missing libraries: libncurses

The config.log contains:

configure:13533: checking for refresh in -lncurses configure:13558: arm-poky-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard --sysroot=/home/craigm/yocto-laura/poky/build/tmp/sysroots/laura -o conftest -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/craigm/yocto-laura/poky/build/tmp/work/armv7ahf-neon-poky-linux-gnueabi/htop/2.0.2-r0=/usr/src/debug/htop/2.0.2-r0 -fdebug-prefix-map=/home/craigm/yocto-laura/poky/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/craigm/yocto-laura/poky/build/tmp/sysroots/laura= --should-not-have-used-/usr/bin/ncurses5-config -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c -lncurses -lm >&5 arm-poky-linux-gnueabi-gcc: error: unrecognized command line option '--should-not-have-used-/usr/bin/ncurses5-config'

See [oe] --should-not-have-used- on the OpenEmbedded mailing list which describes the should-not-have-used- part in the error message.

I think the essence is, use pkg-config to find the ncurses dependency.

htop 1.0.3 builds okay in Yocto, I guess because it's not using the same method to check for ncurses.

wjx0912 commented 5 years ago

htop 2.2.0, the same problem, not fixed yet?

marv commented 4 years ago

We hit the same issue on Exherbo. For now I was able to workaround that by passing

HTOP_NCURSESW_CONFIG_SCRIPT="/usr/$(exhost --target)/bin/ncursesw6-config"

during configure. $(exhost --target) is the triple of the targeted host, e.g. armv7-unknown-linux-gnueabihf

But this only works because ncursesw6-config is a bash script. Usually you can't expect to run stuff from /usr/$(exhost --target)/bin on your build host.

So +1 for using pkg-config here to find ncurses in a cross-compatible way