MinGW for Harbour Development

543 views
Skip to first unread message

David Allen

unread,
Dec 14, 2019, 1:14:36 PM12/14/19
to Harbour Users
Hello Harbour,

Could someone explain this to me or at least which is best for Harbour development.  I have no idea what all this is...posix, dwarf, etc. .


Respectfully,
David

Eric Lendvai

unread,
Dec 14, 2019, 3:24:59 PM12/14/19
to Harbour Users
Thanks David for asking that question !

I decided to use i686-win32-dwarf but was still not certain why.

David Allen

unread,
Dec 15, 2019, 4:22:05 PM12/15/19
to Harbour Users
Hello Harbour community,

I did some research and found this information scattered all over.  Here is what I found.  Hopefully it will help someone else..

What are x86_64 and i686?
i686 is a 32-bit instruction set (part of the x86 family line), while x86_64 is a 64-bit instruction set.  An operating system will either be 32 bit or 54 bit.

What are posix and win32?
This setting determines whether or not your code will take advantage of multithreading functionality. Posix supports multithreading while Win32 does not.

Posix and Win32 are Operating System Standards.  Android, Linux, and Unix are mostly compliant with this standard.  However, MinGW, a fork of Cygwin, provides a less POSIX-compliant development environment and supports compatible C-programmed applications via Msvcrt, Microsoft's old Visual C runtime library.  


What is a thread?
A thread is a sequence of such instructions within a program that can be executed independently of other code.  

Exception Handling
An exception is an error. This is used by the programming language to report error conditions. There are 3 types to be aware of when using MinGW

  • Seh
  • Windows uses its own exception handling mechanism known as Structured Exception Handling (SEH)
  • Dwarf
  • Must be used for 32 bit Windows Applications.
  • Sjlj
  • Must be used for 64 bit Windows Applications.

So, i686-win32-dwarf, as Eric points out is the best usage of MinGW targeting Windows 32 bit.

Please see his article for more information...

Respectfully,
David


Sources:

José M. C. Quintas

unread,
Dec 15, 2019, 6:47:21 PM12/15/19
to harbou...@googlegroups.com

I use what was recommended on Harbour 3.4, since old mingw.

Latest use:

x86_64-7.3.0-release-posix-sjlj-rt_v5-rev0

x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0

I allways use multithread.

Download is about 50MB.

Developer machine need to be 64 bits, but can create win32 or win64 applications.

https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.3.0/

Note:

To use 8.1, may be you need to add this on hbc file:

{mingw}CFLAGS=-Wno-implicit-fallthrough -Wno-cast-function-type -Wno-misleading-indentation

José M. C. Quintas

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/a9c9cfd8-65f0-4064-9809-4abfaaf3d2be%40googlegroups.com.

David Allen

unread,
Dec 15, 2019, 8:34:18 PM12/15/19
to Harbour Users
Thank you very much José.  I really appreciate your information.  I am just starting and trying to gain some advice from the experts (all of you).  

David

Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbou...@googlegroups.com.

Maurizio la Cecilia

unread,
Dec 16, 2019, 5:11:09 AM12/16/19
to harbou...@googlegroups.com
Hi David,
currently i'm using MSYS2 toolchains.
Please note that they come with sjlj error exception handler for i686 and seh for x86_64.

About the differences between the EEHs (from Qt wiki):

SJLJ (setjmp/longjmp):
 available for 32 bit and 64 bit
 not "zero-cost": even if an exception isn't thrown, it incurs a minor performance penalty (~15% in exception heavy code) but sometimes the penalty can be more significant

DWARF (DW2, dwarf-2)
 available for 32 bit only
 no permanent runtime overhead
 needs whole call stack to be dwarf-enabled, which means exceptions cannot be thrown over e.g. Windows system DLLs.

SEH (zero overhead exception)
 available for 64-bit GCC since 4.8 version.

