Download the following packages:


Base EMX package.

EMX/GCC Development Packages

Required Tools

GCC 3.2.1

(See tip at bottom)

First you have to have the EMX base package (or runtime) installed.
To do this simply unzip emxrt to where you want the emx directory. If emx doesn't exist then it will be created if you are using unzip or if using pkzip use the -d to keep the directory structure (this is true throughout). You can then add the emx\dll directory to your libpath in your config.sys (recommended as there are many apps that use it but not required).
Next the EMX/GCC development package has to be installed. to do this unzip each of these in the same directory that you unzipped emxrt in (it will unzip into emx and subdirectories). If you get a message about overwriting files you should overwrite all (this is true throughout). The last file unzipped should be emxfix04 (or more current if one should become available). Replace all files (important).
We need to unzip the required tools. My suggestion is to create a temporary directory to unzip them into. Then copy the necessary files into a directory such as tools under emx. The files that are needed are:
make.exe, intl.dll, and
everything in FILEUTILS-3.16\BIN and FILEUTILS-3.16\DLL.
At this point we need emx\bin in the path and emx\dll to be in libpath (
I have placed emx\bin into my path and emx\dll in libpath in config.sys but this is not required) and the tools directory to be in the path and libpath.
This can be accomplished without rebooting by
path=X:\emx\bin;X:\emx\tools;%path%
set beginlibpath=X:\emx\dll;X:\emx\tools
Where X: is the drive that you are installing emx on (emx doesn't have to be on the root so if you put it into another directory, compilers we'll say, it would be X:\compilers\emx\bin) and X:\path\to\make.exe is the path where you put make.exe (if you put it on in emxtools for instance on the L: drive it would be L:\emxtools).
Now go into EMX\LIB\ and run OMFLIBS.CMD. (This step is omitted in the instructions for setting up gcc for mozilla and when I asked about it I was told it shouldn't be necessary but I seemed to have better results when I did this which is in the instructions I got for setting up gcc for use with Odin).
Next we need to unzip the GCC 3.2.1 packages. (It is critical that this is done after the above as these files will replace some of the files from the original packages and you will end up backleveling some of the files if you do these first).
Unzip these just as you did the earlier ones, above the emx directory and they will expand into the emx directory. Replace all files (important).
Now, copy all of the file in EMX\BIN.NEW to EMX\BIN, and the delete EMX\BIN.NEW (Note: This will make GCC 3.2.1 your only compiler, replacing GCC 2.8.1. If you wish to keep both 3.2.1 and 2.8.1, then do not copy the files in BIN.NEW to BIN. However, if you are using GCC 2.8.1 already then you probably know enough about this that you know how to set your path to use the one you want).
At this point we again need to make sure that EMX\BIN is in the path as well as making sure make.exe is in the path and that EMX\DLL is in the path.
(For some projects you may also need EMX/BIN to be in the path but this would probably mean you are using a unix type shell and is beyond what I can tell you much about).
Type 'gcc -v' and make sure it says you are running version 3.2.1. Go to EMX\LIB\ and type 'make'. Then go to EMX\LIB\GCC-LIB\I386-PC-OS2-EMX\3.2.1\and type 'make'.
At this point you should be good to go. If you did not choose to alter your config.sys then there is a file in EMX\BIN that you can alter to your needs,
it is newgcc.cmd. You would need to correct the path and if you didn't alter the libpath (which I recommend due to the number of apps that require it) add the set beginlipath statement to it to point to your EMX\DLL.

There are some exe files in emx\lib\gcc-lib\i386-pc-os2-emx\3.2.1 that I copied to the EMX\BIN directory as they are newer than the ones already there. I do not know if I needed to but it has not hurt as far as I can tell and this way I know which ones are being used.

In reference to the c++ for eCS\OS/2 class the command that is used for compiling these files is g++.
For listing 2.1 for example:
I created a file myfirst.cpp
then ran:
g++ myfirst.cpp
it created myfirst.exe.

ACKNOWLEDGEMENTS:
These instructions are largely compiled from the following sources:
http://www.mozilla.org/ports/os2/gccsetup.html
http://groups.yahoo.com/group/win32os2-wai/message/1599

TIP:

When I downloaded these files I downloaded EMX runtime into one directory, then the EMX/GCC files minus the emxfix04 into another, then emxfix04 into another, and the GCC 3.2.1 files into another (tools go into yet another directory but seperate from these).
This way I am able to restore emx quickly if I need to. I am able to go to where I want to install emx and type unzip d:\download\emx\*
then unzip d:\download\emx\gcc\* then unzip d:\download\emx\gcc\fix\*, run the omflibs then unzip the final piece by typing d:\download\emx\gcc\3.2.1\* and then running the required makes. This is somewhat easier than it would other wise be by using the up arrow so I avoid quite a bit of the typing.