OT: Building Hello.prg under xHarbour with MinGW452

75 views
Skip to first unread message

Mel_the_Snowbird

unread,
Aug 5, 2011, 1:19:33 PM8/5/11
to Harbour Users
Hi:


I've managed to build single-threaded xHarbour under MinGW452
successfully along with Contribs and DLLs

I wen into the ..\tests\ sub-dir and tried to build the hello.prg
test program.

During the building process, I had the build file (GC.BAT) returned
the following messages:

First, a long path ../../../etcetera/into mingw452/..mingw32/bin/
ld.exe: "cannot find : No such File or Directory"

Second, "collect2: ld returned 1 exit status"

During the build process, both hello.c and hello.o were created
correctly.

What is the GCC-DW2.exe (or ld.exe) looking for.

Aprreciate any hints.

Thank you
-Mel Smith

Massimo Belgrano

unread,
Aug 5, 2011, 1:27:32 PM8/5/11
to harbou...@googlegroups.com
Are you use hbmk2 with xharbour or harbour .. and wich version [x]harbour mingw?

same bad dll (part of old mingw) in path or in curdir?

2011/8/5 Mel_the_Snowbird <meds...@aol.com>

--
Massimo Belgrano

Mel_the_Snowbird

unread,
Aug 5, 2011, 3:44:55 PM8/5/11
to Harbour Users
Massimo said:

I built xHarbour (Build 9382) (single-threaded) with MinGW4.5.2
successfully

Then, I went into my \xhb\tests\ sub-dir and used the batch file
included below (GC.BAT) to *try* to build hello.prg

The build went properly : building hello.c, then hello.o, until
failing as per the error messages in the original post

To mu unsophisticated eyes looking at the log file, I see that
ld.exe was executed, then failed because it couldn't find some file or
directory. But *which* file ???

Single-threaded xHarbour.exe was built. New DLLs were built, New
contribs were built. I use only minGW4.5.2 on the path.

(Of course, if I were using Harbour (instead of xHarbour), I would
use hbmk2 )

My object is to try to move xHarbour toward MinGW -- instead of BCC
5.5.1, then do a speed comparison between Harbour and xHarbour. But
*first* I must get xHarbour working properly with MinGW4.5.2. Trying
to build xHarbour with Multi-threading doesn't work for me -- for now.


Thanks,
-Mel


******* here is my GC.BAT app building files located in the ..\tests\
sub-dir

@echo off
REM
REM BATCH FILE FOR MINGW
REM
SET _MINGWDIR_=MINGW452
SET CC_DIR=..\..\%_MINGWDIR_%
REM SET _MYLIB=-Wl,--start-group, -lcodepage -lrddads -lzlib -lmisc -
lvm -lrtl -lrdd -lct -lgtwin -lmacro -ldbfcdx -ldbfntx -ldbffpt -
lhbsix -lhsx -lpcrepos -lcommon -lpp -llang -Wl,--end-group -luser32 -
lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lwinmm -lmpr -lole32 -luuid -
loleaut32 -liphlpapi
SET _MYLIB=-Wl,--start-group, -lcodepage -lvm -lrtl -lrdd -lct -lgtwin
-lmacro -ldbfcdx -ldbfntx -ldbffpt -lhbsix -lhsx -lpcrepos -lcommon -
lpp -llang -Wl,--end-group -luser32 -lwinspool -lcomctl32 -lcomdlg32 -
lgdi32 -lwinmm -lmpr -lole32 -luuid -loleaut32 -liphlpapi
SET HARBOURDIR=..
SET HARBOURLIB=%HARBOURDIR%\lib\gc
SET HARBOUREXE=%HARBOURDIR%\bin\gc\harbour.exe
SET _PATH=%PATH%
SET PATH=%CC_DIR%\BIN;..\BIN\GC;%_PATH%
SET __COMPILERLIBS=user32.lib winspool.lib ole32.lib oleaut32.lib
advapi32.lib winmm.lib mpr.lib

IF "%1" == "" GOTO syntax
IF NOT EXIST %1.prg GOTO noexist
IF NOT EXIST %HARBOUREXE% GOTO noharbour
IF EXIST %1.exe DEL %1.exe
IF EXIST %1.c DEL %1.c
IF EXIST %1.o DEL %1.o

REM MWS - May 3/11 Remove the /kmo option
REM HARBOUR %1.prg /d__ST__ /d__GCC__ /n /i%HARBOURDIR%\include /gc3 /
es2 /w /l /kmo
HARBOUR %1.prg /d__ST__ /d__GCC__ /n /i%HARBOURDIR%\include /gc3 /es2 /
w /l
IF NOT EXIST %1.c GOTO end

GCC-DW2 %1.c -D__WIN32__ -Wall -mno-cygwin -O3 -flto -fomit-frame-
pointer -march=i586 -mtune=pentiumpro -c -I../INCLUDE -I../../
%_MINGWDIR_%/INCLUDE
IF NOT EXIST %1.o GOTO end