An important thing to take in count: if you plan to link QT downloading the pre-built libraries, these are only 32bit and dwarf-2 compliant.
Thus, for 32bit install you need to build Harbour with the same dwarf-2 toolchain ( you find it here: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.3.0/threads-posix/dwarf/i686-7.3.0-release-posix-dwarf-rt_v5-rev0.7z/download ) or, for 64bit install, you need to build Qt from scratch (you find how here: https://wohlsoft.ru/pgewiki/Building_Qt_on_MinGW-w64 )

Personally, I prefer MYS2 toolchains because they are updated ( 9.2 is the current version instead of 7.3 ), resulting in more accurate checking in compile and enhanced executables speed.
If needed, I could make available Harbour binaries derived from MinGW 9.2 for both 32 and 64 bit.

Best regards.
--
Maurizio


Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/70277aa7-b7e3-4935-9c9a-58ad7ba2ac47%40googlegroups.com.


Massimo Belgrano

unread,
Dec 16, 2019, 6:54:18 AM12/16/19
to harbou...@googlegroups.com
Maurizio
Yes thank if you made aivailable Harbour binaries derived from MinGW 9.2 for both 32 and 64 bit.  amd fpr hbqt 
if possible using niglty from Francesco
imo msys2 is the better choice for harbour
Mi spego in italiano Ti sarei davvero grato se aggiorni i binari di harbour per 32 e 64 bit in una versione compatibile con hbqt e magari aggiornando harbour Nigltly  gestita da francesco suy https://sourceforge.net/projects/harbour-project/files/binaries-windows/nightly/harbour-nightly-win.exe/download




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

Maurizio la Cecilia

unread,
Dec 16, 2019, 7:42:37 AM12/16/19
to harbou...@googlegroups.com
Hi Massimo,
what I can do is to publish on my site Harbour binaries built for 32bit (sjlj flavour) and 64bit (seh flavour).
As I said, AFAIK, none of both is compatible with Qt binaries currently downloadable (because are 32bit dwarf-2 flavour).
Thus, to link Qt with Harbour libraries that I could build, you should compile Qt from scratch using MSYS2 MinGW compiler.
I did that and AFAIR, apart the long time it toke to build, I noticed some incompatibility due to the Qt sources, no such updated to build with newer versions of MinGW.

In addition, I can't use the web space of nightly builds of Francesco.
Perhaps, Mel in his whosaway.com repository is already planning to release a 9.2 version of binaries. Currently he's publishing 8.1 version and shouldn't have problems to update.

Best regards.
--
Maurizio

Mel Smith

unread,
Dec 16, 2019, 10:49:31 AM12/16/19
to Harbour Users


On Monday, December 16, 2019 at 5:42:37 AM UTC-7, Maurizio la Cecilia wrote:
Hi Massimo,
what I can do is to publish on my site Harbour binaries built for 32bit (sjlj flavour) and 64bit (seh flavour).
As I said, AFAIK, none of both is compatible with Qt binaries currently downloadable (because are 32bit dwarf-2 flavour).
Thus, to link Qt with Harbour libraries that I could build, you should compile Qt from scratch using MSYS2 MinGW compiler.
I did that and AFAIR, apart the long time it toke to build, I noticed some incompatibility due to the Qt sources, no such updated to build with newer versions of MinGW.

In addition, I can't use the web space of nightly builds of Francesco.
Perhaps, Mel in his whosaway.com repository is already planning to release a 9.2 version of binaries. Currently he's publishing 8.1 version and shouldn't have problems to update.

Best regards.
--
Maurizio

Hi Maurizio:

   I cannot find a link to a MinGW 9.2 version for download.
   If you provide a link, then I will try to update whosaway.com MinGW to 9.2
-Mel

 

 

Grigory Filatov

unread,
Dec 16, 2019, 1:41:11 PM12/16/19
to Harbour Users
Hi Mel,

Please be so kind to try the following link at


HTH,
Grigory

Massimo Belgrano

unread,
Dec 16, 2019, 1:46:15 PM12/16/19
to harbou...@googlegroups.com
Yes
good your site

Maurizio la Cecilia

unread,
Dec 16, 2019, 2:04:31 PM12/16/19
to harbou...@googlegroups.com
Hi Mel,
as I said I'm using MSYS2 for download and update the toolchains and the libraries needed to build my Harbour apps.
You can simply install MSYS2 and update via pacman the packages to obtain the 9.2 gcc compiler in both 32 and 64bit flavour.
A good guide is at: https://solarianprogrammer.com/2019/11/05/install-gcc-windows/

Best regards.
--
Maurizio
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Mel Smith

unread,
Dec 16, 2019, 4:41:12 PM12/16/19
to Harbour Users
Hi Grigory:
   I have downloaded, extracted to c:\MinGW920, and will test later today hopefully.
Thank you !
-Mel Smith

Mel Smith

unread,
Dec 16, 2019, 4:44:03 PM12/16/19
to Harbour Users
Hi Maurizio:
  I will test your usage of MinGw 9.2.0 under msys2  after I try out Grigory's offering.
Thank you. 
-Mel


Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbou...@googlegroups.com.

Mel Smith

unread,
Dec 16, 2019, 8:42:19 PM12/16/19
to Harbour Users


On Monday, December 16, 2019 at 11:41:11 AM UTC-7, Grigory Filatov wrote:
Hi Mel,

Please be so kind to try the following link at


HTH,
Grigory

Hi Grigory:

   I tried to create a 32-bit build for Harbour 3.2 from your MinGW 9.2.0 download link.

   Here is my log of the build which shows an almost immediate crash when trying to compile png.o from png .c

   I don't know what change I should make to get this very first compilation to work properly ?

Thanks for any iguidance you may wish to provide:

-Mel
 
***** MG920LOG.TST *****
! Building Harbour 3.2.0dev from source - https://harbour.github.io
! MAKE: c:/harbour/WIN-MAKE 4.1 sh.exe
! HB_INSTALL_PREFIX: c:\harbour
! HB_HOST_PLAT: win (x86_64)  HB_SHELL: nt
! HB_PLATFORM: win (x86) (auto-detected)
! HB_COMPILER: mingw
! Component: 'zlib' found in C:/harbour/src/3rd/zlib (local)
! Component: 'pcre' found in C:/harbour/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
WIN-MAKE[1]: Nothing to be done for 'all'.
WIN-MAKE[1]: Nothing to be done for 'all'.
! 'hbdossrl' library skipped (platform or compiler not supported)
gcc   -I. -I../../../../../../include -Wmissing-braces -Wreturn-type -Wformat -Wimplicit-int -Wimplicit-function-declaration -O3 -fomit-frame-pointer -march=i586 -mtune=pentiumpro  -DUNICODE -IC:/harbour/src/3rd/zlib DPNG_NO_STDIO  -opng.o  -c ../../../png.c
../../../../../../config/rules.mk:88: recipe for target 'png.o' failed
process_begin: CreateProcess(NULL, gcc -I. -I../../../../../../include -Wmissing-braces -Wreturn-type -Wformat -Wimplicit-int -Wimplicit-function-declaration -O3 -fomit-frame-pointer -march=i586 -mtune=pentiumpro -DUNICODE -IC:/harbour/src/3rd/zlib -DPNG_NO_STDIO -opng.o -c ../../../png.c, ...) failed.
make (e=2): The system cannot find the file specified.
WIN-MAKE[4]: *** [png.o] Error 2
../../../config/lib.mk:68: recipe for target 'descend' failed
WIN-MAKE[3]: *** [descend] Error 2
../../config/dir.mk:71: recipe for target 'png' failed
WIN-MAKE[2]: *** [png] Error 2
../config/dir.mk:71: recipe for target '3rd' failed
WIN-MAKE[1]: *** [3rd] Error 2
config/dir.mk:71: recipe for target 'src' failed
WIN-MAKE: *** [src] Error 2

**********
 

Grigory Filatov

unread,
Dec 17, 2019, 3:20:20 AM12/17/19
to Harbour Users
Hi Mel,

> I tried to create a 32-bit build for Harbour 3.2 
it is expected behavior because the author of this distro wrote:

My MinGW distribution ("distro") is x64-native

Please try the above MinGW build with Harbour 3.4 ;-)

