This happened in July - one rainy day I (Stauff) was going to my work and
suddenly remembered that Andy, whom I knew from university, is working just near
my work - in the next building. It is a great thing for OS/2 users to talk to
each other, since there are few of us today (sigh) so we talked a lot about
OS/2 news, my new job, Linux and GNU and suddenly I remembered one thing that
had been on my porting schedule for a long long time. "Andy - QT-3 (Qt is a C++
framework/GUI toolkit for X and Windows) - requires GCC 3.0 and I can't build
it with your PGCC, can you give it a look?" - I asked. "No problem" - was his
answer. However we soon faced tons of problems. QT3 refused to build, had
problem during linkage, the generated code was bad etc. etc. At some stage we
asked the Mozilla developers to test the new compiler to ensure everything was ok.
Only now after weeks and months during which Andrew debugged and fixed and
again fixed (as GCC was also moving) you can see GCC 3.0.2 in the shape we
want it to be. I do hope OS/2 developers will have as much fun and make as many interesting
discoveries as we have during work on GCC. Good Luck!
Installation and Configuration:
Download site
GCC 3.0.2 is currently in beta state, but this does not mean it is not working.
Indeed beta time for such a complex thing as a compiler can last for quite a long
time! We think it is usable now - so we consider it to be bug-free. Try now,
don't wait for a release version because this one may not appear until next year.
As this product is currently in beta stage, please do not upload it to Hobbes
or any other OS/2 applications archive.
Get GCC 3.0.2 from Netlabs Server
Requirements
You will need the following pre-requisites before installing and using GCC 3.0:
- OS/2 Warp 3.0 or later. If you're going to use the standard C++
library (libstdc++) you will also need Unicode support (service pack 26
for Warp 3.0.)
- EMX 0.9d4 is required. Please note that EMX is not just a bunch
of DLL's - it is a sort of development toolkit with its own compiler
(GCC 2.8.1) tools and headers. So when we speak about EMX we actually
mean the development part of this package. That's why fixpack number 4
is required - not only for the runtime but for the development part as well.
- 32M RAM for C and 64M RAM for C++ development, because the
GCC optimizer is very memory hungry.
- Correct Config.sys SET entries are very important because they
can lead to compiling errors. Please ensure you understand everything in the EMX
part of config.sys before proceeding any further.
- EMX single-threaded C runtime DLL fix - this is a requirement
because it removes a potential source of problems for you with mixing DLLs
linked against the multi-threaded and single-threaded versions of the EMX C
runtime DLLs. The archive is called emx-strt-fix-0.0.2.zip and can be found
on Hobbes.
- GNU gettext 0.10.40 - another must-have package. A previous version
(0.10.35) will work as well, but 0.10.40 is highly recommended, and it is
fully backward compatible.
- Binutils 2.11.2 (binary utilities) - new binutils with the new
assembler are required for new GCC. Older GAS won't work.
WARNING: GAS 2.9.1 will silently generate invalid code.
- We will also need a wide range of UNIX utilities for our daily work,
for GCC we will need GNU Make, other useful packages are
GNU File Utilities, GNU text utilities, GNU patch/diff
and others. We recommend getting them from Hobbes.
What We Are Going to Install
The installation process of GCC is pretty straight-forward (although it is without
"advanced" `Next->Next->Finish' technology), copy the archives to the
directory where your emx/ tree is located and unpack them making sure to
preserve the directory structure in the archive.
All the GCC packages have a common directory structure that will help you
keep the old EMX GCC alongside the new one. All the binaries are installed under
emx/bin.new/ and do not overwrite anything in emx/bin/. The following compilers
are available:
- gcc-os2-3.0.2-docs.zip - Documentation in INF format for compilers
- gcc-os2-3.0.2-gcc.zip - GNU C Compiler
- gcc-os2-3.0.2-gcj.zip - GNU Java Compiler. The GNU Java runtime has
not been ported (yet?) to OS/2, thus it is almost useless. However, if
someone wants, he can continue this work. The compiler itself seems fully
functional.
- gcc-os2-3.0.2-goc.zip - GNU Objective C compiler
- gcc-os2-3.0.2-gpp.zip - GNU C++ Compiler (C compiler required)
- gcc-os2-3.0.2-g77.zip - GNU Fortran Compiler
- gcc-os2-3.0.2-diff.zip - The differences between mainstream GCC and the OS/2 version.
Unpack the compiler packages in the emx directory. For C/C++ development you must
install both the C and C++ compilers. Please ensure that you have the 'emx/dll/'
directory in your LIBPATH.
Move the file /emx/bin.new/newgcc.cmd into /emx/bin; change it
to suit all your needs, all instructions are inside newgcc.cmd.
To switch to the new gcc just execute newgcc.cmd. To switch back, exit from
your shell. To completely replace gcc 2.8.x with the new version you should
merge all the files from /emx/bin.new with the files in /emx/bin, overwriting
any existing files with the same name in /emx/bin. Then remove the bin.new
subdirectory.
Now we will do the EMX update and libs creation. Switch to the new GCC with newgcc.cmd
(please make sure to adjust it with your own preferences) and check that the basic compilers
work. Type gcc -v and g++ -v to see the compilers' versions.
You should see 3.0.2 as the GCC version in both cases. By launching the compilers we
also check everything is O.K., so if you had any troubles, errors or even
core-dumps during launch, it is time to return and re-read the installation
instructions.
Building OMF libraries
(Before proceding, ensure you have switched to GCC 3.0.2
and its tools!)
Since EMX 0.9 was written, IBM has added to OS/2 several useful API's,
one of which is the Unicode API. To allow usage of the Unicode API's in EMX programs
(programs linked with libstdc++ will need them) we had to write the
missing API definitions (.h and import definitions.) Now to add the missing
functions to os2.a and os2.lib (the libraries defining all OS/2 system-specific
functions) you must go to /emx/lib and type 'make'. This will rebuild
os2.a so that it contains all the functions defined in unicode.imp, then it will
re-convert all outdated OMF libraries (.lib) from their a.out counterparts (.a).
Also you must go to the /emx/lib/gcc-lib/i386-pc-os2_emx/3.0.2/ directory
and type 'make' there as well for the same reason (to convert supplied a.out
libraries into OMF format in the case you will use the -Zomf switch).
Setting variables
Now stop and analyze all the above stuff. Do you really have fix 4 for the EMX
developer part installed? Do you know where your EMX stuff is located? Do you know
your LIBPATH and is it DLL-clash free? Did you update EMX libraries?
These are simple but very important questions because if something is
wrong in this basic stuff, you can face very severe and fatal consequences,
including GCC coredumps, illegal code produced etc. Now check your config.sys,
there are a number of variables we will now check. First C_INCLUDE_PATH -
this is not really important, just check whether it exists, and if yes it
points to the right directory. Note that this variable may not exist at all. Now
CPLUS_INCLUDE_PATH is very important! The new C++ uses a whole
bunch of its own files and does not need any of the old EMX headers. Please
place the new include path i.e. emx\include\g++-v3 before other
paths specified in this set. Please note you may not have this variable either.