Main > Linux
using different gcc compilers in Linux
elvis:
Just an FYI, under gentoo you can type:
gcc-config -l
to list all of the available compilers to the system. Each compiler will have a number beside it. For instance, on my system it reports:
--- Quote ---elvis ~ # gcc-config -l
[1] i686-pc-linux-gnu-3.3.6
[2] i686-pc-linux-gnu-3.3.6-hardened
[3] i686-pc-linux-gnu-3.3.6-hardenednopie
[4] i686-pc-linux-gnu-3.3.6-hardenednopiessp
[5] i686-pc-linux-gnu-3.3.6-hardenednossp
[6] i686-pc-linux-gnu-3.4.4 *
[7] i686-pc-linux-gnu-3.4.4-hardened
[8] i686-pc-linux-gnu-3.4.4-hardenednopie
[9] i686-pc-linux-gnu-3.4.4-hardenednopiessp
[10] i686-pc-linux-gnu-3.4.4-hardenednossp
--- End quote ---
with the default being gcc-3.4.4 (marked with an asterisk (*))
Say I want to change the default compiler to an older one like 3.3.6 (marked as number 1 in the list above), I'd type:
gcc-config 1
env-update
source /etc/profile
This would change the default compiler, and then refresh all my environment information so that the current console is ready to go with the new compiler. No need to force "CC=" command line arguments.
Gentoo is a source-based distro, and has a lot of neat tools like this built in to make compiling easier on the end user, both for novices and for experts who want to save time.
MotorHedJr:
Hi elvis, Major Rock,
Major Rock - following your link to your thread I got it working -- Thank You!!!
One question:
elvis:
--- Quote from: MotorHed
[color=Beige ---elvis[/color] - thanks for the info. How do you guys learn all these tricks? I have tried to find a decent Linux book for beginners, but they either suk (only show how to work in a desktop environment) or are specific to a distro. Do you know of a decent gentoo linux book?
--- End quote ---
"Linux" is a kernel. Finding generic books on "Linux" won't help you, as they all cover very general kernel and GNU stuff.
Each distribution often contains a lot of customisations, particularly when it comes to package managment. Upgrading old packages and getting new packages onto a system are generally fairly unique things distro to distro, and the best resource is always the website of the distro itself. Likewise system-sepcific configuration (Gentoo has some amazing tools to manage system config and startup rc scripts). Basic skills such a file manipulation, scritping, etc will translate easily between distros.
If you're a Gentoo user, then you absolutely *must* read the Gentoo handbook from start to finish. Yes, a lot of it is boring and obvious, but tucked away inside it are great tips and tricks like the ones I posted above:
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml
Other languages, viewing formats and architectures available here:
http://www.gentoo.org/doc/en/handbook/index.xml
Even seasoned old fogeys like myself should re-read these things from time to time to refresh our skills. There is no such thing as "good" or "bad" Linux users. There are only users who either have or haven't RTFM. :)
Outside of that, the Gentoo forums are incredible. They are simply some of the best Linux forums I've ever had the pleasure of subscribing to, and full of ultra-friendly people. If you've ever got a drama, post something there and you'll be bound to have a detailed and helpful response within a day or so.
Major Rock Hardy:
I agree with elvis about the gentoo handbooks! However, I highly recommend O'Reilly books - the one that I keep around is "Running Linux". You can find info here:
http://www.oreilly.com/catalog/runux4/
however, most distributions of Linux have slightly different variations on how they do things - for that - enter the gentoo handbooks.
--- Quote from: MotorHedJr on December 19, 2005, 05:35:24 pm ---Hi elvis, Major Rock,
Major Rock - following your link to your thread I got it working -- Thank You!!!
One question: How do you permanently insert the svgalib_helper module? Whammoed's site says:
[add svgalib_helper to the /etc/modules/.autoload.d/<kernel_version> to load the module at boot time]
Do you mind listing the command line you used to do this? (I would hate to screw up my kernel at this point...)
Again, thanks!!!
--- End quote ---
I'm glad you got it working - that one was a pain. I had to dip back to my C programming knowledge a bit to resolve that one. As far as your autoload kernel module question, whammoed's guide was for his linux distro (I believe LFS) - for gentoo, it's different. This is one of those places where things diverge a bit based on the distro. For gentoo, you're going to modify /etc/modules.autoload.d/kernel-2.6 (assuming you are using a 2.6 kernel (which you should be - you chose to do this during gentoo install).
I use VI to edit files - but I use that for work every day so I am used to it. Actually I use vim which is vi- improved. It is not user-friendly for the beginner user. But it is very powerful if you learn it. If you just want to get by with a windows-notepad-style editor, gentoo includes one called nano. To use this, just type:
nano <name of file>
also under most Unixes, to find out how to use a command, type:
man <command>
which will bring up the manual for that software. So you should do a man nano before using nano, so that you know how to exit the program once you're done using it, etc.
if you are interested in vim (my favorite), you can get it by doing
emerge vim
so, in summary, to change my autoload configuration, I used the command:
vim /etc/modules.autoload.d/kernel-2.6
and I think the O'Reilly book Running Linux has a brief intro to vi in there. They also publish a vi book. But there are numerous vi/vim beginner pages out there - just google for them.
Hope this helps,
Rock
Major Rock Hardy:
Oh, it looks like they have a 5th edition coming out:
http://www.oreilly.com/catalog/runlinux5/
click on the 'Table of Contents' link to get a preview... looks like just what you are looking for.
Rock
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version