# A slimmer Gentoo ;)

## sledge

Size matters. Everbody knows that.  :Cool: 

How to install gentoo (stage3) with dietlibc

The easy (time-consuming  :Wink:  ) way:

After you have untared your stage3-tarball you have to emerge dietlibc

```
# emerge dietlibc
```

After that, edit your make.conf and add the following lines anywhere in your make.conf (preferably after the host-settings section):

```
# Compiler Setting

# ================

#

# If you want to use a different libc (i.e. fefe`s dietlibc) and

# you are provided with a wrapper script for gcc you want to

# change this line.

#COMPILER="gcc3"

COMPILER="diet"
```

and change your CFLAGS:

```
# I usually compile with -pipe and -fomit-frame-pointer ,too

CFLAGS="-march=your_arch_here -Os"
```

Now you have to rebuild all you packages (that`s why it`s the time-consuming way  :Wink:  ):

```
# export CONFIG_PROTECT="-* /etc/make.conf"

# emerge -uUDep system

( prints packages )

# emerge -uUDe system

( recompiles all (new) packages using dietlibc )

# unset CONFIG_PROTECT

```

... and continue with step 14 of the Installation Guide.

Don`t forget to backup your make.conf before every portage update. Portage will replace your make.conf with a default one.

Hope that helped   :Razz: 

----------

## sledge

I just noticed that this should have gone into "Installing Gentoo".

Doh!   :Shocked: 

----------

## nikai

In theory, this is a very nice idea.

But I guess it takes to hack ebuilds to actually use that wrapping.

I see other distros (like ROCK) put a lot of work in getting stuff to compile against dietlibc (like gawk, for example).

----------

## puggy

 *sledge wrote:*   

> ... and continue with step 14 of the Installation Guide.
> 
> Don`t forget to backup your make.conf before every portage update. Portage will replace your make.conf with a default one.

 

No it won't. etc-update might but only if you let it or are careless enough to just let etc-update auto-update all files.

Puggy

----------

## pilla

Moving to Docs, Tips & Tricks.

----------

## DefconAlpha

So slimmer you say? How big is your install of Dietlibc Gentoo? Do you also have at least an approximation of the size after finishing the stage3 install? With glibc it is almost 1gb, just curious really.

----------

## Chickpea

DefconAlpha wrote

 *Quote:*   

> So slimmer you say? How big is your install of Dietlibc Gentoo? Do you also have at least an approximation of the size after finishing the stage3 install? With glibc it is almost 1gb, just curious really

 

yours is really that high with only a base system...Stage 3?  my system currently is at 1.1 gb and that is with X, evolution, a couple of window managers gedit, and Mozillafirebird and some other fun things.

----------

## DefconAlpha

 *Chickpea wrote:*   

> 
> 
> yours is really that high with only a base system...Stage 3?  my system currently is at 1.1 gb and that is with X, evolution, a couple of window managers gedit, and Mozillafirebird and some other fun things.

 

Umm, i think so, perhaps it was more in the 600 - 700 MB range. But i have slept since then. Like several months worth of sleeping. (Not to mention several other memory-degrading activities)... 

Now to get linux on two floppies with dietlibc. Then we can install gentoo on non-cdrom booting computers :)

----------

## Chickpea

 *Quote:*   

> Now to get linux on two floppies with dietlibc. Then we can install gentoo on non-cdrom booting computers 

 

can't you just create a grub boot disk and install from a network or hard drive.  I installed a couple of times from a spare hard drive...but it has been so long.

----------

## Gibberx

..what is dietlibc? sounds like a replacement of glibc, of course...

does it make your binaries smaller, or what?

----------

## imp

From diet libc homepage:

 *Quote:*   

> The diet libc is a libc that is optimized for small size. It can be used to create small statically linked binaries for Linux on alpha, arm, hppa, ia64, i386, mips, s390, sparc, sparc64, ppc and x86_64.

 

----------

## DefconAlpha

 *Chickpea wrote:*   

> can't you just create a grub boot disk and install from a network or hard drive.  I installed a couple of times from a spare hard drive...but it has been so long.

 

Yes, but it would be really nice to have the two floppies that did all of the above... Boot from the floppies and install from cdrom, network, spare hard drive, etc. Anything really... Perhaps even modify the second floppy for clustering utilities or small servers (dhcp, iptables, ftp, mail, etc)

Just a nifty thing to have lying around for "one of those days"

----------

## simcop2387

seldge i got to hand it to you so far my laptop has been recompiling system and its not even near done and i've got 40+ meg more of free space, everything appears to be working right now, when i'm done i'm doing an emerge world to get X and everything compiled with dietlibc, i was running near 25meg free before this

----------

## someguy

wow good howto saving me space on my router  :Smile: 

----------

## ghardey

 *Quote:*   

> and change your CFLAGS:
> 
> ```
> Code:
> 
> ...

 

