[RFC] setup: allow building with i686-w64-mingw32

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Fri Jun 1 18:40:00 GMT 2012


On 2012-06-01 12:08, JonY wrote:
>> 2) DDK headers can't find other DDK headers which they require.  IMHO
>> those should be changed from<>  includes to "" includes in mingw64-headers.
>
> You are supposed to use -I/path/to/include/ddk to use the headers, this
> is one of the differences with mingw.org.

That shouldn't be necessary IMO if I e.g. #include <ddk/ntifs.h>.

>> 3) Once I circumvent those, I get a ton of redefinition and conflicting
>> declaration errors between winnt.h and ddk/ntddk.h.  Its too long to
>> list here, so I suggest you give it a try.
>
> PSDK should not be used together with the DDK, Kai suggests using
> winternl.h in place of ntddk.h.

That gets me closer.  I'm going AFK now, but with the attached patch the 
following errors remain:

   CXX    filemanip.o
In file included from ntdll.h:23:0,
                  from filemanip.cc:31:
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:512:16: error: 
redefinition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:101:37: error: 
previous definition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
invalid type in declaration before ‘,’ token
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
conflicting declaration ‘typedef int OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:5: error: 
‘OBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES OBJECT_ATTRIBUTESÂ’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:23: error: 
conflicting declaration ‘typedef int* POBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:25: error: 
‘POBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES* POBJECT_ATTRIBUTESÂ’
In file included from filemanip.cc:31:0:
ntdll.h:41:35: error: declaration of C function ‘NTSTATUS 
NtQueryInformationFile(void*, _IO_STATUS_BLOCK*, void*, ULONG, 
FILE_INFORMATION_CLASS)Â’ conflicts with
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:789:19: error: 
previous declaration ‘NTSTATUS NtQueryInformationFile(void*, 
_IO_STATUS_BLOCK*, void*, LONG, FILE_INFORMATION_CLASS)Â’ here
filemanip.cc: In function ‘DWORD GetFileAttributesW(const WCHAR*)’:
filemanip.cc:296:10: error: ‘FILE_SHARE_VALID_FLAGS’ was not declared in 
this scope
filemanip.cc:297:24: error: ‘FILE_OPEN_FOR_BACKUP_INTENT’ was not 
declared in this scope
filemanip.cc:297:54: error: ‘FILE_OPEN_REPARSE_POINT’ was not declared 
in this scope
filemanip.cc: In function ‘WINBOOL SetFileAttributesW(const WCHAR*, DWORD)’:
filemanip.cc:328:10: error: ‘FILE_SHARE_VALID_FLAGS’ was not declared in 
this scope
filemanip.cc:329:24: error: ‘FILE_OPEN_FOR_BACKUP_INTENT’ was not 
declared in this scope
filemanip.cc:329:54: error: ‘FILE_OPEN_REPARSE_POINT’ was not declared 
in this scope
filemanip.cc: In function ‘WINBOOL MoveFileW(const WCHAR*, const WCHAR*)’:
filemanip.cc:360:22: error: ‘FILE_SHARE_VALID_FLAGS’ was not declared in 
this scope
filemanip.cc:361:10: error: ‘FILE_OPEN_FOR_BACKUP_INTENT’ was not 
declared in this scope
filemanip.cc:361:40: error: ‘FILE_OPEN_REPARSE_POINT’ was not declared 
in this scope
filemanip.cc:368:13: error: ‘struct _FILE_RENAME_INFORMATION’ has no 
member named ‘ReplaceIfExists’
filemanip.cc:369:13: error: ‘struct _FILE_RENAME_INFORMATION’ has no 
member named ‘RootDirectory’
filemanip.cc: In function ‘BOOL unlink(const WCHAR*, ULONG)’:
filemanip.cc:398:22: error: ‘FILE_SHARE_VALID_FLAGS’ was not declared in 
this scope
filemanip.cc:399:10: error: ‘FILE_OPEN_FOR_BACKUP_INTENT’ was not 
declared in this scope
filemanip.cc:400:12: error: ‘FILE_OPEN_REPARSE_POINT’ was not declared 
in this scope
filemanip.cc: In function ‘WINBOOL DeleteFileW(const WCHAR*)’:
filemanip.cc:418:25: error: ‘FILE_NON_DIRECTORY_FILE’ was not declared 
in this scope
filemanip.cc: In function ‘WINBOOL RemoveDirectoryW(const WCHAR*)’:
filemanip.cc:424:25: error: ‘FILE_DIRECTORY_FILE’ was not declared in 
this scope
filemanip.cc: In function ‘FILE* nt_wfopen(const wchar_t*, const char*, 
mode_t)Â’:
filemanip.cc:446:14: error: ‘FILE_OPEN’ was not declared in this scope
filemanip.cc:450:14: error: ‘FILE_OVERWRITE_IF’ was not declared in this 
scope
filemanip.cc:454:14: error: ‘FILE_OPEN_IF’ was not declared in this scope
filemanip.cc:492:3: error: ‘FILE_OPEN’ was not declared in this scope
filemanip.cc:498:28: error: ‘FILE_SHARE_VALID_FLAGS’ was not declared in 
this scope
filemanip.cc:499:5: error: ‘FILE_OPEN_FOR_BACKUP_INTENT’ was not 
declared in this scope
filemanip.cc:500:7: error: ‘FILE_OPEN_REPARSE_POINT’ was not declared in 
this scope
filemanip.cc:501:7: error: ‘FILE_SYNCHRONOUS_IO_NONALERT’ was not 
declared in this scope
cc1plus: warnings being treated as errors
filemanip.cc: In function ‘WINBOOL RemoveDirectoryW(const WCHAR*)’:
filemanip.cc:425:1: error: control reaches end of non-void function
filemanip.cc: In function ‘WINBOOL DeleteFileW(const WCHAR*)’:
filemanip.cc:419:1: error: control reaches end of non-void function
filemanip.cc: At global scope:
filemanip.cc:385:1: error: ‘BOOL unlink(const WCHAR*, ULONG)’ defined 
but not used
Makefile:830: recipe for target `filemanip.o' failed
make[2]: *** [filemanip.o] Error 1
   CXX    io_stream_file.o
In file included from ntdll.h:23:0,
                  from io_stream_file.cc:22:
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:512:16: error: 
redefinition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:101:37: error: 
previous definition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
invalid type in declaration before ‘,’ token
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
conflicting declaration ‘typedef int OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:5: error: 
‘OBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES OBJECT_ATTRIBUTESÂ’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:23: error: 
conflicting declaration ‘typedef int* POBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:25: error: 
‘POBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES* POBJECT_ATTRIBUTESÂ’
In file included from io_stream_file.cc:22:0:
ntdll.h:41:35: error: declaration of C function ‘NTSTATUS 
NtQueryInformationFile(void*, _IO_STATUS_BLOCK*, void*, ULONG, 
FILE_INFORMATION_CLASS)Â’ conflicts with
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:789:19: error: 
previous declaration ‘NTSTATUS NtQueryInformationFile(void*, 
_IO_STATUS_BLOCK*, void*, LONG, FILE_INFORMATION_CLASS)Â’ here
Makefile:830: recipe for target `io_stream_file.o' failed
make[2]: *** [io_stream_file.o] Error 1
   CXX    main.o
