Build instructions

If you want to build PGCC/OS2 from scratch (if you're mad enough :-) here are the instructions how to do it. Note that you either should be current with Unix-style utilites (I mean the contents of ftp.leo.org/pub/comp/os/os2/leo/unix/..., for example) or you should have enough time to learn them (its easy, believe me... despite what m$ propaganda says ;-)
However, if I've succeeded to scare you (;-) you can just download the binaries (skip this entire paragraph to next separator line) and enjoy.

To configure PGCC sourcecode to compile for OS/2 you should have:

When you have everything listed above, you should:

  1. Get the entire gcc distribution archive and unpack it to some directory $(PGCC)
  2. Get the PGCC patches and apply them.
  3. Copy the contents of the diff.new/pgcc/ subdirectory into the $(PGCC) subdirectory (recursively with all subdirectories).
  4. Apply the diff file found in diff.new/pgcc/ directory.

    The slow (but complete :-) way (if you're a masochist ;-)

    1. Launch $(PGCC)/configure with bash. This takes lots of time (up to some minutes!) since it have to recursively walk through all subdirs and launch configure there too.
    2. Now launch "make" in $(PGCC) directory. You should be prepared to wait for a LONG time :-)
    3. First will be made GNU -liberty library and some other things, then it will launch the make process for GCC. Here at some point it can fail. If it does so, proceed as below.

    The quick way (if you need only gcc/gpp/objc/f77/libgcc/libf2c/libobjc)

    1. Launch $(PGCC)/gcc/configure with bash (with optional --enable-haifa command-line parameter). Also if you want command-line help don't forget to add --enable-clh command-line parameter. This won't take so long as the root Configure, and besides you at least have what to look at during the process :-)
    2. Launch "make" in same directory.

If make tries to run 'autoconf' (which you most likely don't have), run 'touch configure', then re-run make. If make tries to launch 'autoheader' (which is a part of autoconf package too), touch cstamp-h.in then re-run make. These problems can show up because of inconsistency between time/date stamp of these files after applying patches.

When GCC compilation will be done, you should build a stage2 compiler. Stage1 compiler contains debug info so it is usable only for debugging purposes. A stage2 compiler is built using stage1 compiler (i.e. the compiler you already have -- with debugging info)

To build stage2 compiler using stage1 compiler (also a stage(n+1) compiler using stage(n) compiler) you should launch:

bash emx-nextstage
in the $(PGCC)/gcc/ directory.

You can run emx-nextstage up to three times to make stage2 through stage4 compilers. Each successful stage tells you have a compiler that at least can build itself from scratch.

If you still have problems you should read the file $(PGCC)/INSTALL - it contains some general instructions on building pgcc. Keep in mind that they are for Unix, not for OS/2.

When you're done playing with stageN compilers, you can extract the final files to another directory, this way:

mkdir /new
make install prefix=/new

This should create a bunch of subdirectories under /new and copy a lot of files into them; decide yourself which of those files do you need.

Now you should create the libgcc library. Take the gcc.a and gcc_p.a libraries: These are the GCC runtime libraries; with profiling and without profiling. You should use them to build ten (!) versions of gcc.a: single/multi-threaded, for C/C++, with/without profiling and dynamic versions. For this you should put them two into the emx/diff/libgcc directory, change the lines at the top of the make_gpp.cmd file in accordance to you setup, and run it. You will get ten g*.a files in st/ and mt/ directories: grab them. I've decided to split libgcc from EMX runtime DLLs since they changes with each version of gcc, and this makes EMX DLLs a mess.

After this you can go to pgcc/i386-ibm-os2/liberty,libio,libstdc++ directories and build stdc++ and libiberty libraries. Also if you want to build Fortran runtime libraries you should do it in pgcc/libf2c. I won't include detailed instructions since most likely you won't need to do it - its a whole mess.


Back to PGCC/2 page