Suryansh
Suryansh

Reputation: 43

Busybox build fails with ncurses header not found in archlinux (spoiler: i already have ncurses package)

I am trying to build busybox from source, installed all the necessary dependencies, but build fails every time with ncurses header not found err.


OS: Arch Linux x86_64 (On docker: archlinux image)
Kernel: 6.8.9-arch1-2
Shell: bash 5.2.21
Packages Installed: bzip2 git make gcc ncurses flex bison bc cpio libelf openssl

Source: git clone --depth 1 https://git.busybox.net/busybox
Build cmd: cd busybox && make menuconfig

Expected behaviour: a configuration gui opens
Actual behaviour:
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***  
*** Install ncurses (ncurses-devel) and try again.
***  
make[2]: *** [/home/sysmount/busybox/scripts/kconfig/lxdialog/Makefile:15: scripts/kconfig/lxdialog/dochecklxd
ialog] Error 1
make[1]: *** [/home/sysmount/busybox/scripts/kconfig/Makefile:14: menuconfig] Error 2
make: *** [Makefile:444: menuconfig] Error 2

since archlinux bundles header files with base 'ncurses' package, then this shouldn't be happening.

Upvotes: 3

Views: 1848

Answers (3)

yayayat
yayayat

Reputation: 41

I have been struggling with the same problem and just found the solution.

Indeed, the problem is in check-lxdialog.sh inside check function. It should check for lib availability, but it actually checks for compilation errors of simple block of code

        $cc -x c - -o $tmp 2>/dev/null <<'EOF'
#include CURSES_LOC
main() {}
EOF

We can try execute this command manually (substituting variables with actual values):

gcc -x c - -o tmp <<'EOF'
#include <ncurses.h>
main() {} 
EOF

getting output:

<stdin>:2:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
main() {}
^
int
1 error generated.

So the problem is in missing function type specifier, just adding int before main fixes the problem

Upvotes: 4

G. S.
G. S.

Reputation: 301

diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 5075ebf2..4e138366 100755
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -47,7 +47,7 @@ trap "rm -f $tmp" 0 1 2 3 15
 check() {
         $cc -x c - -o $tmp 2>/dev/null <<'EOF'
 #include CURSES_LOC
-main() {}
+int main() {}
 EOF

Upvotes: 7

CorruptedByCPU
CorruptedByCPU

Reputation: 14

For me, it was simple :)

$ nano scripts/kconfig/lxdialog/Makefile

and hash out this line:

always         := $(hostprogs-y) dochecklxdialog

Upvotes: -1

Related Questions