main.cc: In function ‘void main_display()’:
main.cc:166:22: error: invalid initialization of reference of type 
‘const IID&’ from expression of type ‘const GUID*’
/usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:261:11: error: in 
passing argument 1 of ‘HRESULT CoCreateInstance(const IID&, IUnknown*, 
DWORD, const IID&, void**)Â’
main.cc: In function ‘int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)’:
main.cc:250:15: error: ‘_argv’ was not declared in this scope
Makefile:830: recipe for target `main.o' failed
make[2]: *** [main.o] Error 1
   CXX    mkdir.o
In file included from ntdll.h:23:0,
                  from mkdir.cc:24:
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:512:16: error: 
redefinition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:101:37: error: 
previous definition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
invalid type in declaration before ‘,’ token
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
conflicting declaration ‘typedef int OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:5: error: 
‘OBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES OBJECT_ATTRIBUTESÂ’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:23: error: 
conflicting declaration ‘typedef int* POBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:25: error: 
‘POBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES* POBJECT_ATTRIBUTESÂ’
In file included from mkdir.cc:24:0:
ntdll.h:41:35: error: declaration of C function ‘NTSTATUS 
NtQueryInformationFile(void*, _IO_STATUS_BLOCK*, void*, ULONG, 
FILE_INFORMATION_CLASS)Â’ conflicts with
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:789:19: error: 
previous declaration ‘NTSTATUS NtQueryInformationFile(void*, 
_IO_STATUS_BLOCK*, void*, LONG, FILE_INFORMATION_CLASS)Â’ here
mkdir.cc: In function ‘int mkdir_p(int, const char*, mode_t)’:
mkdir.cc:75:6: error: ‘FILE_SHARE_VALID_FLAGS’ was not declared in this 
scope
mkdir.cc:75:30: error: ‘FILE_CREATE’ was not declared in this scope
mkdir.cc:76:6: error: ‘FILE_DIRECTORY_FILE’ was not declared in this scope
mkdir.cc:77:8: error: ‘FILE_SYNCHRONOUS_IO_NONALERT’ was not declared in 
this scope
mkdir.cc:78:8: error: ‘FILE_OPEN_FOR_BACKUP_INTENT’ was not declared in 
this scope
Makefile:830: recipe for target `mkdir.o' failed
make[2]: *** [mkdir.o] Error 1
   CXX    mklink2.o
