Last modified: Sun Jun 28 20:00:26 EDT 2020
Based on instructions generously provided by Juan Manuel Guerrero.
Quoting from the primary site, http://www.delorie.com/djgpp/: "DJGPP is a complete 32-bit C/C++ development system for Intel 80386 (and higher) PCs running DOS. It includes ports of many GNU development utilities." By providing a robust 32-bit platform and DOS implementations of many standard library functions, DJGPP makes it possible to build and run many Unix applications under DOS, and consequently in a DOS box under any 32-bit version of Windows, with less porting effort.
The following was written in October 2014 to explain how to build the CVS version of DJGPP 2.04. These instructions are now out of date since DJGPP 2.05 was released 2015-11-08.
As of October 2014, the last release of DJGPP was version 2.03, in 2002. A beta of DJGPP 2.04 emerged in 2003, but it never progressed to final release. Updated versions of GCC, libraries, and applications continued to be released for both 2.03 and the 2.04 beta. However, some important fixes could be obtained only by building the latest versions of the DJGPP platform files from the CVS repository sources. This article explains how to get a working build environment with the latest versions of everything.
The DJGPP archive is best accessed through a fast mirror. The "current" directory is 2.03; "beta" is 2.04. Essential files and utilities are divided between subdirectories v2 and v2gnu; additional prebuilt libraries and apps are found in v2tk and v2apps. A directory for other etceteras, v2misc, exists only in current.
CAUTION: You cannot mix libraries. If you have decided to use version 2.04 (whether the as-is beta or the CVS repository version), you cannot link applications with libraries from the current (2.03) directory. Compiler, binutils, and libraries must match!
A quick way to get a CVS snapshot is from http://www.ludd.luth.se/~ams/djgpp/cvs/. For actual CVS retrieval, see the DJGPP CVS page.
If using hard-core DOS, both a Long File Name (LFN) driver and a DPMI provider must be installed. Recommended:
LH DOSLFNMS.COM
in AUTOEXEC.BAT.
If using a DOS box (CMD.EXE) in a 32-bit version of Windows, LFN and DPMI should just work.
Additional configuration advice is provided in the DJGPP FAQ.
When unpacking zip files, use the unzip32.exe that is distributed with DJGPP to prevent file names from getting broken.
File names on NTFS must be created in the DOS namespace. Linux
ntfs-3g doesn't do that. Similarly, the LFN implementation in Linux
vfat is not entirely compatible with doslfn. It only works reliably if
you mount the vfat partition with the option
shortname=winnt
.
Following is the minimum set of packages needed to successfully complete the next stage. Newer versions of the various packages will appear over time. Feel free to use the latest.
Directory | Package | ||
---|---|---|---|
beta/v2 | 2211289 | Nov 30 2003 | djdev204.zip |
beta/v2gnu | 6628096 | Sep 2 16:56 | bnu224br2.zip |
beta/v2gnu | 641348 | Sep 26 2009 | bsh205bbr3.zip |
beta/v2gnu | 434398 | Jan 9 2010 | bsn241b.zip |
beta/v2gnu | 2446889 | Oct 12 08:11 | fil41b.zip |
beta/v2gnu | 730551 | Jun 27 2008 | fnd4233br4.zip |
beta/v2gnu | 21142487 | Jul 17 00:34 | gcc491b.zip |
beta/v2gnu | 10969714 | Jul 17 00:34 | gpp491b.zip |
beta/v2gnu | 629895 | Sep 2 16:56 | grep220b.zip |
beta/v2gnu | 2943279 | Dec 15 2003 | gro116b.zip |
beta/v2gnu | 8363181 | Aug 31 13:57 | gtxt192b.zip |
beta/v2gnu | 363193 | Jul 14 19:06 | m4-1417b.zip |
beta/v2gnu | 755391 | Oct 10 23:03 | mak41b.zip |
beta/v2gnu | 429978 | Sep 5 20:42 | sed422b.zip |
beta/v2gnu | 2362671 | Oct 12 08:11 | shl2011b.zip |
beta/v2gnu | 1142732 | Jan 9 2009 | txi413br2.zip |
beta/v2gnu | 2305385 | Oct 12 08:11 | txt20b.zip |
Unzip all files in C:\DJGPP and set the following environment variables accordingly:
set PATH=C:\DJGPP\BIN;%PATH% set DJGPP=C:\DJGPP\DJGPP.ENV
In addition, a command-line zip program must be installed in the path. One that works is the DJGPP-compiled Info-ZIP binary available from the FreeDOS archive.
2.1. Unpack the CVS snapshot in a working directory, not inside the C:\DJGPP installation. We will call it C:\BUILD.
2.2. Copy 2 linker scripts from the snapshot into the C:\DJGPP installation, overwriting the existing versions:
COPY C:\BUILD\DJGPP\LIB\DJGPP.DJL C:\DJGPP\LIB COPY C:\BUILD\DJGPP\LIB\DXE.LD C:\DJGPP\LIB
2.3. CD into the C:\BUILD\DJGPP\SRC directory and start the build process by typing "make". It may take some time to complete. If the process finishes without error messages, you win.
2.4. Zip up the newly built files by CDing into C:\BUILD\DJGPP\DISTRIB and typing "mkdist". The resulting packages, which replace those from beta/v2, end up in C:\BUILD\DJGPP\ZIPS.
883592 | Oct 19 21:01 | djcrx204.zip |
2625207 | Oct 19 20:58 | djdev204.zip |
1997227 | Oct 19 21:00 | djlsr204.zip |
1056391 | Oct 19 21:01 | djtst204.zip |
581835 | Oct 19 21:01 | djtzn204.zip |
407962 | Oct 19 21:02 | djtzs204.zip |
At a minimum, the djdev204.zip that was installed previously is now obsolete. A brave person could simply unzip the newly built packages in C:\DJGPP. To prevent any obsolete files from accidentally getting used, a more cautious person would erase the C:\DJGPP directory and recreate it with the new packages substituting for the old ones.