HOWTO Recover from "emerge --unmerge gcc"
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article
After realizing what a silly mistake you have made, this is how you get GCC back onto your system.
Contents |
[edit] Get a Binary Package
The following link contains a selection of binary packages. Hopefully, one of the gcc-x.*.tbz2 packages will work for you.
http://technobabel.de/downloads/gentoo-binpkg/gcc-3.4/sys-devel/
[edit] Extracting
Go to the directory where you've downloaded the binary package, and extract the files.
# tar -xvjf gcc-*.tbz2 -C /
[edit] Viewing the List of Compilers
Now to you'll need to see what compiler it is exactly.
# gcc-config -l
You should see something similar to this:
| Code: Gcc-config -l Result |
[1] i686-pc-linux-gnu-4.1.2 * |
[edit] Selecting a Compiler
Run gcc-config again, but this time state the compiler to use. The following command uses the information from the previous step. Change accordingly.
# gcc-config i686-pc-linux-gnu-4.1.2
You should see something similar to this:
| Code: Gcc-config Result |
* Switching to i686-pc-linux-gnu-4.1.2 compiler ... [ ok ] * If you intend to use the gcc from the new profile in an already * running shell, please remember to do: * # source /etc/profile |
[edit] Source Profile
Follow the instructions and type:
# source /etc/profile
[edit] For the Future
Don't unmerge GCC again!
For future reference: Take a look at SA5: Things to not unmerge or remove over on the Gentoo Forums.
[edit] No network? No glibc either? (Can't run commands and machine won't boot?)
This procedure, written by Toby on Slashdot.org, rescued a system using a Gentoo Live CD where both gcc AND glibc had been unmerged.
[edit] "I Did This" Wall of Shame
- QwertyM - revdep-rebuild was building gcc-4.2.3 and I'd left it, looks like the power cut off before it could complete and I didn't know that so I do a depclean, it says removing older version of gcc, and poof, here I am. :(
- Joe Wolf - I'm an complete idiot, it's only one reason....
- Lord Sauron (lordsauronthegreat (at) gmail (dot) com) "I can't believe I just did that!"
- LouDawg - after years of using Gentoo without any fatal mistakes, I must've been drugged to have done such a stupid thing :-)
- I didn't do this, but some how killed my compiler (maybe through prune). Still helpful.
- Terrestrial Host - .....I'm such a fool...thankfully there are those out there who cover for us.
- Wiz - Newbie. was trying out different things with portage. :)) guess this was the one thing I shouldn't have tried.
- jmpnz - Hmm I guess an assembler would be nice to have.
- Viaken - Through some careless by-hand rsyncing, I not only lost gcc, but wiped my entire /usr directory. Fun times. :)
- Buddy - Just wanted to remove the last version, but accidently unemerged all :-(
- David H. - Thought I was cleaning older versions of GCC left on my system, ignored the huge red warning, b0rked my system, recovered, and learned from it.
- Tune - 5 4 3 2 1... Yikes! Did I just do what I think I did?! Thanks for getting me on the road again
- UT -Yup add me to the wall, it was stupid and get me a heart attack but this wki really got me on the road again!
- ML - I had the brilliant idea of unmerging gcc when emerge --update world kept breaking.. Well I'm glad I found this page :)
- PC - (I didn't do this either, but like number 3, I still managed to screw my GCC install.) Thank you!
- bheekling - *SHOOT* (was sleepy, depcleaned, long story :|)
- 9a3eedi - its not my fault. it was --depcleans fault!! >_____>
- Kelvie Wong - It was late at night, and I just compiled the latest GCC. I then decided to emerge -C gcc .... and didn't specify the version. I ended up just reinstalling gentoo (preserving /home and /etc), as even after the gcc recovery, some libs were missing (for some reason).
- TKhemili78 - It was .... Soap ...Poisoning, yeah forgot to set =sys-devel/gcc-x.x.x when I was spring cleaning
- Troy Berg - Just to get on this list, it was really easy too! emerge didnt even try and stop me.
- Stephen Young - Woo! that was fun! depclean wouldn't nuke ALL versions of gcc would it? Just the old ones right? OK I trust you depclean... I should know better!
- I knew a Guy...Who knew a guy...whos cousin did this :)
- hasardeur - I am 100% sure I've checked - but then again, I might not have... So much for a "minimal" backup - that was not the plan, but fun!
- beeplogic - thanks to http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1 for suggesting depclean! <3
- Dmitry Morozhnikov — «emerge -C gcc-4.1.2» was a wrong way to select another version of gcc…
- jklister - checking whether the C compiler (gcc ) works... no "Aw crap.."
- unregistr3d - "Your gcc is broken" <- great error :D, next time i don't left the room when "emerge --depclean"
- petaflot - "complained about some bug present in 4.1 and 4.2". I installed 4.3, but it still wouldn't work. after unmerging 4.1 and 4.2, I realized 4.3 was "not a valid profile".