In file included from ntdll.h:23:0,
                  from mklink2.cc:5:
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:512:16: error: 
redefinition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:101:37: error: 
previous definition of ‘struct _OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
invalid type in declaration before ‘,’ token
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:20: error: 
conflicting declaration ‘typedef int OBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:5: error: 
‘OBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES OBJECT_ATTRIBUTESÂ’
/usr/i686-w64-mingw32/sys-root/mingw/include/ntdef.h:519:23: error: 
conflicting declaration ‘typedef int* POBJECT_ATTRIBUTES’
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:114:25: error: 
‘POBJECT_ATTRIBUTES’ has a previous declaration as ‘typedef struct 
_OBJECT_ATTRIBUTES* POBJECT_ATTRIBUTESÂ’
In file included from mklink2.cc:5:0:
ntdll.h:41:35: error: declaration of C function ‘NTSTATUS 
NtQueryInformationFile(void*, _IO_STATUS_BLOCK*, void*, ULONG, 
FILE_INFORMATION_CLASS)Â’ conflicts with
/usr/i686-w64-mingw32/sys-root/mingw/include/winternl.h:789:19: error: 
previous declaration ‘NTSTATUS NtQueryInformationFile(void*, 
_IO_STATUS_BLOCK*, void*, LONG, FILE_INFORMATION_CLASS)Â’ here
mklink2.cc: In function ‘void make_link_2(const char*, const char*, 
const char*, const char*)Â’:
mklink2.cc:32:71: error: invalid initialization of reference of type 
‘const IID&’ from expression of type ‘const IID*’
mklink2.cc: At global scope:
mklink2.cc:115:3: error: ‘FILE_LINK_INFORMATION’ does not name a type
mklink2.cc: In function ‘int mkcyghardlink(const char*, const char*)’:
mklink2.cc:144:55: error: ‘FILE_SHARE_VALID_FLAGS’ was not declared in 
this scope
mklink2.cc:145:10: error: ‘FILE_OPEN_FOR_BACKUP_INTENT’ was not declared 
in this scope
mklink2.cc:145:40: error: ‘FILE_OPEN_REPARSE_POINT’ was not declared in 
this scope
mklink2.cc:150:24: error: ‘FILE_LINK_INFORMATION’ was not declared in 
this scope
mklink2.cc:151:8: error: ‘struct<anonymous>’ has no member named ‘fli’
mklink2.cc:152:8: error: ‘struct<anonymous>’ has no member named ‘fli’
mklink2.cc:153:8: error: ‘struct<anonymous>’ has no member named ‘fli’
mklink2.cc:154:16: error: ‘struct<anonymous>’ has no member named ‘fli’
mklink2.cc:155:49: error: ‘struct<anonymous>’ has no member named ‘fli’
Makefile:830: recipe for target `mklink2.o' failed
make[2]: *** [mklink2.o] Error 1


Yaakov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup-mingw64.patch
Type: application/x-itunes-itlp
Size: 3587 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20120601/2ca1b06a/attachment.bin>


More information about the Cygwin-apps mailing list