Have you tried adding -Isysroot/usr/include/?
While this isn’t ideal, if it works, it should be fine as a work around. This could have something to do with zig not searching in the right places from “sysroot” with the arm-linux-musleabihf target, though don’t quote me on that, haven’t actually checked.
But finally I still get some linker errors and I don’t know what going on:
zig build-exe test2.zig -target arm-linux-musleabihf -mcpu cortex_a53 -lc -lncurses --sysroot sysroot -Isysroot/usr/include -Isysroot/usr/include/arm-linux-gnueabihf/ -Lsysroot/usr/lib/arm-linux-gnueabihf
ld.lld: error: undefined symbol: def_prog_mode
>>> referenced by lib_initscr.o:(initscr) in archive sysroot/usr/lib/arm-linux-gnueabihf/libncurses.a
>>> referenced by lib_set_term.o:(_nc_setupscreen) in archive sysroot/usr/lib/arm-linux-gnueabihf/libncurses.a
>>> referenced by lib_tstp.o:(handle_SIGTSTP) in archive sysroot/usr/lib/arm-linux-gnueabihf/libncurses.a
ld.lld: error: undefined symbol: __fprintf_chk
>>> referenced by lib_initscr.o:(initscr) in archive sysroot/usr/lib/arm-linux-gnueabihf/libncurses.a
ld.lld: error: undefined symbol: _nc_globals
>>> referenced by lib_initscr.o:(initscr) in archive sysroot/usr/lib/arm-linux-gnueabihf/libncurses.a
.....
Btw is it better to choose another target triple. e.g. arm-linux-gnueabihf?
But with gnueabihf I got some other error messages:
zig build-exe test2.zig -target arm-linux-gnueabihf -mcpu cortex_a53 -lc -lncurses --sysroot sysroot -Isysroot/usr/include -Isysroot/usr/include/arm-linux-gnueabihf/ -Lsysroot/usr/lib/arm-linux-gnueabihf
LLVM Emit Object... error(compilation): clang failed with stderr: In file included from /snap/zig/5064/lib/libc/glibc/sysdeps/arm/crti.S:44:
In file included from /snap/zig/5064/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h:25:
In file included from /snap/zig/5064/lib/libc/glibc/sysdeps/unix/arm/sysdep.h:19:
/snap/zig/5064/lib/libc/glibc/sysdeps/arm/sysdep.h:25:11: fatal error: 'arm-features.h' file not found
error(compilation): /snap/zig/5064/lib/libc/glibc/sysdeps/arm/crti.S:1:1: unable to build C object: clang exited with code 1
error(compilation): clang failed with stderr: In file included from /snap/zig/5064/lib/libc/glibc/sysdeps/arm/crtn.S:38:
In file included from /snap/zig/5064/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h:25:
In file included from /snap/zig/5064/lib/libc/glibc/sysdeps/unix/arm/sysdep.h:19:
/snap/zig/5064/lib/libc/glibc/sysdeps/arm/sysdep.h:25:11: fatal error: 'arm-features.h' file not found
error(compilation): /snap/zig/5064/lib/libc/glibc/sysdeps/arm/crtn.S:1:1: unable to build C object: clang exited with code 1
error: unable to build glibc CRT file: BuildingLibCObjectFailed
Ok, today I tried to cross compile a equivalent c programm to make sure that all includes and librarys are installed correctly.
#include <ncurses.h>
int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!!"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
return 0;
}
compiles fine on my development pc with arm-linux-gnueabihf-gcc ncurses.c --sysroot=sysroot -mcpu=cortex-a53 -lncurses
and the resulting binary works on the rpi.
Maybe I use under zig the wrong target triple or it might be an issue, idk
Any help is appreciated, I’d love to switch to Zig