Compile error with Cygwin MinGW
E3V3A opened this issue · 5 comments
How to compile this with MinGW on Cygwin?
I tried by replacing CC with: x86_64-w64-mingw32-gcc
. But got:
$ make
x86_64-w64-mingw32-gcc -c -Os -m64 -mwindows -Wall -Wextra -fstack-check XConPty.c -o ../bin/XConPty.obj
XConPty.c: In function ‘XConPty’:
XConPty.c:60:5: error: unknown type name ‘STARTUPINFOEXW’
STARTUPINFOEXW SInfoEx = { 0 };
^~~~~~~~~~~~~~
XConPty.c:68:50: error: ‘ENABLE_VIRTUAL_TERMINAL_PROCESSING’ undeclared (first use in this function)
hRes = SetConsoleMode(hStdOut, consoleMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XConPty.c:68:50: note: each undeclared identifier is reported only once for each function it appears in
XConPty.c:46:5: warning: implicit declaration of function ‘ProcThreadAttributeValue’ [-Wimplicit-function-declaration]
ProcThreadAttributeValue (ProcThreadAttributePseudoConsole, FALSE, TRUE, FALSE)
^
XConPty.c:46:5: note: in definition of macro ‘PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE’
ProcThreadAttributeValue (ProcThreadAttributePseudoConsole, FALSE, TRUE, FALSE)
^~~~~~~~~~~~~~~~~~~~~~~~
XConPty.c:107:12: error: request for member ‘StartupInfo’ in something not a structure or union
SInfoEx.StartupInfo.cb = sizeof(STARTUPINFOEXW);
^
XConPty.c:107:37: error: ‘STARTUPINFOEXW’ undeclared (first use in this function)
SInfoEx.StartupInfo.cb = sizeof(STARTUPINFOEXW);
^~~~~~~~~~~~~~
XConPty.c:108:12: error: request for member ‘lpAttributeList’ in something not a structure or union
SInfoEx.lpAttributeList = AttrList;
^
XConPty.c:120:17: error: request for member ‘StartupInfo’ in something not a structure or union
&SInfoEx.StartupInfo,
^
XConPty.c:60:20: warning: variable ‘SInfoEx’ set but not used [-Wunused-but-set-variable]
STARTUPINFOEXW SInfoEx = { 0 };
^~~~~~~
make: *** [Makefile:30: ../bin/XConPty.obj] Error 1
Also note that mingw-make
no longer exist, as used in your instructions.
I also tried by importing the phnt headers. Made things worse.
As I said in README: "Some values are not defined in mingw-w64 toolchain. It will be updated soon."
I've added some patches in mingw-w64 repository in SourceForge. It may take time to be updated in cygwin or msys2 repository. For workaround, you can add the defined values in header files.
It will be updated soon
Yes I read that, and it's been 3 months since that text was put here, so what exactly is your definition of "soon"?
I've added some patches in mingw-w64 repository in SourceForge
Oooh, noo, that could take forever. Can you post the patches somewhere else?
you can add the defined values in header files
I only know ENABLE_VIRTUAL_TERMINAL_PROCESSING
, but I have no idea what STARTUPINFOEXW
or PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
should be. Any suggestions where to look?
Here are those:
#define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE 0x20016
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
typedef struct _STARTUPINFOEXW {
STARTUPINFOW StartupInfo;
LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList;
} STARTUPINFOEXW, *LPSTARTUPINFOEXW;
mingw-w64 in msys2 compiles well but cygwin hasn't imported those definitions in their repo. Here are the patches by me:
Hi @Biswa96
It would have been so much better if they could abandon that 20 year old sourceforge and mailing list development process. It just makes me 🤢
Perhaps your patches are in most recent clone I made here.
There is already a mirror mingw-w64 repository in GitHub. Cygwin header files aren't same as mingw. The underlying goal is different of those two projects. I'll update my readme file.