GCC-DW2 -WAll -o%1GC.exe %1.o -mno-cygwin %_MYLIB% -L../../%_MINGWDIR_
%/LIB -L../LIB/GC
IF EXIST %1GC.exe dir %1GC.exe
IF EXIST %1GC.exe ECHO.
IF EXIST %1GC.exe ECHO %1GC.exe succesfully built
IF EXIST %1GC.exe ECHO.
GOTO end

:syntax
ECHO.
ECHO Syntax: GC program [ do NOT specify prg extension ]
ECHO.
GOTO end

:noexist
ECHO.
ECHO Cannot find %1.prg file
ECHO.
GOTO end

:noharbour
ECHO.
ECHO Cannot find Harbour.exe
ECHO.
GOTO end

:end
SET PATH=%_PATH%
SET _PATH=
SET HARBOUREXE=
SET HARBOURLIB=
SET HARBOURDIR=
SET __COMPILERLIBS=
SET _MYLIB=
SET CC_DIR=
SET _MINGWDIR_=

**************

Massimo Belgrano

unread,
Aug 5, 2011, 5:09:29 PM8/5/11
to harbou...@googlegroups.com
imo you must lost gc.bat way and use hbmk2 using  -xhb flag
I am using hbmk2 anso on xharbour project
need only path to c compiler

2011/8/5 Mel_the_Snowbird <meds...@aol.com>
Massimo said:

  I built xHarbour (Build 9382) (single-threaded) with MinGW4.5.2
successfully

  Then, I went into my \xhb\tests\ sub-dir and used the batch file
included below (GC.BAT) to *try* to build hello.prg

  The build went properly :   building hello.c, then hello.o, until
failing as per the error messages in the original post

  To mu unsophisticated eyes looking at the log file, I see that
ld.exe was executed, then failed because it couldn't find some file or
directory. But *which* file ???

  Single-threaded xHarbour.exe was built. New DLLs were built, New
contribs were built.  I use only minGW4.5.2 on the path.

  (Of course, if I were using Harbour (instead of xHarbour), I would
use hbmk2 )

  My object is to try to move xHarbour toward MinGW -- instead of BCC
5.5.1, then do a speed comparison between Harbour and xHarbour.  But
*first* I must get xHarbour working properly with MinGW4.5.2.   Trying
to build xHarbour with Multi-threading doesn't work for me -- for now.


Thanks,
-Mel



**************

--
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



--
Massimo Belgrano

Mel_the_Snowbird

unread,
Aug 5, 2011, 8:05:22 PM8/5/11
to Harbour Users
Massimo said:


On Aug 5, 3:09 pm, Massimo Belgrano <mbelgr...@deltain.it> wrote:
> imo you must lost gc.bat way and use hbmk2 using  -xhb flag
> I am using hbmk2 anso on xharbour project
> need only path to c compiler

Massimo:

I would *really* like to know why my batch file (GC.BAT) is
failing, and make Xharbour under MinGW more like the current xHarbour.

Would you mind using the batch file to attempt to build Hello.prg ?

(I hate to leave this problem unsolved --- even *If* hbmk2 is the
final app-making tool we have.)

Thanks

-Mel Smith

Viktor Szakáts

unread,
Aug 5, 2011, 8:31:19 PM8/5/11
to harbou...@googlegroups.com
  I would *really* like to know why my batch file (GC.BAT) is 
failing, and make Xharbour under MinGW more like the current xHarbour. 
>
>  Would you mind using the batch file to attempt to build Hello.prg ? 
>
>  (I hate to leave this problem unsolved --- even *If* hbmk2 is the 
>final app-making tool we have.)
 

Well, if you insist to solve this xHarbour problem with the help of 
Harbour developers, you may want to add -trace hbmk2 option to 
what Massimo suggested, to get a list of exact command lines executed.
Then you can copy these lines to an MS-DOS batch file.

Also I strongly suggest to use mingw 4.5.2 from the nightly or 3.0.0 final 
binary, to avoid any possible pitfalls with a local tdm installation. 

Viktor

Mel_the_Snowbird

unread,
Aug 6, 2011, 10:52:31 AM8/6/11
to Harbour Users
Viktor said:

> Well, if you insist to solve this xHarbour problem with the help of
> Harbour developers, you may want to add -trace hbmk2 option to
> what Massimo suggested, to get a list of exact command lines executed.
> Then you can copy these lines to an MS-DOS batch file.
>
"solve this xHarbour problem ..." I think the offending line in
the batch file is a GCC-DW2.EXE problem and not a xHarbour proble. The
GCC-DW2.line in the batch file has many arguments which I would like
to understand.

But, will try the -trace option in the batch file and see what
occurs.

> Also I strongly suggest to use mingw 4.5.2 from the nightly or 3.0.0 final
> binary, to avoid any possible pitfalls with a local tdm installation.

In this test, I have the same MinGW 4.5.2, that I've been using for
many weeks, and the latest xHarbour (Build 9382).


Thank you.

-Mel

Viktor Szakáts

unread,
Aug 6, 2011, 11:26:38 AM8/6/11
to harbou...@googlegroups.com
>    "solve this xHarbour problem ..."  I think the offending line in 
the batch file is a GCC-DW2.EXE problem and not a xHarbour proble. The 
GCC-DW2.line in the batch file has many arguments which I would like 
to understand. 

