Tk Source Code

View Ticket
Login
Ticket UUID: 3076671
Title: CVS HEAD Tk build fails on win32 with msys/mingw
Type: Bug Version: obsolete: 8.6b1.1
Submitter: zoro2 Created on: 2010-09-27 16:29:28
Subsystem: 85. Win Build Assigned To: jan.nijtmans
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2014-03-13 09:03:06
Resolution: Fixed Closed By: nijtmans
    Closed on: 2010-09-28 08:23:20
Description:
Trying to build CVS HEAD Tk fails - probably after changes to support Unicode:

[23:02:58] 2  >> gcc -c -O2 -fomit-frame-pointer -DUNICODE -D_UNICODE -Wall -Wdeclaration-after-statement  -I"../../../sources/tk-8.6b1.2/win/../generic" -I"../../../sources/tk-8.6b1.2/win" -I"../../../sources/tk-8.6b1.2/win/../xlib" -I"../../../sources/tk-8.6b1.2/win/../bitmaps" -I"/y/cookit/sources/tcl-8.6b1.2//generic" -pipe -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DSTATIC_BUILD=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UXTHEME_H=1 -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1  -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_NO_SEH=1 -DEXCEPTION_DISPOSITION=int -DHAVE_WINNT_IGNORE_VOID=1 -DHAVE_ALLOCA_GCC_INLINE=1 -DHAVE_CAST_TO_UNION=1 -DTCL_CFGVAL_ENCODING=\"cp1252\" -DSTATIC_BUILD=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ZLIB=1 -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1   -DBUILD_tk -DBUILD_ttk "../../../sources/tk-8.6b1.2/win/tkWinSend.c" -o tkWinSend.o
[23:03:00] 2  >> In file included from ../../../sources/tk-8.6b1.2/win/tkWinSend.c:15:
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/tchar.h:41: error: syntax error before "TCHAR"
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/tchar.h:42: error: syntax error before "_TCHAR"
[23:03:00] 2  >> In file included from y:/cookit/sources/tcl-8.6b1.2/generic/tcl.h:2391,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/../generic/tkIntXlibDecls.h:25,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/../xlib/X11/Xlib.h:1196,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinPort.h:64,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/../generic/tkPort.h:20,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/../generic/tkInt.h:21,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinSend.c:16:
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:53: error: syntax error before '*' token
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:54: warning: type defaults to `int' in declaration of `Tcl_WinUtfToTChar'
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:54: warning: data definition has no type or storage class
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:56: warning: type defaults to `int' in declaration of `TCHAR'
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:56: error: syntax error before '*' token
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:77: error: syntax error before "TCHAR"
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:77: warning: no semicolon at end of struct or union
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:78: warning: type defaults to `int' in declaration of `TCHAR'
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:78: error: syntax error before '*' token
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:84: warning: type defaults to `int' in declaration of `TclPlatStubs'
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:84: warning: data definition has no type or storage class
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:89: error: syntax error before '*' token
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:89: warning: type defaults to `int' in declaration of `tclPlatStubsPtr'
[23:03:00] 2  >> y:/cookit/sources/tcl-8.6b1.2/generic/tclPlatDecls.h:89: warning: data definition has no type or storage class
[23:03:00] 2  >> In file included from Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/windef.h:246,
[23:03:00] 2  >>                  from Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/windows.h:48,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWin.h:38,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinInt.h:28,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinSendCom.h:19,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinSend.c:17:
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/winnt.h:96: error: syntax error before "TBYTE"
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/winnt.h:97: error: syntax error before '*' token
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/winnt.h:98: error: syntax error before '*' token
[23:03:00] 2  >> In file included from Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/windows.h:50,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWin.h:38,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinInt.h:28,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinSendCom.h:19,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinSend.c:17:
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/winbase.h:1026: error: syntax error before "LPCTSTR"
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/winbase.h:1027: error: syntax error before "LPCTSTR"
[23:03:00] 2  >> Y:/cookit/win32/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/winbase.h:1028: error: syntax error before "LPTSTR"
[23:03:00] 2  >> In file included from ../../../sources/tk-8.6b1.2/win/tkWinSendCom.h:19,
[23:03:00] 2  >>                  from ../../../sources/tk-8.6b1.2/win/tkWinSend.c:17:
[23:03:00] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinInt.h:190: error: syntax error before "LPCTSTR"
[23:03:00] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinInt.h:191: error: syntax error before "LPCTSTR"
[23:03:00] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinInt.h:193: error: syntax error before "LPCTSTR"
[23:03:00] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinInt.h:194: error: syntax error before "LPCTSTR"
[23:03:00] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinInt.h:195: warning: parameter names (without types) in function declaration
[23:03:00] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinInt.h:196: error: syntax error before "LPTSTR"
[23:03:00] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinSend.c: In function `Win32ErrorObj':
[23:03:01] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinSend.c:836: error: syntax error before "lpBuffer"
[23:03:01] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinSend.c:842: error: `lpBuffer' undeclared (first use in this function)
[23:03:01] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinSend.c:842: error: (Each undeclared identifier is reported only once
[23:03:01] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinSend.c:842: error: for each function it appears in.)
[23:03:01] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinSend.c:845: error: `sBuffer' undeclared (first use in this function)
[23:03:01] 2  >> ../../../sources/tk-8.6b1.2/win/tkWinSend.c:849: error: `p' undeclared (first use in this function)
[23:03:01] 2  >> make: *** [tkWinSend.o] Error 1
[23:03:01] 2 waitForExtCommand: Error: Command exited with code 2

Removing the following line from tkWinSend.c:15 resolves the issue, but I am not sure if it also works for non-MinGW builds on win32:
  * RCS: @(#) $Id: tkWinSend.c,v 1.24 2010/04/08 14:06:20 nijtmans Exp $
  */
-#include <tchar.h>
 #include "tkInt.h"
 #include "tkWinSendCom.h"
User Comments: nijtmans added on 2010-09-28 15:23:20:

allow_comments - 1

Thanks for this bug report!

This sounds like a mingw bug: tkIng.h includes tkPort.h, which includes tkWinPort.h, which finally includes <tchar.h>. It should not matter in which order header files are included, and including one twice should not matter either.

My main development is done on mingw32, and the latest mingw32 does not have this problem. So one workaround is simply upgrade to the latest mingw. Easier is just remove the first <tchar.h>, as you suggest, so this
header file will be picked up through tkInt.h anyway.

Thanks for your suggestion.