Make error when building 4.3.4 with MSYS2 MinGW64 with `-DINFOEX=N`
chuck-haatvedt opened this issue · 2 comments
Bill after extracting the zip file to my $HOME folder in MSYS2 MINGW64 when I ran the Make command I encountered the following error...
spcwh2@3570K MINGW64 ~/PDCursesMod-master/wincon
$ make -f Makefile INFOEX=N CHTYPE_64=Y DLL=Y
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/addch.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/addchstr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/addstr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/attr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/beep.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/bkgd.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/border.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/clear.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/color.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/delch.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/deleteln.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/getch.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/getstr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/getyx.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/inch.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/inchstr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/initscr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/inopts.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/insch.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/insstr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/instr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/kernel.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/keyname.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/mouse.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/move.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/outopts.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/overlay.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/pad.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/panel.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/printw.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/refresh.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/scanw.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/scr_dump.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/scroll.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/slk.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/termattr.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/touch.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/util.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/window.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD ../pdcurses/debug.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD -DHAVE_NO_INFOEX ../wincon/pdcclip.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD -DHAVE_NO_INFOEX ../wincon/pdcdisp.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD -DHAVE_NO_INFOEX ../wincon/pdcgetsc.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD -DHAVE_NO_INFOEX ../wincon/pdckbd.c
gcc -c -Wall -Wextra -pedantic -O4 -I.. -DPDC_DLL_BUILD -DHAVE_NO_INFOEX ../wincon/pdcscrn.c
../wincon/pdcscrn.c:78:16: error: redefinition of 'struct _CONSOLE_SCREEN_BUFFER_INFOEX'
78 | typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from D:/msys64/mingw64/include/windows.h:74,
from ../wincon/pdcwin.h:16,
from ../wincon/pdcscrn.c:3:
D:/msys64/mingw64/include/wincon.h:358:16: note: originally defined here
358 | typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../wincon/pdcscrn.c:88:3: error: conflicting types for 'CONSOLE_SCREEN_BUFFER_INFOEX'; have 'struct _CONSOLE_SCREEN_BUFFER_INFOEX'
88 | } CONSOLE_SCREEN_BUFFER_INFOEX;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/msys64/mingw64/include/wincon.h:368:3: note: previous declaration of 'CONSOLE_SCREEN_BUFFER_INFOEX' with type 'CONSOLE_SCREEN_BUFFER_INFOEX'
368 | } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../wincon/pdcscrn.c:89:42: error: conflicting types for 'PCONSOLE_SCREEN_BUFFER_INFOEX'; have 'CONSOLE_SCREEN_BUFFER_INFOEX *' {aka 'struct _CONSOLE_SCREEN_BUFFER_INFOEX *'}
89 | typedef CONSOLE_SCREEN_BUFFER_INFOEX *PCONSOLE_SCREEN_BUFFER_INFOEX;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/msys64/mingw64/include/wincon.h:368:34: note: previous declaration of 'PCONSOLE_SCREEN_BUFFER_INFOEX' with type 'PCONSOLE_SCREEN_BUFFER_INFOEX' {aka 'struct _CONSOLE_SCREEN_BUFFER_INFOEX *'}
368 | } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../wincon/pdcscrn.c: In function 'PDC_scr_open':
../wincon/pdcscrn.c:484:9: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'BOOL (*)(void *, CONSOLE_SCREEN_BUFFER_INFOEX *)' {aka 'int (*)(void *, struct _CONSOLE_SCREEN_BUFFER_INFOEX *)'} [-Wcast-function-type]
484 | (GetConsoleScreenBufferInfoExFn)GetProcAddress(h_kernel,
| ^
../wincon/pdcscrn.c:487:9: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'BOOL (*)(void *, CONSOLE_SCREEN_BUFFER_INFOEX *)' {aka 'int (*)(void *, struct _CONSOLE_SCREEN_BUFFER_INFOEX *)'} [-Wcast-function-type]
487 | (SetConsoleScreenBufferInfoExFn)GetProcAddress(h_kernel,
| ^
make: *** [Makefile:156: pdcscrn.o] Error 1
spcwh2@3570K MINGW64 ~/PDCursesMod-master/wincon
$ ls *.dll
ls: cannot access '*.dll': No such file or directory
I will try again using the *.tar.gz file to see if it makes any difference.
same error...
=======> I found the duplicate typedef so I changed the make command as follows and it worked...
make -f Makefile INFOEX=Y CHTYPE_64=Y DLL=Y
====> perhaps this is not an issue but merely the result of my lack of knowledge of the build process in MSYS2 MINGW64 when building from source.
Hi Chuck,
Looks as if you found the solution. You can also just leave out the INFOEX=Y
bit; Y is the default anyway. INFOEX=N
should only be used on some really elderly compilers... maybe just older Borland Turbo C? And maybe there are older MinGWs that require it.
Ideally, C would provide some preprocessor logic so you could say "if we don't have this structure or typedef or function defined, do the following to work around it." Then we'd say
#if !typedeffed( CONSOLE_SCREEN_BUFFER_INFOEX)
(code to provide that typedef)
#endif
But at the time the preprocessor runs through the code, no typedefs or function declarations have been parsed; the preprocessor would have to "look into the future" to manage this trick.
The original code from PDCurses used some simple logic to decide if the compiler had the typedef
s in question. I don't know why that was abandoned... could be it's a little trickier to figure out exactly which compilers are so old that HAVE_NO_INFOEX
ought to be #defined.
Yes, not using -DINFOEX=N
solves the issue.
The main issue about that being the standard and not explicit defined by the compiler is that this all depends on the used headers, not the compiler. Other than old Borland this also applies to "old MinGW" (and if it did not update the header in its distribution that would still be the case).