LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   getting gcc 4.1 on Slackware 12.1 while preserving 4.2 (https://www.linuxquestions.org/questions/slackware-14/getting-gcc-4-1-on-slackware-12-1-while-preserving-4-2-a-641524/)

dimm0k 05-11-2008 08:29 PM

getting gcc 4.1 on Slackware 12.1 while preserving 4.2
 
Upgrading to Slackware 12.1 from 12.0 removed gcc 4.1 and now I'm no longer able to compile a 2.4 kernel on this system for one of my older machines. Is it possible to get 4.1 onto this system while preserving what's on this system now?

gnashley 05-12-2008 01:54 AM

The best way to have a multi-compiler system is to compile the extra compiler and install it to a separate prefix which is not in the normal path -like /usr/gcc-4.1. Then create a wrapper which sets the PATH variable before handing execution over to the alternate compiler. The wrapper gets placed in the normal path. You can see an example of how to do this here:
http://distro.ibiblio.org/pub/linux/...vel/gcc-3.4.6/

mcnalu 05-12-2008 08:36 AM

Another option is virtualisation. You can run an older version of slackware inside your current one (or vice versa).

gnashley 05-12-2008 12:11 PM

Actually, I'd recommend using the gcc-3.4.6 version as long as you are keeping an old version around. the 3.4.6 version will give you better backwards-compatibility with other sources besides the kernel.

If you are not a src2pkg user, you can still use most of the content of the gcc.src2pkg script as-is for building a package your own way, or simply installing it straight to the system.

H_TeXMeX_H 05-12-2008 02:08 PM

Quote:

Originally Posted by mcnalu (Post 3150772)
Another option is virtualisation. You can run an older version of slackware inside your current one (or vice versa).

Although plausible, this is not the best solution.

I agree with gnashley, I have gcc-3.x installed on 12.0 because some things just won't compile with gcc-4.x for various reasons.

It's the best solution I think.

mcnalu 05-12-2008 03:32 PM

Quote:

Although plausible, this is not the best solution.
Yes, sledgehammer/nut for just a 2.4 kernel build alone, but I was surprised by how little time it takes to get an OS up and running using VirtualBox.

dimm0k 05-13-2008 02:14 AM

Ok, the next question in this is what's the easiest way to compile an older version of gcc installed on Slackware 12.1? Can I use the slackBuild script in 12.1 for gcc or a slackBuild script from an older version of Slackware for gcc or is it recommended to compile manually?

gnashley 05-13-2008 09:14 AM

No you can't just use the regular SlackBuild as this will cause the new(old) compiler to overwrite the standard version.

AlienBob has a Slackbuild for compiling an alternate version which can be installed alongside of the standard compiler, however, my src2pkg build script installs it in such a way that it will co-exist much better.

As I said, the best way is to configure and install the alternate compiler into its' own prefix which is not part of the normal PATH -inother words do not install it into --prefix=/usr. By configuring and installing into a separate path and then using a wrapper script to run the alternate version, things will run much smoother.

You can build your own if you like, using my src2pkg script from here:
http://distro.ibiblio.org/pub/linux/...vel/gcc-3.4.6/
You need to install src2pkg in order to use that script, though. If you just want the easiest way out, just install this pre-compiled package:
http://distro.ibiblio.org/pub/linux/...4.6-i486-1.tgz

The package installs the the gcc-3.4.6 compiler to prefix=/usr/gcc-3.4.6. But it places a 'wrapper' script in /usr/bin which is called GCC346.
In order to compile sources with the alternate compiler, simply type 'GCC346' before the regular command. For example, to build the kernel-2.4.x sources:
'GCC346 make dep'
'GCC346 make bzImage'
'GCC346 make modules'
'GCC346 make modules_install'

This is the easiest and most dependable way to use an alternate compiler. Other methods require you to manually alter your PATH or create/edit your .bashrc file and may still not work with all sources unless you alter the sources. I use this method to keep 5-6 compiler versions on my system at all times.


All times are GMT -5. The time now is 11:03 PM.