HTH,
Grigory

вторник, 17 декабря 2019 г., 3:42:19 UTC+2 пользователь Mel Smith написал:

Eric Lendvai

unread,
Dec 17, 2019, 5:56:02 AM12/17/19
to Harbour Users
Thanks Maurizio for all the info as well. I guess I should update the Article I create about installing Harbour to add all this info, from you and others.
I am just first finishing the FastCGI article ... longer than I planned. 
Should have some time after that to contact you, Thanks !!!

Maurizio la Cecilia

unread,
Dec 17, 2019, 7:11:15 AM12/17/19
to Harbour User Group
Hi Mel,
please try to add:
HB_WITH_MINIZIP=local

I hope it's the culprit of the png issue.

Best regards
--
Maurizio


--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Mel Smith

unread,
Dec 17, 2019, 10:35:14 AM12/17/19
to Harbour Users


On Tuesday, December 17, 2019 at 5:11:15 AM UTC-7, Maurizio la Cecilia wrote:
Hi Mel,
please try to add:
HB_WITH_MINIZIP=local

I hope it's the culprit of the png issue.

Best regards
--
Maurizio


Hi Maurizio:

  Sorry, but the log shows the exact same error as the previous one:  failure to compile png.c to png.o

   Going golfing with my son all day today, so will not be able to do any more testing until tomorrow..
-Mel
  

Mel Smith

unread,
Dec 17, 2019, 10:45:57 AM12/17/19
to Harbour Users
Addendum:

   Below is the essential portion of my build batch file.

   This test script uses Grigory's 32-bit fork of his MinGW 9.2 64-bit package

-Mel
 
***** small part of bldhrbmg.bat *****
:DO920
ECHO .
ECHO .
SET HB_COMPILER=mingw
SET HB_WITH_MINIZIP=local
SET PATH=C:\mingw920\x86_64-w64-mingw32;c:\mingw920\x86_64-w64-mingw32\bin;c:\mingw920\x86_64-w64-mingw32\include;c:\mingw920\x86_64-w64-mingw32\lib;c:\harbour\bin
GOTO DOINSTAL

