After a long delay, now Harbour build with newer gcc  :-)

In Oct 2008 I tried to build Harbour with gcc432 (see "Harbour under OS/2 - gcc432", October 28, 2008 )
It failed due emxbind known problem
------------------
emxbind: invalid a.out file (startup code)
ld.exe: emxbind failed
------------------

Recently I was searching how to build Harbour with new gcc

The results are:
gcc440
======
  Build time: 53 minutes
  Build everything except hbrun.exe

gcc432
======
  Build time: 35 minutes
  Build everything except hbrun.exe, hbmk2.exe

gcc433
======
  Build time: 35 minutes
  Build everything except hbrun.exe, hbmk2.exe

Warnings are few
gcc440 seem to be more strict, it involve more time and give more warnings

Below are messages for each compiler

The key to build are:
- to change library type using OMF in place of a.out
- to use other library manager/linker for OMF in place of emxbind/ar.exe/ld.exe

As comparison with current gcc

gcc335
======
  Build time: 21 minutes, a.out type
              26 minutes, OMF type
  Build everything


Notes:
- Tests made with source
 * $Id: ChangeLog 12104 2009-08-14 09:31:12Z vszakats $
 2009-08-14 11:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
and os2make381

- Compiler: all files provided by Paul Smedley
 \usr\local440
    gcc-4.4.0-os2-20090503.zip
    ( change local44 for local440 )
 \usr\local432
    gcc-4.3.2-os2-20081116.zip
 \usr\local433
    gcc-4.3.3-os2-20090224.zip

- Some compiler packages does not contain binutils
  Use this file and copy to proper compiler directory
   binutils-2.19.1-os2-20090427.zip
  Does not include ld.exe due emxbind problem

- Setting each compiler environment with a modified gccenv.cmd
 The change is to use a modified line, for example for local432
 call GCC322plus sPath, 'gcc432', 0, sLinker;
 Just change 432 for xyz of each localxyz directory
 ( Again, use 440 in place of 44 )

- As I understand current gcc335 must to exist
 \usr\bin
 and obviously emx

- Additional environment variables used in my Harbour build script:
 set EMXOMFLD_TYPE=LINK386
 set EMXOMFLD_LINKER=link386.exe

 Used by emxomfar.exe
 If not set it will try to use ilink.exe of VisualAge C

 For first Harbour tests I set it to venerable ancient link386.exe

 Below are included info of svn.netlabs.org/libc/wiki/kOptions

- And of course, config\os2\gcc.cf changes
 After many tests, the main changes are:
 ----------------------
 LIB_EXT := .lib

 CFLAGS := -Zomf

 RANLIB := echo  (I do not know if must be set)

 #replacement of define create_library
 FILE := %f

 define create_library
for $(FILE) in ( *$(OBJ_EXT) ) do $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) -p128 r $(LIB_DIR)/$@ $(FILE)
 endef

 AR := emxomfar
 AR_RULE = $(create_library)
 ----------------------

# pending to review / supress due to reference to emxbind
LD_RULE = $(LD) $(CFLAGS) $(LD_OUT)$(BIN_DIR)/$@ $(^F) $(LDFLAGS) $(HB_USER_LDFLAGS) $(LDLIBS) & emxbind -ep $@

