Closed omm closed 6 years ago
Trying OpenWatcom 2.0 in cpp mode gives more meaningful errors... so TCHAR/Unicode seems a bit non-consistent there. Do you have other versions of OpenWatcom to compare?
hbexpat\3rd\expat\loadlibr.cpp(110): Error! E473: col(14) function argument(s) do not match those in prototype hbexpat\3rd\expat\loadlibr.cpp(110): Note! N392: col(14) definition: 'char __watcall strpbrk( char const , char const )' hbexpat\3rd\expat\loadlibr.cpp(110): Note! N643: col(14) cannot convert argument 1 defined in: hbexpat\3rd\expat\loadlibr.cpp(110) (col 15) hbexpat\3rd\expat\loadlibr.cpp(110): Note! N630: col(14) source conversion type is 'wchar_t const (lvalue)' hbexpat\3rd\expat\loadlibr.cpp(110): Note! N631: col(14) target conversion type is 'char const ' hbexpat\3rd\expat\loadlibr.cpp(129): Error! E473: col(35) function argument(s) do not match those in prototype hbexpat\3rd\expat\loadlibr.cpp(129): Note! N392: col(35) definition: 'unsigned __watcall strlen( char const )' hbexpat\3rd\expat\loadlibr.cpp(129): Note! N643: col(35) cannot convert argument 1 defined in: hbexpat\3rd\expat\loadlibr.cpp(129) (col 36) hbexpat\3rd\expat\loadlibr.cpp(129): Note! N630: col(35) source conversion type is 'wchar_t const (lvalue)' hbexpat\3rd\expat\loadlibr.cpp(129): Note! N631: col(35) target conversion type is 'char const ' hbexpat\3rd\expat\loadlibr.cpp(130): Error! E400: col(19) cannot convert right expression for initialization hbexpat\3rd\expat\loadlibr.cpp(130): Note! N630: col(19) source conversion type is 'void ' hbexpat\3rd\expat\loadlibr.cpp(130): Note! N631: col(19) target conversion type is 'wchar_t ' hbexpat\3rd\expat\loadlibr.cpp(133): Error! E473: col(31) function argument(s) do not match those in prototype hbexpat\3rd\expat\loadlibr.cpp(133): Note! N392: col(31) definition: 'unsigned __watcall strlen( char const )' hbexpat\3rd\expat\loadlibr.cpp(133): Note! N643: col(31) cannot convert argument 1 defined in: hbexpat\3rd\expat\loadlibr.cpp(133) (col 32) hbexpat\3rd\expat\loadlibr.cpp(133): Note! N630: col(31) source conversion type is 'wchar_t (lvalue)' hbexpat\3rd\expat\loadlibr.cpp(133): Note! N631: col(31) target conversion type is 'char const ' hbexpat\3rd\expat\loadlibr.cpp(134): Error! E473: col(31) function argument(s) do not match those in prototype hbexpat\3rd\expat\loadlibr.cpp(134): Note! N392: col(31) definition: 'unsigned __watcall strlen( char const )' hbexpat\3rd\expat\loadlibr.cpp(134): Note! N643: col(31) cannot convert argument 1 defined in: hbexpat\3rd\expat\loadlibr.cpp(134) (col 32) hbexpat\3rd\expat\loadlibr.cpp(134): Note! N630: col(31) source conversion type is 'wchar_t (lvalue)' hbexpat\3rd\expat\loadlibr.cpp(134): Note! N631: col(31) target conversion type is 'char const '
With open watcom 1.9 the same result:
Open Watcom C/C++ Compiler Driver Program Version 1.9
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
! Building Harbour 3.2.0dev from source - http://harbour-project.org
! MAKE: win-make 4.1 sh.exe clean install
! HB_INSTALL_PREFIX: e:\dev\harb_ow19
! HB_BUILD_DYN: no
! HB_BUILD_CONTRIB_DYN: no
! HB_BUILD_SHARED: no
! HB_BUILD_STRIP: all
! HB_HOST_PLAT: win (x86_64) HB_SHELL: nt
! HB_PLATFORM: win (x86) (auto-detected)
! HB_COMPILER: watcom (auto-detected: C:/watcom19/BINNT/)
! Component: 'zlib' found in E:/dev/core/src/3rd/zlib (local)
! Component: 'pcre' found in E:/dev/core/src/3rd/pcre (local)
! Component: 'gpm' not supported on win platform
! Component: 'slang' not found. Configure with HB_WITH_SLANG.
! Component: 'curses' not found. Configure with HB_WITH_CURSES.
! Component: 'x11' not found. Configure with HB_WITH_X11.
! Component: 'wattcp/watt-32' not supported on win platform
! GIT_REVISION: b872d7b62c
...
E:\dev\core\bin\win\watcom\hbmk2 -quiet -width=0 -autohbm- @hbpre -inc -rebuildall ../contrib/hbexpat/3rd/expat/expat.hbp @hbpost
..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Error! E1071: Type of parameter 1 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2003: source conversion type is 'unsigned short const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2004: target conversion type is 'char const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Error! E1071: Type of parameter 2 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2003: source conversion type is 'unsigned short '
..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2004: target conversion type is 'char const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2002: 'strpbrk' defined in: C:\watcom19\H\string.h(170)
..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Error! E1071: Type of parameter 1 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Note! N2003: source conversion type is 'unsigned short const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Note! N2004: target conversion type is 'char const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Note! N2002: 'strlen' defined in: C:\watcom19\H\string.h(166)
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Error! E1071: Type of parameter 1 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2003: source conversion type is 'unsigned short '
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2004: target conversion type is 'char const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2002: 'strlen' defined in: C:\watcom19\H\string.h(166)
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Error! E1071: Type of parameter 1 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2003: source conversion type is 'unsigned short '
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2004: target conversion type is 'char '
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Error! E1071: Type of parameter 2 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2003: source conversion type is 'unsigned short '
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2004: target conversion type is 'char const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2002: 'strcpy' defined in: C:\watcom19\H\string.h(163)
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Error! E1071: Type of parameter 1 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2003: source conversion type is 'unsigned short '
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2004: target conversion type is 'char const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2002: 'strlen' defined in: C:\watcom19\H\string.h(166)
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Error! E1071: Type of parameter 1 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2003: source conversion type is 'unsigned short '
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2004: target conversion type is 'char '
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Error! E1071: Type of parameter 2 does not agree with previous definition
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2003: source conversion type is 'unsigned short const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2004: target conversion type is 'char const '
..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2002: 'strcpy' defined in: C:\watcom19\H\string.h(163)
hbmk2[expat]: Error: Running C/C++ compiler. 8
hbmk2[expat]: Exit status: 6: failed in compilation (Harbour, C compiler, Resource compiler)
! Finished package rebuild and install...
makefile:8: recipe for target 'install' failed
win-make[1]: [install] Error 6
config/dir.mk:68: recipe for target 'contrib.inst' failed
win-make: [contrib.inst] Error 2
Thanks for the info. Attached patch makes it compile, as a workaround. I'm not a regular user of Watcom compilers, so have no knowledge about it's quirks. Guess we should report at https://github.com/open-watcom/open-watcom-v2
Code origins from: https://github.com/libexpat/libexpat/blob/master/expat/lib/loadlibrary.c https://github.com/curl/curl/blob/master/lib/system_win32.c
diff --git a/contrib/hbexpat/3rd/expat/loadlibr.c b/contrib/hbexpat/3rd/expat/loadlibr.c
index 35fdf98..b230c4a 100644
--- a/contrib/hbexpat/3rd/expat/loadlibr.c
+++ b/contrib/hbexpat/3rd/expat/loadlibr.c
@@ -33,8 +33,14 @@
#if defined(_WIN32)
#include <windows.h>
-#include <tchar.h>
+#if defined(__WATCOMC__) && defined(UNICODE)
+# define _tcslen wcslen
+# define _tcspbrk wcspbrk
+# define _tcscpy wcscpy
+#else
+# include <tchar.h>
+#endif
HMODULE _Expat_LoadLibrary(LPCTSTR filename);
@@ -114,7 +120,7 @@ HMODULE _Expat_LoadLibrary(LPCTSTR filename)
/* Allocate space for the full DLL path (Room for the null terminator
is included in systemdirlen) */
size_t filenamelen = _tcslen(filename);
- TCHAR *path = malloc(sizeof(TCHAR) * (systemdirlen + 1 + filenamelen));
+ TCHAR *path = (TCHAR *) malloc(sizeof(TCHAR) * (systemdirlen + 1 + filenamelen));
if(path && GetSystemDirectory(path, systemdirlen)) {
/* Calculate the full DLL path */
_tcscpy(path + _tcslen(path), TEXT("\\"));
Przemek fixed it in https://github.com/harbour/core/commit/bed5e8eb46435d0918b7bbd79fb10fe3d0b16436, saying that expat code needs to #define _UNICODE too. https://github.com/harbour/core/commit/bed5e8eb46435d0918b7bbd79fb10fe3d0b16436#diff-f966e072766722204c623b316b709217
Open Watcom C/C++ x86 32-bit Compiler Driver Program Version 2.0 beta Dec 14 2017 06:08:37 (32-bit) Copyright (c) 2002-2017 The Open Watcom Contributors. All Rights Reserved. Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. ! Building Harbour 3.2.0dev from source - http://harbour-project.org ! MAKE: win-make 4.1 sh.exe clean install
! HB_INSTALL_PREFIX: e:\dev\harb_ow ! HB_BUILD_DYN: no ! HB_BUILD_CONTRIB_DYN: no ! HB_BUILD_SHARED: no ! HB_BUILD_STRIP: all ! HB_HOST_PLAT: win (x86_64) HB_SHELL: nt ! HB_PLATFORM: win (x86) (auto-detected) ! HB_COMPILER: watcom (auto-detected: C:/watcom/BINNT/) ! Component: 'zlib' found in E:/dev/core/src/3rd/zlib (local) ! Component: 'pcre' found in E:/dev/core/src/3rd/pcre (local) ! Component: 'gpm' not supported on win platform ! Component: 'slang' not found. Configure with HB_WITH_SLANG. ! Component: 'curses' not found. Configure with HB_WITH_CURSES. ! Component: 'x11' not found. Configure with HB_WITH_X11. ! Component: 'wattcp/watt-32' not supported on win platform ! GIT_REVISION: 517b7654dd ... E:\dev\core\bin\win\watcom\hbmk2 -quiet -width=0 -autohbm- @hbpre -inc -rebuildall ../contrib/hbexpat/3rd/expat/expat.hbp @hbpost ..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Error! E1176: Parameter 1, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2003: source conversion type is 'unsigned short const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2004: target conversion type is 'char const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Error! E1176: Parameter 2, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2003: source conversion type is 'unsigned short ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2004: target conversion type is 'char const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(97): Note! N2002: 'strpbrk' defined in: C:\watcom\H\string.h(145) ..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Error! E1176: Parameter 1, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Note! N2003: source conversion type is 'unsigned short const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Note! N2004: target conversion type is 'char const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(116): Note! N2002: 'strlen' defined in: C:\watcom\H\string.h(141) ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Error! E1176: Parameter 1, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2003: source conversion type is 'unsigned short ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2004: target conversion type is 'char const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2002: 'strlen' defined in: C:\watcom\H\string.h(141) ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Error! E1176: Parameter 1, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2003: source conversion type is 'unsigned short ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2004: target conversion type is 'char ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Error! E1176: Parameter 2, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2003: source conversion type is 'unsigned short ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2004: target conversion type is 'char const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(120): Note! N2002: 'strcpy' defined in: C:\watcom\H\string.h(138) ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Error! E1176: Parameter 1, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2003: source conversion type is 'unsigned short ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2004: target conversion type is 'char const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2002: 'strlen' defined in: C:\watcom\H\string.h(141) ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Error! E1176: Parameter 1, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2003: source conversion type is 'unsigned short ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2004: target conversion type is 'char ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Error! E1176: Parameter 2, pointer type mismatch ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2003: source conversion type is 'unsigned short const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2004: target conversion type is 'char const ' ..\contrib\hbexpat\3rd\expat\loadlibr.c(121): Note! N2002: 'strcpy' defined in: C:\watcom\H\string.h(138) hbmk2[expat]: Error: Running C/C++ compiler. 1 hbmk2[expat]: Exit status: 6: failed in compilation (Harbour, C compiler, Resource compiler) ! Finished package rebuild and install... makefile:8: recipe for target 'install' failed win-make[1]: [install] Error 6 config/dir.mk:68: recipe for target 'contrib.inst' failed win-make: [contrib.inst] Error 2