How to Compile Harbour for MS-DOS Compatible Apps ?

844 views
Skip to first unread message

Pritpal Bedi

unread,
Aug 14, 2013, 4:41:11 AM8/14/13
to harbou...@googlegroups.com
Hello All

I am in an urgent need to compile an application 
to be run on MS-DOS. My development environment is 
Windows 7, but it can also be XP if that is the minimum 
requirement.

As it is an urgent need, and I have zero experience 
for such build, I would appreciate if you provide 
complete step-by-step guidelines.

Thanks in advance.

Pritpal Bedi
a student of software analysis & concepts

Gmail

unread,
Aug 14, 2013, 5:21:03 AM8/14/13
to harbou...@googlegroups.com
I don’t use in MS-DOS but it would be a good oportunity to add this step-by-step guide to Harbour docs (somewhere).
Could be a simple TXT file.
To have a computer with only MS-DOS (or DR-DOS, PC-DOS, FreeDOS, etc...) and a Harbour program has the advantage of that such computer would not require any extra license (like for Windows) and would not be a source of any type of *distraction* since it would not have any other program (and if you remove any USB, CD-ROM, IDE then you have no way to boot any other distractive GUI operating system).
Just an idea...
 
Qatan
 

soporte

unread,
Aug 14, 2013, 5:45:58 AM8/14/13
to harbou...@googlegroups.com
Pritpal,

MS-DOS OS or console application ?

Regards

Przemyslaw Czerpak

unread,
Aug 14, 2013, 6:52:47 AM8/14/13
to harbou...@googlegroups.com
On Wed, 14 Aug 2013, Pritpal Bedi wrote:

Hi Pritpal,

> I am in an urgent need to compile an application
> to be run on MS-DOS. My development environment is
> Windows 7, but it can also be XP if that is the minimum
> requirement.
>
> As it is an urgent need, and I have zero experience
> for such build, I would appreciate if you provide
> complete step-by-step guidelines.