In Harbour all these problems were solved in last years. As one result 
now it only the minimum required, plus optimization and safety options 
for all supported C compilers. Which means all unnecessary ones were 
cleaned.

To me it remains funny to start solving these problems from the ground up 
on Harbour's list, this time in context of xHarbour ;)

To understand the short list of currently used GCC options in Harbour, the 
best place is GCC's online documentation.

> > Also I strongly suggest to use mingw 4.5.2 from the nightly or 3.0.0 final 
> binary, to avoid any possible pitfalls with a local tdm installation. 

> this test, I have the same MinGW 4.5.2, that I've been using for 
> many weeks, and the latest xHarbour (Build 9382). 

hbmk2 should work with the installation you seem to be using anyway, 
but it was quite slimly tested. That's why I bothered to recommend it.

Viktor

Mel_the_Snowbird

unread,
Aug 7, 2011, 8:23:52 PM8/7/11
to Harbour Users
To Viktor and Massimo:


I have given up (for now) trying to use a batch file in the xhb
\tests\ sub-dir to build an y test apps.

Instead, I have fallen back on hbmk2.exe, and copied that file to
my xHarbour test platform (\xhb) and placed it in the \xhb\bin\ sub-
directory.

Following Massimo's suggestrion, I used the -lxhb option to hbmk2,
and managed to build hello.prg and speedtst.prg.

I did another complex speed comparison, and will post the download
in a minute or so.

(I'm really trying to make it easy for xHarbourites to move to
Harbour by trying to eliminate procedures and files that would be
confusing and discouraging to them. e.g., hbmk2 and all its
ramifications, etc)

My BLDTST.BAT File is included in the downloadable hb16980_tst.zip
file for your inspection.


Thank you both

-Mel Smith

Viktor Szakáts

unread,
Aug 7, 2011, 8:41:12 PM8/7/11
to harbou...@googlegroups.com
Hi Mel,

>    Following Massimo's suggestrion, I used the -lxhb option to hbmk2, 
>and managed to build hello.prg and speedtst.prg. 

Good news.


>   (I'm really trying to make it easy for xHarbourites to move to 
>Harbour by trying to eliminate procedures and files that would be 
>confusing and discouraging to them. e.g., hbmk2 and all its 
>ramifications, etc) 

It's just a single exe to copy in place.

Then maybe the deletion of some unnecessary env settings, 
in case they happen to confuse hbmk2 (f.e. multiple 
compilers in PATH, multiple versions of the same compiler), 
these are all useful in a generic sense, but even these are 
not obligatory, just recommended.

From this point usage should be fairly straightforward for 
basic build cases. As an added bonus, anything learned 
can be reused on all platforms and with all compilers.

Few words for the .BAT hbmk2 cmdline:

-static: it's the default build mode on Windows, so it can be dropped
-st: it's the default mode with -static build and it's ignored with -shared 
builds, so I suggest to remove this to avoid possible confusion.
-rebuildall: this is ignored in default mode and only effective when used 
    in conjunction with -inc (incremental build) option. But even then it's 
    not useful to hardwire it into .BAT file, because it effectively disables 
    any benefits of -inc. I suggest to delete it.

This may be dangerous if both dirs exist and they 
contain different GCC versions:
   SET PATH=\MINGW\BIN;\MINGW32\BIN;%PATH%;
Better implement IF EXIST conditions to add one or the other.

Viktor

Mel_the_Snowbird

unread,
Aug 8, 2011, 9:58:57 AM8/8/11
to Harbour Users
Viktor said:

>
> Few words for the .BAT hbmk2 cmdline:
>
> -static: it's the default build mode on Windows, so it can be dropped
> -st: it's the default mode with -static build and it's ignored with -shared
> builds, so I suggest to remove this to avoid possible confusion.
> -rebuildall: this is ignored in default mode and only effective when used
>     in conjunction with -inc (incremental build) option. But even then it's
>     not useful to hardwire it into .BAT file, because it effectively
> disables
>     any benefits of -inc. I suggest to delete it.
>
> This may be dangerous if both dirs exist and they
> contain different GCC versions:
>    SET PATH=\MINGW\BIN;\MINGW32\BIN;%PATH%;
> Better implement IF EXIST conditions to add one or the other.


Viktor:

I'll make changes in in my BLDTST.BAT file to accommodate your
fixes.


Hope otheres who downloaded it will also make those changes.

I'll be away golfing for the rest of the day. :)

Thank you.

-Mel Smith

Mel_the_Snowbird

unread,
Aug 8, 2011, 9:59:57 AM8/8/11
to Harbour Users
Viktor:
> -Mel Smith- Hide quoted text -
>
> - Show quoted text -

Mel_the_Snowbird

unread,
Aug 8, 2011, 10:05:11 AM8/8/11
to Harbour Users
Viktor:

Sorry for the multi-posts.

The path line in the batch file was in error. I've fixed that, amd
will post later.

Bye for the day.

-Mel


Reply all
Reply to author
Forward
0 new messages