errors (and fix) building Harbour using gcc (MinGW.org GCC-6.3.0-1) 6.3.0

703 views
Skip to first unread message

Antonio Linares

unread,
Feb 14, 2018, 5:43:51 AM2/14/18
to Harbour Developers
In file included from ../../../hbsocket.c:223:0:
../../../hbsocket.c: In function 'hb_socketSetOsError':
../../../hbsocket.c:1109:12: error: 'ERROR_NOT_ENOUGH_MEMORY' undeclared (first use in this function)
       case WSA_NOT_ENOUGH_MEMORY:
            ^
../../../hbsocket.c:1109:12: note: each undeclared identifier is reported only once for each function it appears in
../../../hbsocket.c: In function 'hb_socketGetIFaces':
../../../hbsocket.c:4088:29: error: 'ERROR_BUFFER_OVERFLOW' undeclared (first use in this function)
             if( dwResult == ERROR_BUFFER_OVERFLOW )
                             ^~~~~~~~~~~~~~~~~~~~~
../../../hbsocket.c:4094:29: error: 'NO_ERROR' undeclared (first use in this function)
             if( dwResult == NO_ERROR )
                             ^~~~~~~~
../../../../../config/rules.mk:88: recipe for target 'hbsocket.o' failed
win-make[3]: *** [hbsocket.o] Error 1
../../config/lib.mk:68: recipe for target 'descend' failed
win-make[2]: *** [descend] Error 2
../config/dir.mk:71: recipe for target 'rtl' failed
win-make[1]: *** [rtl] Error 2
config/dir.mk:71: recipe for target 'src' failed
win-make: *** [src] Error 2

errors solved adding this code to c:\harbour\src\rtl\hbsocket.c

#include "hbsocket.h"

#ifndef ERROR_NOT_ENOUGH_MEMORY
   #define ERROR_NOT_ENOUGH_MEMORY 8
#endif

#ifndef ERROR_BUFFER_OVERFLOW
   #define ERROR_BUFFER_OVERFLOW 0x6F
#endif

#ifndef NO_ERROR
   #define NO_ERROR 0
#endif

best regards

Antonio

Aleksander Czajczynski

unread,
Feb 14, 2018, 6:23:22 AM2/14/18
to harbou...@googlegroups.com
Antonio Linares wrote:

#include "hbsocket.h"

#ifndef ERROR_NOT_ENOUGH_MEMORY
   #define ERROR_NOT_ENOUGH_MEMORY 8
#endif

#ifndef ERROR_BUFFER_OVERFLOW
   #define ERROR_BUFFER_OVERFLOW 0x6F
#endif

#ifndef NO_ERROR
   #define NO_ERROR 0
#endif

best regards

Antonio
These are very old definitions, dating back to OS/2 times at MS. What is "include/error.h" file distributed with that compiler? They should definitely be there.

Best regards, Aleksander Czajczynski

Antonio Linares

unread,
Feb 15, 2018, 2:30:18 AM2/15/18
to Harbour Developers


Aleksander,

There is no a "include/error.h" file. That error is defined inside winerror.h


It is the current gcc version

regards

Antonio

elch

unread,
Feb 15, 2018, 7:26:18 AM2/15/18
to Harbour Developers
Hi Antonio,


In file included from ../../../hbsocket.c:223:0:
../../../hbsocket.c: In function 'hb_socketSetOsError':
../../../hbsocket.c:1109:12: error: 'ERROR_NOT_ENOUGH_MEMORY' undeclared (first use in this function)
       case WSA_NOT_ENOUGH_MEMORY:
            ^
../../../hbsocket.c:1109:12: note: each undeclared identifier is reported only once for each function it appears in
../../../hbsocket.c: In function 'hb_socketGetIFaces':
../../../hbsocket.c:4088:29: error: 'ERROR_BUFFER_OVERFLOW' undeclared (first use in this function)
             if( dwResult == ERROR_BUFFER_OVERFLOW )
                             ^~~~~~~~~~~~~~~~~~~~~
../../../hbsocket.c:4094:29: error: 'NO_ERROR' undeclared (first use in this function)
             if( dwResult == NO_ERROR )
                             ^~~~~~~~
../../../../../config/rules.mk:88: recipe for target 'hbsocket.o' failed
win-make[3]: *** [hbsocket.o] Error 1
../../config/lib.mk:68: recipe for target 'descend' failed
win-make[2]: *** [descend] Error 2
../config/dir.mk:71: recipe for target 'rtl' failed
win-make[1]: *** [rtl] Error 2
config/dir.mk:71: recipe for target 'src' failed
win-make: *** [src] Error 2

errors solved adding this code to c:\harbour\src\rtl\hbsocket.c
no <fix>, but hacking against an ill C-compiler version.

To prove:
hbsocket.c: 223
#include <winsock2.h>
then further at C-compiler include level: -> winsock.h --> winerror.h

hbsocket.c: 1109
! WSA_NOT_ENOUGH_MEMORY !
translated in winsock2.h: --> ERROR_NOT_ENOUGH_MEMORY
and then MinGW can't resolve itself re-definition !

----
BECAUSE they define in winsock.h: 50
#define __WINSOCK_H_SOURCED__ 1

and then in winerror.h: 36
#ifndef __WINSOCK_H_SOURCED__
and so all the error definitions up to line 1604 will be miss.

best regards
Rolf

elch

unread,
Feb 15, 2018, 10:25:26 AM2/15/18
to Harbour Developers
addendum:

MinGW v6.3 clean compiles Harbour 3.2, if i replace package
w32api-5.0.2-mingw32-dev.tar.xz
with the version just before:
w32api-5.0.1-mingw32-dev.tar.xz

[ collected manually, not with MSYS -- unpacked in Linux ]
{ SF have actually problems ? -- i found it here:
http://sourceforge.mirrorservice.org/m/mi/mingw/MinGW/Base/w32api/w32api-5.0.1/
}

---
BTW, newest version of GCC is 7.3,
you get it using the MinGW-w64-mingw32[64] variant
( like HB 3.2 seem to use in the nightly binary for 5.3 )

But in my tests GCC 7.3 do not even execute for old Win version ...

best regards
Rolf

Massimo Belgrano

unread,
Feb 26, 2018, 9:52:44 AM2/26/18
to Harbour Project Main Developer List.
 i created with msys2 gcc 7.last version using for developing window 10  
my exe is able to run on window xp



--
You received this message because you are subscribed to the Google Groups "Harbour Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Massimo Belgrano
Delta Informatica S.r.l. (Cliccami per scoprire 

Massimo Belgrano

unread,
Feb 26, 2018, 10:29:07 AM2/26/18
to Harbour Project Main Developer List.
$ gcc --version
gcc.exe (Rev1, Built by MSYS2 project) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


elch

unread,
Mar 1, 2018, 3:33:38 PM3/1/18
to Harbour Developers
yes,

 i created with msys2 gcc 7.last version using for developing window 10  
my exe is able to run on window xp

my! mistake: i had *also* a 'clang' in the OS search path,
and tested a hbmk2 variant which prefers that, even it was build with gcc.
Workaround for that was to set ENV-var HB_COMPILER ( or to remove 'clang' )

[above do not touch my comment about MinGW 6.3 using an new ill header package ]


Harbour Build Info
---------------------------
Version: Harbour 3.2.0dev (r1801051438)
Compiler: MinGW GNU C 7.3 (64-bit)
Platform: Windows XP x64 5.2.3790 Service Pack 2

works ...

thanks ! for the hint
Reply all
Reply to author
Forward
0 new messages