It's quite simple.
We are supporting two compilers for DOS builds:
DJGPP (http://www.delorie.com/djgpp/, I suggest version 2.04) and
OpenWatcom (http://www.openwatcom.org/, the last version is 1.9).

It's enough to install one of them and recompile Harbour with it.
Then you can use HBMK2 though here one problem can appear. Command
line size limitation which causes that HBMK2 does not work out of
the box with OpenWatcom DOS tools in real DOS. Anyhow OpenWatcom
can generate binaries for different systems (DOS, Windows, Linux,
OS2, ...) using platform native tools so you will not have this
problem working on Windows.
Harbour compilation is very easy. You only have to set few envvars
which are usually set also by installer though it may be easier for
you to have batch file for it if you want to use different C
compilers on the same machine. In README.md you will find details
for compilation in Windows:

```batchfile
rem Delorie GNU C for MS-DOS (on Intel 32-bit Windows hosts only)
set DJGPP=C:\djgpp\djgpp.env
set PATH=C:\djgpp\bin;%PATH%
win-make
```


```batchfile
rem Open Watcom C/C++ for MS-DOS
SET WATCOM=C:\watcom
SET PATH=%WATCOM%\BINNT;%PATH%
SET EDPATH=%WATCOM%\EDDAT
SET INCLUDE=%WATCOM%\H
win-make
```

Above variables also allow HBMK2 to detect C compiler.

best regards,
Przemek

Gmail

unread,
Aug 14, 2013, 8:17:40 AM8/14/13
to harbou...@googlegroups.com
Hello Przemek,

What is the difference between those two compilers?
Which is better?

Thanks for your help.

Regards,

Qatan

Gmail

unread,
Aug 14, 2013, 8:55:46 AM8/14/13
to harbou...@googlegroups.com
Hello all,

I just created a simple PDF with that information for anyone that would
like to keep those details
Regards,

Qatan
DOS_Build.pdf

Gmail

unread,
Aug 14, 2013, 7:21:39 PM8/14/13
to harbou...@googlegroups.com
I got very lazy and only download the nightly binaries so for a long time I
don’t build Harbour.
I tried to follow Przemek's instructions using OPENWATCOM
As far as I could understand I have to add the following to the
instructions:

Get rid of any previous configuration (f.e. SET PATH) to avoid mixing with
other compiler (f.e. MingW)
Add SET HB_PLATFORM=DOS
Add SET HB_COMPILER=WATCOM
Add SET HB_INSTALL_PREFIX=\DOS_BUILD

All the above to avoid confusion

Then I fired win-make clean install and it started to build Harbour but gave
errors that you can see on the attached text file.

Am I missing something?

Thanks for any help.

Qatan

t.txt

Alain Aupeix

unread,
Aug 15, 2013, 3:28:42 AM8/15/13
to harbou...@googlegroups.com
Le 15/08/2013 01:21, Gmail a �crit�:
I got very lazy and only download the nightly binaries so for a long time I don�t build Harbour.
I tried to follow Przemek's instructions using OPENWATCOM
As far as I could understand I have to add the following to the instructions:

Get rid of any previous configuration (f.e. SET PATH) to avoid mixing with other compiler (f.e. MingW)
Add SET HB_PLATFORM=DOS
Add SET HB_COMPILER=WATCOM
Add SET HB_INSTALL_PREFIX=\DOS_BUILD

All the above to avoid confusion

Then I fired win-make clean install and it started to build Harbour but gave errors that you can see on the attached text file.

Am I missing something?
I think DOS isn't able to handle folder names greater than 8 characters.
Don't forget that in dos console with w95, nametoolong were modified like this nameto~1, or something like that ...

SET HB_INSTALL_PREFIX=\D_BUILD�

would be better.

A+
--

Alain Aupeix
http://jujuland.pagesperso-orange.fr/
http://pissobi-lacassagne.pagesperso-orange.fr/

U.buntu 12.04 | G.ramps 3.4.5-1 | H.arbour 3.2.0dev (2013-07-18 00:24) | HbIDE (Rev.255) | FiveLinux (r138) | Hw.Gui (2129)

Pritpal Bedi

unread,
Aug 15, 2013, 2:50:44 PM8/15/13
to harbou...@googlegroups.com
Thanks Przemek

I did it like:

1. Downloaded the available .zips from http://www.delorie.com/djgpp/ ( not sure it is 2.04 ).
2. Installed DOSBOX on my Win 7 32 bits machine.
3. Mounted the folders as per DOXBOX docs.
4. Set the variables as stated in readme.md.
5. Issued : DOS-MAKE .
6. Harbour started to compile.
7. After few files compiled it reported a mmissing .h for PNG lib.
8. I issued this command to supress 3rd libs to be compiled.
    SET HB_BUILD_3RDEXT=no
9. But the problem persists. Same error.

What should I supress more then that ?



```batchfile
rem Delorie GNU C for MS-DOS (on Intel 32-bit Windows hosts only)
set DJGPP=C:\djgpp\djgpp.env
set PATH=C:\djgpp\bin;%PATH%
win-make
```


May be I should try directly without DOSBOX, am I right, then only I can call "win-make" .



```batchfile
rem Open Watcom C/C++ for MS-DOS
SET WATCOM=C:\watcom
SET PATH=%WATCOM%\BINNT;%PATH%
SET EDPATH=%WATCOM%\EDDAT
SET INCLUDE=%WATCOM%\H
win-make
```

Above variables also allow HBMK2 to detect C compiler.


I will try with OpenWatcom too.


Pritpal Bedi 

Gmail

unread,
Aug 15, 2013, 4:57:48 PM8/15/13
to harbou...@googlegroups.com
Hello Pritpal,
 
    I had a similar problem but with openwatcom.
    I used Windows 7 command line because I understand it should work for generating binaries for DOS (cross compile).
    I am pretty sure I am missing some envar or some basic configuration... I don’t know what, of course.
    Regards,
 
Qatan
 

Pritpal Bedi

unread,
Aug 15, 2013, 6:14:03 PM8/15/13
to harbou...@googlegroups.com
Hi


I could compile Harbour with OpenWatcom DOS.


Machine : WIndows 7 32 Bits

STEPS:

2. Installed in C:\WATCOM. Follow all default options when installing except making changes to AUTOEXEC.bat and CONFIG.sys.
    WATCOM will save these two files with .DOS as extention.
3. Copy C:\Watcom\autoexec.dos C:\Watcom\m.bat
4. Redefine PATH statement as : SET PATH=C:\WATCOM\BINW;C:\Harbour\bin\dos\watcom;%PATH%
5. Keep all other SETs intact.
6. CD to C:\Harbour
7. Execute C:\Watcom\m.bat
8. Execute DOS-MAKE     [ Do Not use "install" option, it will pollute your existing environment ]
9. Harbour binaries will be deposited in C:\Harbour\bin\dos\watcom

NOTE [ And it is strange ] that steps 7 and 8 will have to be repeated for few times 
         as console window from where you are initiating it will disappear, but do not worry,
         it seems to be an issue with memory.

10. CD to harbour\tests
11. Issue : hbmk2 hello -workdir= -run
     It appears long command line do not go through, so we have to shorten the path and hence command line length.
13. Be cheerful as you will see "Hello World" printed in current console.


Pritpal Bedi


Gmail

unread,
Aug 15, 2013, 6:19:31 PM8/15/13
to harbou...@googlegroups.com
Hello Pritpal,
 
    Thank you for sharing.
    I will test it whenever I can.
    Regards,
 
Qatan
 

Gmail

unread,
Aug 16, 2013, 5:16:44 AM8/16/13
to harbou...@googlegroups.com
Hello Pritpal,
 
I didn’t understand this one: SET PATH=C:\WATCOM\BINW;C:\Harbour\bin\dos\watcom;%PATH%
 
Is C:\Harbour your Harbour sources from git?
I don’t have this folder \bin\dos\watcom ... what is inside and where did you get that from?
 
Thanks for your help
 
Qatan
 

Pritpal Bedi

unread,
Aug 16, 2013, 11:50:14 AM8/16/13
to harbou...@googlegroups.com
Hi


I didn’t understand this one: SET PATH=C:\WATCOM\BINW;C:\Harbour\bin\dos\watcom;%PATH%
 
Is C:\Harbour your Harbour sources from git?
I don’t have this folder \bin\dos\watcom ... what is inside and where did you get that from?

\bin\dos\watcom will be created by the build system automatically.
You do not have to create them manually. But its reference in PATH statement 
is a must as at one stage build system falls back on Harbour.exe and hbmk2.exe
which, if not loaded from DOS build binaries, will not let you proceed further.

I may be wrong for underlying philosophy of above statements, but it is correct, 
that above instructions will let you compile tests/* programs.


Pritpal Bedi

Gmail

unread,
Aug 18, 2013, 3:52:43 PM8/18/13
to harbou...@googlegroups.com
Hello Pritpal,
    Thanks for explaining it. Now I understand...
    Regards,
 
Qatan

 

Giovanni Di Maria

unread,
Jan 23, 2018, 5:19:50 AM1/23/18
to Harbour Users
Hi Pritpal.
Have you tried to compile with WIndows 10?
Thank you
Bye
Giovanni

Michael Poland

unread,
Jun 29, 2020, 7:30:47 AM6/29/20
to Harbour Users
How to add ads library for dos ?
Reply all
Reply to author
Forward
0 new messages