:DOINSTAL
c:\harbour\WIN-MAKE >\MG%1%LOG.TXT 2>&1
GOTO FINISH

:finish
SET HB_INSTALL_PREFIX=
SET HB_WITH_ADS=
SET HB_BUILD_IMPLIB=
SET HB_COMPILER=
SET HB_WITH_MINIZIP=
SET PATH=%MWSPATH%
CD \
  

Maurizio la Cecilia

unread,
Dec 17, 2019, 11:57:46 AM12/17/19
to harbou...@googlegroups.com
Hum, thus the issue could be due to the MinGW distro.
What I can assure is that MinGW based on MSYS2 builds fine Harbour, both for 32bit and 64bit.
Perhaps the MSYS2 path I suggested is the better choice.

Anyway, just for curiosity, why you're including in the system path also the library and the include folders?
AFAIK, only binary files are searched in path.
Also C:\mingw920\x86_64-w64-mingw32; should be needless, but I don't know the content of the distro suggested by Grigory.

Best regards and good golfing.
--
Maurizio
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Maurizio la Cecilia

unread,
Dec 17, 2019, 3:11:43 PM12/17/19
to harbou...@googlegroups.com
Hi Massimo and others interested,
waiting for Mel builds, you can download Windows binaries of current version of Harbour 3.2 built with MinGW 9.2 for both 32bit and 64bit at:
https://software.mlacecilia.com/harbour_32_MinGW92.7z

Please, let me know about any issue.
Best regards.
--
Maurizio

David Allen

unread,
Dec 17, 2019, 7:43:42 PM12/17/19
to harbou...@googlegroups.com
Thank you very much Maurizio for this and the previous information.  I'm sorry to respond so slow.

This thread, like so many others here, really help me to understand Harbour.  You all are providing awesome information which I will be able to share with other's beginning Harbour some day.

Respectfully,
David

Mel Smith

unread,
Dec 18, 2019, 12:44:05 PM12/18/19
to Harbour Users


On Tuesday, December 17, 2019 at 9:57:46 AM UTC-7, Maurizio la Cecilia wrote:
Hum, thus the issue could be due to the MinGW distro.
What I can assure is that MinGW based on MSYS2 builds fine Harbour, both for 32bit and 64bit.
Perhaps the MSYS2 path I suggested is the better choice.

Anyway, just for curiosity, why you're including in the system path also the library and the include folders?
AFAIK, only binary files are searched in path.
Also C:\mingw920\x86_64-w64-mingw32; should be needless, but I don't know the content of the distro suggested by Grigory.


Hi Maurizio:

   I made a few changes in m test build file (see below) but the identical error occurs: failed to compile png.c into png.o

   So, I'm going to withdraw from this and 'lick my wounds' for awhile.
Sorry.

-Mel
 
*****build batch file fragment *****
:DO920
ECHO .
ECHO .
SET HB_COMPILER=mingw
SET HB_WITH_MINIZIP=local
SET INCLUDE=c:\mingw920\x86_64-w64-mingw32\include;c:\harbour\include;%MWSINCLUDE%
SET LIB=c:\mingw920\x86_64-w64-mingw32\lib;c:\harbour\lib;
SET PATH=c:\mingw920\x86_64-w64-mingw32\bin;c:\harbour\bin
GOTO DOINSTAL

:DOINSTAL
c:\harbour\WIN-MAKE >\MG%1%LOG.TXT 2>&1
GOTO FINISH

:finish
SET HB_INSTALL_PREFIX=
SET HB_WITH_ADS=
SET HB_BUILD_IMPLIB=
SET HB_COMPILER=
SET HB_WITH_MINIZIP=
SET PATH=%MWSPATH%
SET INCLUDE=%MWSINCLUDE%
SET LIB=%MWSLIB%
**********

Mel Smith

unread,
Dec 20, 2019, 11:45:29 PM12/20/19
to Harbour Users
Hi All:

   FYI:  I have posted on www.whosaway.com Harbour 3.2 64-bit Version (1912031042) built under MinGW 9.2.0 This MinGW920 version is standalone (i.e., it does not use msys64 for its creation)

   I thank Grigory Filatov for his repo of MinGW 9.2.0 and Mauricio la Cecilia for his efforts to help me overcome my compile errors. This MinGW version does not allow me to create a 32-bit version (or at least, I don't know how to accomplish this after two days of 'head beating on desk')

   Hope some of you can download this package and test it for speed and correctness.

-Mel Smith



Reply all
Reply to author
Forward
0 new messages