Troubles making a 64 bit app.

277 views
Skip to first unread message

flicker177

unread,
Apr 29, 2020, 2:59:21 PM4/29/20
to Harbour Users
Hello all,

I have an old clipper app that I have ported to Harbour 32 bit and it works well. Just for the heck of it I thought I would try to compile it as a 64 bit app. I have installed the latest 64 bit Harbour and the 64 bit MinGW compiler from the Whosaway site. It won't compile, I get a GCC error. After a couple of days trying everything I could think of, I'm stuck.

To simplify the troubleshooting I tried to compile "hello.prg" the same way and I get the same error.


Here is my Harbour build:
D:\Sail-2020-64\Pgms>harbour -build

Harbour 3.2.0dev (r2003271400)
Copyright (c) 1999-2020, https://harbour.github.io/

Harbour Build Info
---------------------------
Version: Harbour 3.2.0dev (r2003271400)
Compiler: MinGW GNU C 9.3 (64-bit)
Platform: Windows 10 10.0
PCode version: 0.3
ChangeLog last entry: 2020-03-27 15:00 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
ChangeLog ID: a8ec2651fd87c938fca9eea27a34eb227783725b
Built on: Mar 28 2020 10:52:03
Build options: (Clipper 5.3b) (Clipper 5.x undoc)
---------------------------


Here is my MinGW build:
D:\Sail-2020-64\Pgms>gcc --version

gcc (MinGW-W64 x86_64-posix-dwarf, built by Brecht Sanders) 9.3.0
Copyright (C) 2019 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.


I have set the environment variable HB_ARCH:

D:\Sail-2020-64>set HB_ARCH
HB_ARCH=64


Here is the result of trying to compile "hello.prg"
D:\Sail-2020-64\Pgms>hbmk2 -comp=mingw64 hello.prg

Harbour 3.2.0dev (r2003271400)
Copyright (c) 1999-2020, https://harbour.github.io/
Compiling 'hello.prg'...
Lines 7, Functions/Procedures 1
Generating C source output to 'C:\Users\Bill\AppData\Local\Temp\hbmk_76hzin.dir\hello.c'... Done.
hbmk2: Error: Running C/C++ compiler. -1
gcc.exe -c -O3  -W -Wall -pipe -I"D:/Sail-2020-64/HB3264/include" C:/Users/Bill/AppData/Local/Temp/hbmk_76hzin.dir/hello.c C:/Users/Bill/AppData/Local/Temp/hbmk_43kwzc.c


To test the gcc compiler I compiled the usual "hello.c" (not the harbour output)
D:\Sail-2020-64\Pgms>gcc hello.c -ohello.exe

That compiles and runs fine:

D:\Sail-2020-64\Pgms>hello
Hello, World!


So...I'm most confused! The Harbour compiler seems to run fine, the gcc compiler runs fine on its own. I'm pretty good with Clipper code, not so much with the workings of C compilers. Can anyone help? I'd be most grateful for some insight.

Thanks!
--Bill

Mel Smith

unread,
Apr 29, 2020, 3:57:43 PM4/29/20
to Harbour Users
Hi Bill:

   Here is *my* build batch file for 64-bit apps. It relies on there being a MinGW 64-bit Compiler (mine is MinGW 9.3.0)

   and a 64-bit Harbour folder (Mine is c:\HB3264)

   I have created several 64-bit MinGW apps successfully with this build batch file.

-Mel


****** bldapp64.bat *****
rem   Start of bldapp64.bat
rem   You need an .hbp file, and a .rsp file to go along with this batch

@ECHO OFF
DEL HB930.LOG
CLS
IF ~%1==~ GOTO NOAPP
IF EXIST %1.hbp GOTO GOTHBP
GOTO NOHBP
:GOTHBP
REM Have to Ensure that MinGW Compiler is on path
SET _PATH=%PATH%
SET PATH=C:\MINGW930\MINGW64\BIN;C:\hb64\BIN
SET HB_PLATFORM=win
SET HB_CPU=x86_64
SET HB_COMPILER=MINGW64
SET HB_ARCH=64

DEL %1.EXE
echo .
echo . Compiling / linking %1.prg
echo .
\hb64\BIN\HBMK2 \hb64\contrib\xhb\XHB.HBC @%1.RSP -comp=mingw64 -workdir=\mgw\temp -rebuildall > %1.LOG 2>&1
SET PATH=%_PATH%
IF EXIST %1.EXE GOTO GOODBLD
ECHO .
ECHO .
ECHO .  Failed to create executable.
ECHO .
ECHO . View %1.LOG to see what happened.
ECHO .
PAUSE
ECHO .
GOTO ENDJOB

:GOODBLD
ECHO .
ECHO . Build Was Successful. %1.exe was created
ECHO . View HB930.LOG for info on Build
ECHO .
GOTO FINISH

:NOAPP
ECHO .
ECHO . Argument 1 must be the root name of the 'App' to be built
ECHO .
PAUSE
GOTO FINISH

:NOHBP
ECHO .
ECHO . There is NO Harbour .HBP File to get options from
ECHO .
PAUSE
GOTO FINISH

:FINISH

:ENDJOB
SET PATH=%_PATH%
ECHO . Deleting the .map, .tds files ...
ECHO .
DEL *.MAP
DEL *.TDS
SET HB_PLATFORM=
SET HB_CPU=
SET HB_COMPILER=
SET HB_ARCH=

rem End of bldapp64.bat

flicker177

unread,
Apr 29, 2020, 4:29:15 PM4/29/20
to Harbour Users


On Wednesday, April 29, 2020 at 3:57:43 PM UTC-4, Mel Smith wrote:

   Here is *my* build batch file for 64-bit apps. It relies on there being a MinGW 64-bit Compiler (mine is MinGW 9.3.0)
   I have created several 64-bit MinGW apps successfully with this build batch file.


Wow!! That works! I had to change the paths a bit to match mine and add an hbp and rsp file but that was easy and all is fine. Now I can study what's different from what I was doing before; that should be easy and educational. This is a great group!

Thanks so much for the instant response and help.

--Bill


Mel Smith

unread,
Apr 29, 2020, 5:56:18 PM4/29/20
to Harbour Users
Hi Bill:

   Glad you found the batch file useful.

   However, I'm just learning Harbour and MinGW, so I'm changing the bldapp64.bat file and trying new things out -- as I learn more.

   Also, I use an .HBP file and place some options in it -- which I don't understand very well, so I change that file also.

   I wish I knew more -- but every day is a learning experience.

   I do note, though, that my 64-bit apps seem a lot bigger than my prior 32-bit apps. And I don't know why.

   I also note that moving some options from the .hbp file to the command line in the batch file seems to work better. And I don't know why either.

   Anyway, please don't use me as a 'fountain of information'.  I definitely am not !  I'm just a beginner.

-Mel
 
 
Reply all
Reply to author
Forward
0 new messages