Lots of build errors on latest msys & GCC 6.3
alexreg opened this issue · comments
First, I have to remove the -municode
option from the Makefile
. If I then compile, I get a slew of errors...
gcc -std=c11 -Wall -Wextra -Werror -static -mwindows -o msys2.exe launcher.c msys2.res
launcher.c: In function ‘ShowError’:
launcher.c:21:19: error: passing argument 2 of ‘MessageBoxA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
MessageBox(NULL, msg, L"Launcher error", MB_ICONEXCLAMATION | MB_OK);
^~~
In file included from /usr/include/w32api/windows.h:72:0,
from launcher.c:5:
/usr/include/w32api/winuser.h:3563:25: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘wchar_t * {aka short unsigned int *}’
WINUSERAPI int WINAPI MessageBoxA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType);
^~~~~~~~~~~
launcher.c:21:24: error: passing argument 3 of ‘MessageBoxA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
MessageBox(NULL, msg, L"Launcher error", MB_ICONEXCLAMATION | MB_OK);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/w32api/windows.h:72:0,
from launcher.c:5:
/usr/include/w32api/winuser.h:3563:25: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘short unsigned int *’
WINUSERAPI int WINAPI MessageBoxA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType);
^~~~~~~~~~~
launcher.c: In function ‘ShowLastError’:
launcher.c:29:164: error: passing argument 5 of ‘FormatMessageA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&err, 0, NULL);
^
In file included from /usr/include/w32api/windows.h:70:0,
from launcher.c:5:
/usr/include/w32api/winbase.h:1344:27: note: expected ‘LPSTR {aka char *}’ but argument is of type WCHAR * {aka short unsigned int *}’
WINBASEAPI DWORD WINAPI FormatMessageA (DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list *Arguments);
^~~~~~~~~~~~~~
launcher.c: In function ‘ShowErrno’:
launcher.c:37:8: error: implicit declaration of function ‘_wcserror’ [-Werror=implicit-function-declaration]
err = _wcserror(errno);
^~~~~~~~~
launcher.c:37:6: error: assignment makes pointer from integer without a cast [-Werror=int-conversio ]
err = _wcserror(errno);
^
launcher.c: In function ‘StartChild’:
launcher.c:50:29: error: passing argument 2 of ‘CreateProcessA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
^~~~~~~
In file included from /usr/include/w32api/winbase.h:29:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processthreadsapi.h:118:29: note: expected ‘LPSTR {aka char *}’ but argument is of type ‘wchar_t * {aka short unsigned int *}’
WINBASEAPI WINBOOL WINAPI CreateProcessA (LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, WINBOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
^~~~~~~~~~~~~~
launcher.c:50:72: error: passing argument 9 of ‘CreateProcessA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
^
In file included from /usr/include/w32api/winbase.h:29:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processthreadsapi.h:118:29: note: expected ‘LPSTARTUPINFOA {aka struct _STARTUPINFOA *}’ but argument is of type ‘STARTUPINFOW * {aka struct _STARTUPINFOW *}’
WINBASEAPI WINBOOL WINAPI CreateProcessA (LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, WINBOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
^~~~~~~~~~~~~~
launcher.c: In function ‘SetEnv’:
launcher.c:72:11: error: implicit declaration of function ‘_wfopen’ [-Werror=implicit-function-declaration]
handle = _wfopen(conffile, L"rt");
^~~~~~~
launcher.c:72:9: error: assignment makes pointer from integer without a cast [-Werror=int-conversio ]
handle = _wfopen(conffile, L"rt");
^
launcher.c:105:38: error: passing argument 1 of ‘ExpandEnvironmentStringsA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = ExpandEnvironmentStrings(tmp, expanded, expandedlen);
^~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:42:27: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘wchar_t * {aka short unsigned int *}’
WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsA (LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
^~~~~~~~~~~~~~~~~~~~~~~~~
launcher.c:105:43: error: passing argument 2 of ‘ExpandEnvironmentStringsA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = ExpandEnvironmentStrings(tmp, expanded, expandedlen);
^~~~~~~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:42:27: note: expected ‘LPSTR {aka char *}’ but argument is of type ‘wchar_t * {aka short unsigned int *}’
WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsA (LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
^~~~~~~~~~~~~~~~~~~~~~~~~
launcher.c:116:16: error: implicit declaration of function ‘_wcsdup’ [-Werror=implicit-function-declaration]
msystem = _wcsdup(expanded);
^~~~~~~
launcher.c:116:14: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
msystem = _wcsdup(expanded);
^
launcher.c:122:35: error: passing argument 1 of ‘SetEnvironmentVariableA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = SetEnvironmentVariable(buf, expanded);
^~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:40:29: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘wchar_t * {aka short unsigned int *}’
WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA (LPCSTR lpName, LPCSTR lpValue);
^~~~~~~~~~~~~~~~~~~~~~~
launcher.c:122:40: error: passing argument 2 of ‘SetEnvironmentVariableA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = SetEnvironmentVariable(buf, expanded);
^~~~~~~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:40:29: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘wchar_t * {aka short unsigned int *}’
WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA (LPCSTR lpName, LPCSTR lpValue);
^~~~~~~~~~~~~~~~~~~~~~~
launcher.c: In function ‘wmain’:
launcher.c:153:18: error: ‘PATH_MAX’ undeclared (first use in this function)
wchar_t msysdir[PATH_MAX];
^~~~~~~~
launcher.c:153:18: note: each undeclared identifier is reported only once for each function it appears in
launcher.c:182:11: error: implicit declaration of function ‘wcsicmp’ [-Werror=implicit-function-declaration]
if (0 != wcsicmp(L".exe", tmp)) {
^~~~~~~
launcher.c:192:33: error: passing argument 1 of ‘SetEnvironmentVariableA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = SetEnvironmentVariable(L"CHERE_INVOKING", L"1");
^~~~~~~~~~~~~~~~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:40:29: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘short unsigned int *’
WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA (LPCSTR lpName, LPCSTR lpValue);
^~~~~~~~~~~~~~~~~~~~~~~
launcher.c:192:52: error: passing argument 2 of ‘SetEnvironmentVariableA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = SetEnvironmentVariable(L"CHERE_INVOKING", L"1");
^~~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:40:29: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘short unsigned int *’
WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA (LPCSTR lpName, LPCSTR lpValue);
^~~~~~~~~~~~~~~~~~~~~~~
launcher.c:204:32: error: passing argument 1 of ‘SetEnvironmentVariableA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = SetEnvironmentVariable(L"MSYSCON", L"mintty.exe");
^~~~~~~~~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:40:29: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘short unsigned int *’
WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA (LPCSTR lpName, LPCSTR lpValue);
^~~~~~~~~~~~~~~~~~~~~~~
launcher.c:204:44: error: passing argument 2 of ‘SetEnvironmentVariableA’ from incompatible pointer type [-Werror=incompatible-pointer-types]
code = SetEnvironmentVariable(L"MSYSCON", L"mintty.exe");
^~~~~~~~~~~~~
In file included from /usr/include/w32api/winbase.h:28:0,
from /usr/include/w32api/windows.h:70,
from launcher.c:5:
/usr/include/w32api/processenv.h:40:29: note: expected ‘LPCSTR {aka const char *}’ but argument is of type ‘short unsigned int *’
WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA (LPCSTR lpName, LPCSTR lpValue);
^~~~~~~~~~~~~~~~~~~~~~~
launcher.c:210:7: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
args = GetCommandLine();
^
launcher.c:155:10: error: unused variable ‘confpath’ [-Werror=unused-variable]
wchar_t confpath[PATH_MAX];
^~~~~~~~
launcher.c:154:10: error: unused variable ‘exepath’ [-Werror=unused-variable]
wchar_t exepath[PATH_MAX];
^~~~~~~
launcher.c:153:10: error: unused variable ‘msysdir’ [-Werror=unused-variable]
wchar_t msysdir[PATH_MAX];
^~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:13: msys2.exe] Error 1
Hi.
First, I have to remove the |-municode| option from the |Makefile|. If I then compile, I get a slew of errors...
The project is supposed to be built by a Windows (mingw-w64) toolchain. Either use `makepkg` to build, or set the `PREFIX` variable for make, or run the build in a MINGW{32,64} shell, or manipulate your `PATH` some other way.
…--
David Macek
I'm running the build in a mingw shell in fact. What should the PREFIX
variable be set to?
Here's the original error, by the way.
gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o msys2.exe launcher.c msys2.res
gcc: error: unrecognized command line option ‘-municode’
make: *** [Makefile:13: msys2.exe] Error 1
On 17. 5. 2017 18:37, Alexander Regueiro wrote:
I'm running the build in a mingw shell in fact. What should the |PREFIX| variable be set to?
You also need to install the mingw-w64 toolchain using `pacman -S mingw-w64-x86_64-toolchain` (`-i686-` if 32-bit mingw-w64). Otherwise `gcc` will just be the msys one.
…--
David Macek
All sorted. Thanks!