0
votes

Currently we are trying to compile Qemu for Xilinx Devices on Ubuntu Machine and we do cross compile it for Windows using Mingw64 by following this link.

Qemu Compiles Successfully when Curses feature is disabled, but when we enable the Curses feature by adding --enable-curses it fail with error

Blockquote ERROR: User requested feature curses configure was not able to find it. Install ncurses devel

when we debug more we find that configure is trying to compile curses before allowing the make with the following command:

/qemu/bin/ndebug/x86_64-w64-mingw32# sys:1: Warning: g_file_test: assertion 'filename != NULL' failed S=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506L -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -no-pie -m64 -fstack-protector-strong -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -Wl,--enable-auto-import -lncursesw

,and this fails with the following error:

config-temp/qemu-conf.c:4:10: fatal error: langinfo.h: No such file or directory

According to gnu langinfo.h is missing on mingw.

So, does anyone knows other way to overcome this issue? should we use packages other than ncurse?(like -> pcurses,...) how to include langinfo.h to mingw? (i searched about it but with no success, i tried to copy all these library to mingw include path, but for sure it fail).

Many thanks for your support in advance and wish you all happy new year

1
ncurses doesn't require that header (its configure script handles its absence).Thomas Dickey
many thanks @ThomasDickey for your support, i had checked curses for qemu and inside the curses.c it includes langinfo.h, you can find the used curses in the following path: github.com/Xilinx/qemu/blob/master/ui/curses.cMinaMagdy
That's part of QEMU (not part of ncurses). It's probably for the CODESET lookup.Thomas Dickey
aaah, okay, many thanks for the clarification :D , so ncurses library is not including langinfo.h but the qemu is including it for qemu curses,do you (@ThomasDickey) know how to include the langinfo.h libraries in mingw?, is this possible?MinaMagdy
ok, many thanks @ThomasDickey for your support, i applied the workarounds made on the link you just sent by replacing nl_langinfo with g_get_codeset(), and it build correctly finally :D, many thanks again for your supportMinaMagdy

1 Answers

0
votes

Summarizing the comments:

  • ncurses doesn't require that header (its configure script handles its absence).

  • The cited curses.c source file is part of QEMU (not part of ncurses). It's probably for the CODESET lookup.

  • QEMU's configure script apparently does not check for this, but its lack (and proposed solution) were noted on QEMU's development mailing list in October 2020:

    [PULL 2/9] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw
    Gerd Hoffmann Wed, 14 Oct 2020 01:27:01 -0700
    From: Yonggang Luo <[email protected]>
    msys2/mingw lacks the POSIX-required langinfo.h.
    
    gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe -lncursesw 
    -lgnurx -ltre -lintl -liconv
    test.c:4:10: fatal error: langinfo.h: No such file or directory
        4 | #include <langinfo.h>
          |          ^~~~~~~~~~~~
    compilation terminated.
    
    So we using g_get_codeset instead of nl_langinfo(CODESET)