HOWTO update your RedHat 5.0 system to use the egcs-c++ compiler from RedHat 5.1. (v1.03, Updated 1998-10-7) These notes are for anyone wishing to update their RedHat 5.0 system to use the new egcs compiler. Disclaimer: this worked for me, and was useful in setting up the KDE desktop environment on a RedHat 5.0 i586 system, but no warranty is offered or intended ...! These instructions describe in detail HOWTO: -- prepare your RedHat 5.0 system for the compiler update, -- update to the RedHat 5.1 gcc and egcs compilers, -- restore the RedHat 5.0 gcc compilers, if needed. After the preparations, You will be able to quickly switch between the 5.0 and 5.1 compiler environments as needed, using rpm. -------- 1. Introduction RedHat 5.0 comes with the stable GNU compiler gcc-2.7.2.3 and its front ends gcc-c++ for compiling C++ and gcc-objc for objective C. These are supplied by rpm packages gcc-2.7.2.3-8, gcc-c++-2.7.2.3-8 and gcc-objc-2.7.2.3-8. The C++ libraries used by gcc-c++ are provided by rpm packages libg++-2.7.2.8-6 and libg++-devel-2.7.2.8-6. The libg++ rpm package provides the runtime libraries (libg++-2.7.2, libstdc++-2.7.2) needed to run C++ code compiled with gcc-c++-2.7.2.3. RedHat 5.1 introduces the new egcs (experimental GNU compiler system) and supplies egcs-1.0.2 amd its front ends for compiling C++ (egcs-c++), objective C (egcs-objc) and fortran (egcs-g77). The egcs-c++ compiler uses new C++ libraries supplied by packages libstdc++, libstdc++-devel. The libstdc++ rpm package provides the runtime library (libstdc++-2.8.0) needed to run C++ code compiled with egcs-c++. But RedHat 5.1 ALSO includes the gcc-2.7.2.3 compiler (pure C only, without C++ or objective C front ends) in a rpm package (gcc-2.7.2.3-11) designed to coexist with egcs. This is because it is recommended by the maintainers of the current stable Linux 2.0.x kernels that they should only be recompiled with gcc-2.7.2.3, which is what they were developed with. (egcs is "approved" for 2.1.x and later kernels). These instructions will help you upgrade your RedHat 5.0 system to have the RedHat 5.1 compiler setup, without a full upgrade of the whole system to RedHat 5.1 Once the preliminaries for the upgrade (the upgrade of binutils to version 2.9) are completed, you will be able to easily switch between the RedHat 5.0 and RedHat 5.1 compiler environments if you wish to use both the gcc and the egcs C++ compilers. -------- 2. Getting the necessary rpms. Obtain the following rpms from the RedHat ftp site ftp://ftp.redhat.com/pub/redhat or mirrors, such as ftp://sunsite.unc.edu/pub/Linux/distributions/redhat (a) From the original RedHat 5.1 distribution (i386 binary rpms in subdirectory .../redhat/redhat-5.1/i386/RedHat/RPMS): gcc-2.7.2.3-11.i386.rpm binutils-2.9.1.0.4-2.i386.rpm egcs-1.0.2-8.i386.rpm egcs-c++-1.0.2-8.i386.rpm libstdc++-2.8.0-8.i386.rpm libstdc++-devel-2.8.0-8.i386.rpm You may also wish to otain egcs Objective C and Fortran compiler front ends: egcs-objc-1.0.2-8.i386.rpm egcs-g77-1.0.2-8.i386.rpm (b) From the RedHat 5.0 (not 5.1) updates (Source rpms in subdirectory .../redhat/redhat-5.0/updates/SRPMS): procps-1.2.7-1.src.rpm (c) Unless you have already done this, from the RedHat 5.0 (*NOT* 5.1) updates in subdirectory .../redhat/redhat-5.0/updates/i386 get: libtermcap-2.0.8-9.i386.rpm libtermcap-devel-2.0.8-9.i386.rpm ncurses-1.9.9e-9.i386.rpm ncurses-devel-1.9.9e-9.i386.rpm -------- 3. Update binutils to binutils-2.9, and rebuild procps. The only complication in upgrading from the RedHat 5.0 gcc-2.7.2.3-8 compilers to the RedHat 5.1 gcc-2.7.2.3-11 and egcs-1.0.2-8 compilers is that egcs requires a newer vesion (2.9) of binutils, and an important RedHat 5.0 system component (procps, which supplies the "ps" command) is compiled to link with a component of the older binutils-2.8. Note that you CANNOT use the RedHat-5.1 procps rpm on your RedHat 5.0 system: INSTEAD the solution is to force installation of the newer binutils-2.9, and then rebuild (recompile) the procps source rpm. Compilation of procps requires libtermcap-devel and ncurses-devel. Make sure you have these installed. (Note, there are updated versions of these for RedHat 5.0 on the RedHat ftp site; procps is also updated). Here is what to do (you must be root); this assumes that you have the gcc-2.7.2.3-8 that comes with RedHat 5.0 installed and working (check this with "rpm -q gcc" and "rpm -V gcc"). If not, go back to your RedHat 5.0 distribution, and install what is necessary for a development system. This step should be carried out *before* upgrading the compilers. First attempt the installation of the newer binutils from RedHat 5.1 with rpm -Uvh binutils-2.9.1.0.4-2.i386.rpm This will probably fail, with a message like "failed dependencies: libbfd.so.2.8.1.0.1 is needed by procps-1.2.4-1" (version numbers may be different). libbfd is a library supplied by the binutils rpm. (If any other conficts besides the one with procps are reported, you will have to also rebuild the corresponding rpm; let me know about it). To proceed, force installation of binutils-2.9 from RedHat 5.1 with the --nodeps option, which tells rpm not to care about the incompatibility with procps: rpm -Uvh --nodeps binutils-2.9.1.0.4-2.i386.rpm This will leave procps partially broken by an unsatisfied dependency which you will now repair by rebuilding the procps rpm to use the libbfd from the newer binutils. First check (with rpm -q) that the rpm packages glibc-devel and XFree86-devel are installed (needed for compiling most things). Next check that libtermcap-devel and ncurses-devel are installed. If you have the latest updates (at the time of writing), "rpm -q libtermcap-devel" will report "libtermcap-devel-2.0.8.9". Similarly, you should have ncurses-devel-1.9.9e-9.i386.rpm. If you do not have these (or have the older versions that RedHat recommends upgrading), get the RedHat 5.0 updates and install: rpm -Uvh libtermcap-2.0.8-9.i386.rpm rpm -Uvh libtermcap-devel-2.0.8-9.i386.rpm rpm -Uvh ncurses-1.9.9e-9.i386.rpm rpm -Uvh ncurses-devel-1.9.9e-9.i386.rpm (since you should upgrade libtermcap and ncurses at the same time). If libtermcap-devel amd ncurses-devel were not previously installed on your system, you can remove them with rpm -e after you have rebuilt the procps rpm. Assuming you have gcc installed (check this with "rpm -q gcc", which should confirm that gcc-2.7.2.3-8 is installed), you can now rebuild the updated procps source rpm for RedHat 5.0. rpm --rebuild procps-1.2.7-1.src.rpm A lot of messages from the rebuild process will scroll up the screen. If the rebuild finishes successfully, it will create two binary rpms, procps-1.2.7-1.i386.rpm and procps-X11-1.2.7-1.i386.rpm, in the directory /usr/src/redhat/RPMS/i386/. [If the rebuild fails, you may not have a full RedHat-5.0 development environment installed, and you may need to install some missing rpms from the RedHat 5.0 distribution. If no packages appear to be missing, you could also try "rpm -Va" to verify the installed rpms, and try to see if any inconsistencies it reports might be related to your problem. (If "rpm -Va" reports is inconsistent, "rpm -qf " will tell you which rpm package installs it ( is the full filename including the path); suspect packages can be reinstalled with rpm -Uvh --force .] Now install the procps binaries you created. First check if you also have procps-X11 installed on your system, as well as procps: rpm -q procps-X11 The procedure you are about to do will install procps-X11 as well as procps. Now install the procps and procps-X11 binary rpms you created: rpm -Uvh /usr/src/redhat/RPMS/i386/procps*-1.2.7-1.i386.rpm Note that if you have already installed the updated binary procps-1.2.7-1.i386.rpm from RedHat's ftp site, you will have to force installation of the one you just made, as it has the same release number: rpm -Uvh --force /usr/src/redhat/RPMS/i386/procps*-1.2.7-1.i386.rpm If procps-X11 (a graphical interface to procps) was not previously installed, and you do not want it, you can now uninstall it with "rpm -e procps-X11". Finally check your system with rpm -V binutils rpm -V procps (and "rpm -V procps-X11" if necessary). If all has worked correctly, there will be no output from rpm. If RedHat releases any newer updates of procps for RedHat 5.0, remember to rebuild the source rpm. If you later restore the standard RedHat 5.0 gcc-2.7.2.3-8 compilers you do *NOT* need to downgrade binutils back to binutils-2.8. Leave the newer binutils-2.9 that you just installed in place. -------- 4. Add the standard C++ runtime library libstc++-2.8.0 for egcs. This installs the C++ library needed to run applications compiled with egcs-c++-1.0.2. (This will already be present on your system if you have installed the "rh51" KDE-1.0 binary rpms.) rpm -Uvh libstdc++-2.8.0-8.i386.rpm -------- 5. Replace the RedHat 5.0 compilers with the RedHat 5.1 versions. First remove the RH5.0 objective C compiler (if installed), then C++, then C: rpm -e gcc-objc (if installed) rpm -e gcc-c++ libg++-devel rpm -e gcc (Note: don't touch libg++ itself) Now install the RH5.1 compilers, as needed. rpm -Uvh gcc-2.7.2.3-11.i386.rpm rpm -Uvh egcs-1.0.2-8.i386.rpm rpm -Uvh egcs-c++-1.0.2-8.i386.rpm libstdc++-devel-2.8.0-8.i386.rpm rpm -Uvh egcs-objc-1.0.2-8.i386.rpm (if needed) rpm -Uvh egcs-g77-1.0.2-8.i386.rpm (if needed) (The RH5.1 gcc-2.7.2.3-11 package is designed to coexist gracefully with the egcs compiler). Congratulations! You have finished upgrading your RedHat 5.0 system to have the same compiler environment as RedHat 5.1. -------- 6. Using egcs or gcc in the RedHat 5.1 compiler environment. Because there are now two different C compilers installed, some care is needed to use the correct one for your purposes. By default, gcc-2.7.2.3 is called by "cc". If you wish to compile with egcs, type export CC=egcs before "make". (Many Makefiles use the environment variable CC to choose the C compiler). If the package you are compiling uses autoconf to generate a Makefile, you can instead use CC=egcs ./configure instead of ./configure. To make egcs the default C compiler, add a line export CC=egcs to /etc/profile. In this case, if you are recompiling the Linux 2.0.x kernel, type export CC=gcc before recompiling it, to use gcc-2.7.2.3. -------- 7. If you wish to reinstall the RedHat 5.0 compilers The egcs compiler is still under development, and its possible that you have problems using it on certain C++ code. It is also stricter, and may refuse to compile some code that compiles with gcc-c++-2.7.2.3. You may wish to test C++ code on both compilers. If a bug in egcs-1.0.2 looks like a problem, you may wish to try a later version of egcs in the 1.0.x series; rpms for these can often be found (e.g., in the "contrib" section of RedHat's ftp site). Hopefully, these are compatible with the RH5.1 installation described here, but you are on your own if you use them!. egcs-1.1 (with libstdc++-2.9) is now released, but KDE applications compiled with this are probably(?) incompatible with the KDE and qt rpms compiled with egcs-1.0.2. So maybe you might need to (temporarily) put back the standard RH5.0 compilers (or you may wish only use the RH5.1 compilers only for your KDE compiling needs, and the RH5.0 compilers for everything else). Don't worry - it's easy using rpm! First make sure that libg++-2.7.2.8-6 from the RedHat 5.0 distribution is already installed. rpm -q libg++ (Install it if it is missing with "rpm -Uvh libg++-2.7.2.8-6.i386.rpm".) Now remove the RH5.1 Fortran and objective C compilers (if installed), then C++, then C: rpm -e egcs-g77 (if installed) rpm -e egcs-objc (if installed) rpm -e egcs-c++ libstdc++-devel rpm -e egcs rpm -e gcc (Note: don't touch libstdc++ itself). Now install the RH5.0 compilers, as needed (from your RedHat 5.0 distribution): rpm -Uvh gcc-2.7.2.3-8.i386.rpm rpm -Uvh gcc-c++-2.7.2.3-8.i386.rpm rpm -Uvh libg++-devel-2.7.2.8-6.i386.rpm rpm -Uvh gcc-objc-2.7.2.3-8.i386.rpm (if needed) You have now finished restoring the original compiler environment on your RedHat 5.0 system. To return to the RH5.1 compilers afterwards, just repeat step (5). Note that /lib/cpp (the C preprocessor) in RH5.1 is in the egcs rpm package, but it is in the gcc rpm on RH5.0, so you *must* use the RH-5.0 gcc-2.7.2.3-8 package (*NOT* gcc-2.7.2.3-11 from RH5.1) for the C compiler after egcs is removed. I do not believe that there are any problems using the newer RH5.1 binutils-2.9 with the original RedHat 5.0 compilers, but if I am mistaken, you can restore the original RH5.0 binutils-2.8 with the rpm options rpm --oldpackage --nodeps -Uvh (because it is older, and will conflict with the new procps you installed). Now restore the standard RH5.0 procps and procps-X11, both at the same time, with rpm --oldpackage -Uvh (if they have older version numbers than the rebuilt rpms) or rpm --force -Uvh (if they have identical version numbers to the rebuilt rpms). Use rpm -V to check the restored binutils, procps, and procps-X11 packages. If you are confused by different copies of the procps binary rpms with the same version and release numbers, (one from the RedHat ftp site, one rebuilt by you), you can check when and by whom they were compiled using rpm -qi procps procps-X11 (this queries the installed procps packages) and rpm -qip procps*rpm (this queries uninstalled procps rpm files in your current directory). ---------------------------------------------------------------- I have tried to give full and complete instructions. If I have omitted any step, please let me know: Duncan Haldane