bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compile ncurse with mingw


From: Pierre Blavy
Subject: compile ncurse with mingw
Date: Wed, 1 Feb 2023 12:24:46 +0000

Hello,


I'm trying to cross compile ncurse 6.3 patch 20211021 on fedor37 for windows using


./configure --host=i686-w64-mingw32 --prefix=/tmp/test/ncurses-win32;

mingw32-make;



=== DWORD ===


First I've got the following error :


../ncurses/./tinfo/lib_napms.c:82:12: error: 'DWORD' undeclared (first use in this function)
   82 |     Sleep((DWORD) ms);
      |            ^~~~~
../ncurses/./tinfo/lib_napms.c:82:12: note: each undeclared identifier is reported only once for each function it appears in
../ncurses/./tinfo/lib_napms.c:82:18: error: expected ')' before 'ms'
   82 |     Sleep((DWORD) ms);


This error can be worked-around by adding #include <windows.h> before all other includes in /ncurses/./tinfo/lib_napms.

I'm unsure about how windows related includes should be added to the code withoud breaking things, but there is probably something to change in .configure to make the lib_napms.c file include windows.h when appropriate.



=== undefined references ===


Then the linker produces undefined references


make[1]: Entering directory '/tmp/test/ncurses-6.3/progs'
i686-w64-mingw32-gcc ../objects/tic.o ../objects/dump_entry.o ../objects/tparm_type.o ../objects/transform.o -L../lib  -DHAVE_CONFIG_H -I../progs -I. -I../include -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -D_FILE_OFFSET_BITS=64 -DNDEBUG -DWINVER=0x0501 -DWIN32_LEAN_AND_MEAN -O2 --param max-inline-insns-single=1200  -DNCURSES_STATIC -L../lib -static -lncurses -lncurses -dynamic   -o tic.exe
/usr/lib/gcc/i686-w64-mingw32/12.2.1/../../../../i686-w64-mingw32/bin/ld: ../lib/libncurses.a(lib_ttyflags.o):lib_ttyflags.c:(.text+0x3c): undefined reference to `_nc_mingw_tcgetattr'
/usr/lib/gcc/i686-w64-mingw32/12.2.1/../../../../i686-w64-mingw32/bin/ld: ../lib/libncurses.a(lib_ttyflags.o):lib_ttyflags.c:(.text+0xfb): undefined reference to `_nc_mingw_tcsetattr'
collect2: error: ld returned 1 exit status


This problem is discussed here :

https://lists.gnu.org/archive/html/bug-ncurses/2019-11/msg00022.html


So I've tried :

./configure --host=i686-w64-mingw32 --prefix=/tmp/test/ncurses-win32 --enable-term-driver
mingw32-make;


But I get a new error

Entering directory '/tmp/test/ncurses-6.3/progs'
i686-w64-mingw32-gcc ../objects/toe.o -L../lib  -DHAVE_CONFIG_H -I../progs -I. -I../include -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -D_FILE_OFFSET_BITS=64 -DNDEBUG -DWINVER=0x0501 -DWIN32_LEAN_AND_MEAN -DUSE_WIN32CON_DRIVER -O2 --param max-inline-insns-single=1200  -DNCURSES_STATIC -L../lib -static -lncurses -lncurses -dynamic   -o toe.exe
/usr/lib/gcc/i686-w64-mingw32/12.2.1/../../../../i686-w64-mingw32/bin/ld: /usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/libmingwex.a(lib32_libmingwex_a-dirent.o):(.text+0x22f): undefined reference to `__strcpy_chk'
collect2: error: ld returned 1 exit status


I searched for missing function with

cd /usr/i686-w64-mingw32/sys-root/mingw/lib

nm -A --defined *.a | grep __strcpy_chk


Result:

libssp.a:strcpy-chk.o:00000000 T ___strcpy_chk
libssp.dll.a:68cc1880 T ___strcpy_chk

It exists in libssp, but I was confused as the missing function is '__strcpy_chk' (prefixed by 2 underscores) but libssp.a defines '___strcpy_chk' (prefixed by 3 underscores). I don't know how to investigate any further.


==> How to compile properly ncurses on a linux host, for a windows target, using mingw ?

==> Is there a way to fix the ./configure script, so it works out of the bow, with the usual "./configure --host=i686-w64-mingw32" command ?


Best regards!









reply via email to

[Prev in Thread] Current Thread [Next in Thread]