Home page of this blog

Saturday, August 13, 2011

Optimizing libc6 package for core2 in Ubuntu/Mint


Disclaimer: The following is only for who would love to take risks. Rebuilding/Resinstalling libc6 may make the system totally unrecoverable. Use the following at your own risk and hence I am not uploading the packages I built optimized for core2


This is how I fetched and built libc6 package optimized for core2. 


Install build dependencies for libc6

sudo apt-get build-dep libc6


Create a directory for building libc (preferably inside /usr/src/)



cd /usr/src/
mkdir -p glibcbuilds
cd glibcbuilds

Get the source package of libc6 from Ubuntu/Debian repository (deb-src should be enabled for getting source packages)

apt-get source libc6


Enter into eglibc folder extracted

cd eglibc-2.13/




Edit debian/rules  and modify CFLAGS


#edit the required cflags like march and mtune
#modify run test suite to no
vi debian/rules


BUILD_CC = gcc-4.5 -fno-stack-protector -U_FORTIFY_SOURCE -march=core2 -mtune=core2
BUILD_CXX = g++-4.5 -fno-stack-protector -U_FORTIFY_SOURCE -march=core2 -mtune=core2

RUN_TESTSUITE = no

The above are the changed in debian/rules for targeting/optimizing to core2

Enable parallel build

#set 8 for a i7, 4 for a quadcore, 2 for a core2, 1 for others
export DEB_BUILD_OPTIONS="parallel=8"


Clean before building

#clean
fakeroot debian/rules clean


Build

#build
time fakeroot dpkg-buildpackage -uc -us

Install the built packages

cd ..

sudo dpkg -i libc6_2.13-0ubuntu13_amd64.deb libc6-dev_2.13-0ubuntu13_amd64.deb libc6-i386_2.13-0ubuntu13_amd64.deb libc6-dev-i386_2.13-0ubuntu13_amd64.deb



11 comments:

  1. Did you really notice any performace boost after recompiling an optimized libc?

    ReplyDelete
    Replies
    1. It was fast and I was using for sometime, but I did something and deleted some files by mistake, eventually Ubuntu did not boot, so reinstalled

      I can tell it is not worth the time and effort, if you have lots of spare time you could try

      Delete
  2. I am tempted anyway, since it is one of the claims on the opensuse website

    to clarify,

    they say that they could manage to majorly speed up the system by recompiling libc with certain options

    they do not say which, probably it is not processor specific, since the distro is made for generic hardware...

    it seems that there is some powerful switch hidden somewhere

    ReplyDelete
    Replies
    1. Also openSUSE and Fedora uses a different libc, debian/Ubuntu/Mint uses eglibc (embedded libc)

      Further, openSUSE they have preemptive 1000 HZ kernel, just not the libc optimization. If you think openSUSE is fast, just try slackware, it is plain, no services running except the ones you want and runs like a speedy beast

      Delete
  3. To be honest, opensuse I did not try, but mentioned to you the claims on their website.

    What do you think underlies the faster speed of slackware apart from the less services?

    How they compiled the distro?

    Because in a way, simply switching off services in ubuntu should achieve similar results

    ReplyDelete
    Replies
    1. I don't know how they compiled, but you can't switch off any services in Ubuntu easily, take for example pulseaudio, can you get rid of it? Slackware does not have it!!

      Or take for example the removing of tracking app see my earlier article How I removed logging from Ubuntu and ended up with no UI

      And another thing about any other distribution is they are having dependency chains to the last, you remove something and it asks/forces you to remove to the last leaving you with nothing, Slackware I don't see that and respect it

      If I need all forced s/w (with forced dependent services) I happily use Windows rather than Linux, which in fact provides more control to user

      If Linux, the only thing we/I love is tweaking, so debian/gentoo/arch/Slackware are far superior in my opinion, every other distribution comes second

      Delete
    2. Sorry that was my rant/opinion, discard it as it was bit harsh

      Delete
  4. No, no

    I do not think your answer was harsh

    I think you make a point

    In fact it is becoming incredibly difficult to tweak optimize an ubuntu system nowadays

    especially because the "chain" of dependencies which make sometimes even little changes and known-to-be armless impossible to apply

    In that respect debian based mint seems an interesting option...

    ReplyDelete
    Replies
    1. Oh, thank you, then I am not alone in getting a feeling of too much dependencies and not so easy to touch anything feeling.

      Yes, I remember, debian based mint I had tried earlier, it is incredibly fast.

      Delete
  5. Does sysv-rc-conf not give you enough control over services?

    ReplyDelete
    Replies
    1. Article was published long ago, not sure about sysv, now it maynot at all be relevant as distributions are using systemd

      Delete