welcome to the world of…

Looks like a small bulb used to indicate something unusual, like a malfunction.

Compile optimized Debian packages

Filed under: Uncategorized — Tags: , , , , , , — admin @ 2013-04-09 10:51

Do you envy Gentoo users their tuning? Debian packages are mostly shipped only with a basic optimization (-O2) and for more generic CPUs. How about fine tuning for your CPU?

I tried apt-build which is targeted for the optimized recompilation but it is supported by a very few packages. Following steps did the job e.g. for clang/llvm. First install required stuff:

  • Basic packages:
    sudo apt-get install fakeroot dpkg-dev build-essential
  • Dependencies and sources:
    apt-get build-dep clang llvm-3.1
    apt-get source clang llvm-3.1

Now you have to modify compilation flags. They are often stored in debian/rules or debian/rules.d/vars.mk. Find these files in the unpacked sources and locate line with “opt_flags = -g -O2“. This holds options for the configure script. Different packages might have different entry, look for CFLAGS, CXXFLAGS, … Replace the options e.g. with “-O3 -march=native” and carry on with the compilation:

  • Go to the source directory:
    cd llvm-3.1-3.1
  • Build:
    dpkg-buildpackage -rfakeroot -us -uc
  • Install the packages:
    cd ..
    sudo dpkg -i llvm*.deb clang*.deb

Speedup is not very interesting (approximately 5 % in the case of clang/llvm) but why not try.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.