When I tried using the -fomit-frame-pointer flag I got an error "C compiler cannot create executable" when emerging gnet.  config.log showed that it didn't like -fomit-frame-pointer.    After I removed that flag emerged without error using dietlibc 0.23.

----------

## dub.wav

 *sledge wrote:*   

> Now you have to rebuild all you packages (that`s why it`s the time-consuming way  ):
> 
> ```
> # export CONFIG_PROTECT="-* /etc/make.conf"
> 
> ...

 

If you have to rebuild the whole system, why not just start from stage1?  :Confused: 

----------

## Aaron_Brown

After I have compiled everything with dietlibc can I remove glibc?

Aaron

----------

## _hesoez_

is it normal that i still see 'gcc ... -Os -... blabla.c'

as an output on the screen when compiling something?

can i let another box that doesn't have dietlibc compile for my box with dietlibc when using distcc?

grtz

----------

## airflow

 *dub.wav wrote:*   

>  *sledge wrote:*   Now you have to rebuild all you packages (that`s why it`s the time-consuming way :wink: ):
> 
> ```
> # export CONFIG_PROTECT="-* /etc/make.conf"
> 
> ...

 

Because as far as I know you wouldn't have the possibility to emerge dietlibc before bootstrapping. So you would have to bootstrap twice... Better to start with a Stage-3 Installation in this case, I think.

regards,

airflow

----------

## airflow

 *sledge wrote:*   

> After that, edit your make.conf and add the following lines anywhere in your make.conf (preferably after the host-settings section):
> 
> ```
> # Compiler Setting
> 
> ...

 

Are you sure this works? I had a look into the manpage of make.conf, and this (rather important) variable is not mentioned anywhere... I would like to try it, but it will take a week or so to recompile my system with my laptop, so I would like to be sure.

regards,

airflow

----------

## Serj

Anyway, did anybody try dietlibc? 

Does it work now with 2004.1? 

Does all packages compile well with dietlibc?

P.S. Sorry for my English!

----------

## kamagurka

 *sledge wrote:*   

> Don`t forget to backup your make.conf before every portage update. Portage will replace your make.conf with a default one.

 

what horrible nonsense. i'm not taking any advice from someone who doesn't even know about etc-update/dispatch-conf   :Rolling Eyes: 

----------

## Serj

Yestarday, I'v try to use diet to reemerge some packages as writing above but nothing happend - the size of binaries have stay the same.

Does anybody now how to use diet in Gentoo 2004.1?

----------

## SDraconis

It looks like this thread it pretty old.  I was wondering if anybody has had any luck with this in more recent versions of Gentoo.  Does setting COMPILER in make.conf work to have things compile with dietlibc still?

----------

## Jeffrey0

 *Quote:*   

> It looks like this thread it pretty old. I was wondering if anybody has had any luck with this in more recent versions of Gentoo. Does setting COMPILER in make.conf work to have things compile with dietlibc still?

 

I can't find any matches for COMPILER in all of portage... don't think it does anything. Looks like the new way is using profiles. There's one for uclibc.

 *kamagurka wrote:*   

> what horrible nonsense. i'm not taking any advice from someone who doesn't even know about etc-update/dispatch-conf  

 

Look at the date. Portage updates *did* overwrite make.conf back then IIRC (used Gentoo for a little while back in 2003).

----------