- About emxomfar.exe
 + Make same work for OMF as ar.exe does for a.out
 + Input is only object by object
   Usage: emxomfar [-p#] <command> <library_file> [<module>]...
   so an input file as __lib__.tmp can not be used
 + Each time it create a .bak file
 + -p128 was necessary to build hbrtl.lib

- Rest of values for Harbour build are as ever

- Errors, warnings:
 + emxomfar.exe
   Without -p128 fail to build hbrtl.lib

emxomfar: Library too big -- increase page size
make[3]: *** [hbrtl.lib] Error 2

 + hbrun.exe
   Does not build due to:

make[3]: *** [hbrun.exe] Error 1

gcc -Zomf -Wall -W -O3 -o ..\..\..\..\..\bin\os2\gcc\hbrun.exe hbrun.o -L../../../../../lib/os2/gcc -Le:\usr\lib\tcpipv4 -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtos2 -lhbrdd -lrddntx -lrddnsx -lrddcdx -lrddfpt -lhbsix -lhbhsx -lhbusrrdd -lhbuddall -lhbrtl -lhbvm -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbpcre -lhbzlib -lsocket

E:\harbour907h\harbour\lib\os2\gcc\hbextern.lib(hbextern.o) : fatal error L1046: too many external symbols in one module

From Tools reference:
www.warpspeed.com.au/cgi-bin/inf2html.cmd?..%5Chtml%5Cbook%5CToolkt40%5CTOOLSREF.INF+660

L1046 too many external symbols in one module
Explanation: An object module specifies more than the limit of 1023 external symbols. Action: Reduce the number of external symbols, breaking the module into smaller parts, if necessary.

 + hbmk2.exe
   Does not build due to:

make[3]: *** [hbmk2.exe] Error 1

gcc -Zomf -Wall -W -O3 -o ..\..\..\..\..\bin\os2\gcc\hbmk2.exe hbmk2.o -L../../../../../lib/os2/gcc -Le:\usr\lib\tcpipv4 -lhbextern -lhbdebug -lhbvmmt -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtos2 -lhbnulrdd -lhbrtl -lhbvmmt -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbpcre -lhbzlib -lsocket

E:\usr\lib\libos2.lib(kbd4.obj) :  fatal error L1209:

From Tools reference:
L1209 out of memory for object page directory information
Explanation: The total size of the object page director is greater than the internal limit in LINK386. Action: Reduce the size of the executable, consider using dynamic link libraries to split the program into smaller modules.


 + For each compiler: make_gnu.log
   0 errors
   warnings for each binary creation:
LINK386 : warning L4071: application type not specified; assuming WINDOWCOMPAT

From Tools reference:
L4071 application type not specified; assuming name
Explanation: An application type of WINDOWAPI, WINDOWCOMPAT, NOTWINDOWCOMPAT, or PRIVATE was not specified. LINK386 is assuming the application type indicated.
Action: Edit the file and relink.


Conclusions
- Harbour under OS/2 are very close to use a newer gcc
- Main problem are link386.exe limitations and can be solved testing others linkers. OpenWatcom linker (wlink.exe) seem the first choice
- Minor problem is library .bak file in each operation
- Long build time in gcc440, perhaps due is more strict
- Deeper operation tests are pending


David Macias


gcc440: 53 min
==============

[E:\harbour907h\harbour]make -r -w           1>make_gnu.log
../../../filesys.c: In function 'hb_fsSetFileTime':
../../../filesys.c:1145: warning: 'ftime.twosecs' may be used uninitialized in this function ../../../filesys.c:1145: warning: 'ftime.minutes' may be used uninitialized in this function ../../../filesys.c:1145: warning: 'ftime.hours' may be used uninitialized in this function
../../../gtos2.c: In function 'hb_gt_os2_Redraw':
../../../gtos2.c:799: warning: pointer targets in passing argument 5 of 'pGT->pFuncTable->GetScrChar' differ in signedness ../../../gtos2.c:799: note: expected 'BYTE *' but argument is of type 'char *'
../../../gtstd.c: In function 'hb_gt_std_ReadKey':
../../../gtstd.c:412: warning: unused variable 'TODO'
../../../sqlite3.c: In function 'sqlite3_os_init':
../../../sqlite3.c:20798: warning: initialization from incompatible pointer type


[E:\harbour907h\harbour\bin\os2\gcc]harbour /build
Harbour 2.0.0beta2 (Rev. 12104)
Copyright (c) 1999-2009, http://www.harbour-project.org/

Harbour Build Info
---------------------------
Version: Harbour 2.0.0beta2 (Rev. 12104)
Compiler: EMX GNU C 4.4 (32-bit)
Platform: OS/2 4.50
PCode version: 0.2
ChangeLog last entry: 2009-08-14 11:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
ChangeLog ID: ChangeLog 12104 2009-08-14 09:31:12Z vszakats

Built on: Aug 15 2009 18:26:04
Extra C compiler options: -DTCPV40HDRS -DHB_FM_STATISTICS_OFF
Extra linker options: -Le:\usr\lib\tcpipv4
Build options:
Language options: (Clipper 5.3) (Clipper 5.x undoc) (Xbase++) (Flagship)
---------------------------



gcc432: 35 min
==============

[E:\harbour907h\harbour]make -r -w           1>make_gnu.log
../../../gtos2.c: In function 'hb_gt_os2_Redraw':
../../../gtos2.c:799: warning: pointer targets in passing argument 5 of 'pGT->pFuncTable->GetScrChar' differ in signedness
../../../gtstd.c: In function 'hb_gt_std_ReadKey':
../../../gtstd.c:412: warning: unused variable 'TODO'

make[3]: *** [hbmk2.exe] Error 1
make[2]: *** [descend] Error 2
make[1]: *** [hbmk2] Error 2
make: *** [utils] Error 2

gcc -Zomf -Wall -W -O3 -o ..\..\..\..\..\bin\os2\gcc\hbmk2.exe hbmk2.o -L../../../../../lib/os2/gcc -Le:\usr\lib\tcpipv4 -lhbextern -lhbdebug -lhbvmmt -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtos2 -lhbnulrdd -lhbrtl -lhbvmmt -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbpcre -lhbzlib -lsocket

E:\usr\lib\libos2.lib(kbd4.obj) :  fatal error L1209:

L1209 out of memory for object page directory information
Explanation: The total size of the object page director is greater than the internal limit in LINK386. Action: Reduce the size of the executable, consider using dynamic link libraries to split the program into smaller modules.


433: 35 min
===========

../../../gtos2.c: In function 'hb_gt_os2_Redraw':
../../../gtos2.c:799: warning: pointer targets in passing argument 5 of 'pGT->pFuncTable->GetScrChar' differ in signedness
../../../gtstd.c: In function 'hb_gt_std_ReadKey':
../../../gtstd.c:412: warning: unused variable 'TODO'
make[3]: *** [hbmk2.exe] Error 1
make[2]: *** [descend] Error 2
make[1]: *** [hbmk2] Error 2
make: *** [utils] Error 2

[E:\harbour907h\harbour]make -r -w           1>make_gnu.log
../../../gtos2.c: In function 'hb_gt_os2_Redraw':
../../../gtos2.c:799: warning: pointer targets in passing argument 5 of 'pGT->pFuncTable->GetScrChar' differ in signedness
../../../gtstd.c: In function 'hb_gt_std_ReadKey':
../../../gtstd.c:412: warning: unused variable 'TODO'
../../../sqlite3.c: In function 'sqlite3_os_init':
../../../sqlite3.c:20798: warning: initialization from incompatible pointer type


------------------------

Environment variables:

    EMXOMFLD_TYPE:

The type of linker we're using. Values: WLINK, VAC365, VAC308, LINK386.

WLINK wlink.exe from Open Watcom v1.5 or later. VAC365 ilink.exe from IBM C and C++ Compilers for OS/2 v3.6 or later. VAC308 ilink.exe from Visual Age for C++ v3.08. LINK386 link386 form OS/2 install or DDK.

    EMXOMFLD_LINKER:

Name of the linker to use and optionally extra parameters. Spaces in the linker name or path is not supported. Quotes are not supported either.

The default values for these two variables are VAC365 and ilink.exe.

------------------------


_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to