LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-11-2008, 08:29 PM   #1
dimm0k
Member
 
Registered: May 2008
Location: Brooklyn ZOO
Distribution: Slackware64 14.2
Posts: 564

Rep: Reputation: 56
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?
 
Old 05-12-2008, 01:54 AM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
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/
 
Old 05-12-2008, 08:36 AM   #3
mcnalu
Member
 
Registered: Dec 2006
Location: Glasgow, UK
Distribution: Slackware current
Posts: 423

Rep: Reputation: 73
Another option is virtualisation. You can run an older version of slackware inside your current one (or vice versa).
 
Old 05-12-2008, 12:11 PM   #4
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
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.
 
Old 05-12-2008, 02:08 PM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by mcnalu View Post
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.
 
Old 05-12-2008, 03:32 PM   #6
mcnalu
Member
 
Registered: Dec 2006
Location: Glasgow, UK
Distribution: Slackware current
Posts: 423

Rep: Reputation: 73
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.
 
Old 05-13-2008, 02:14 AM   #7
dimm0k
Member
 
Registered: May 2008
Location: Brooklyn ZOO
Distribution: Slackware64 14.2
Posts: 564

Original Poster
Rep: Reputation: 56
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?
 
Old 05-13-2008, 09:14 AM   #8
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to upgrade to gcc 4.1.2 from gcc 3.4.4 on Slackware 11.0 lali.p Slackware 4 09-10-2007 06:31 AM
Which GCC is the Best for Slackware 10.2? byte weaver Slackware 25 11-14-2006 10:22 AM
Upgrade from gcc 3.X to gcc 4.0 in Slackware Bob_H Linux - Software 2 06-01-2006 08:51 PM
slackware 8.1 and gcc adi Linux - Software 2 02-04-2003 11:27 AM
gcc/slackware xlord Slackware 1 01-18-2003 09:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration