Index:

Development questions

I'm trying to build something and it says "C compiler cannot create executables".

apt-get install build-essential

I'm trying to configure my kernel with make menuconfig, and it says "curses.h not found".

apt-get install build-essential libncurses5-dev

What do I need to build GTK+ programs?

apt-get install libgtk1.2-dev

for GTK+, or

apt-get install libgtk2.0-dev

for GTK+2. No, you cannot compile a GTK+ application against GTK+2. The APIs are not compatible.

What do I need to build programs that require glib, but not GTK+?

apt-get install libglib1.2-dev

but note that this should be relatively rare, since usually you will have acquired libglib1.2-dev by installing libgtk1.2-dev.

What do I need to build QT programs?

apt-get install libqt3-mt-dev

What do I need to build SDL programs?

apt-get install libsdl1.2-dev

What do I need to build programs that use libz?

apt-get install zlib1g-dev

What do I need to build programs that use X?

apt-get install xlibs-dev

How do I build a kernel the Debian way?

apt-get install build-essential kernel-package

Also install libncurses5-dev if you want to use menuconfig, or libgtk1.2-dev for gconfig in 2.6. Install bin86 for 2.2 or earlier kernels on the i386 architecture.

Extract your kernel source, cd into the resulting directory, apply any patches you wanted (optional), then run the command

make-kpkg --revision=custom.1 binary-arch

This should create two .deb files in the parent directory. You can change the revision string to include a hostname, etc.

If you have third party modules in /usr/src/modules/ then add modules_image to the end of the make-kpkg command to build a package for the modules. (This applies to PCMCIA, NVidia, ATI, etc. It doesn't apply to modules which are part of the Linux source tree, that you marked with M.)

If you're building older kernel sources on newer versions of Debian, you may have to use an older version of gcc than the default. For example, to build a 2.0.* kernel on woody, you should install the gcc272 package and edit the top-level kernel Makefile to replace gcc with gcc272. Likewise, to build older 2.4.* kernels on sid, you may have to replace gcc with gcc-2.95.

How do I recompile a Debian package from source?

First, add a deb-src line to your sources.list file. For example,

deb-src http://http.us.debian.org/debian/ stable main contrib non-free

(If you're trying to build a backport, you may want unstable instead of stable. It won't hurt you because this is only source code.) Then:

{{{apt-get update apt-get build-dep mypackage apt-get -b source mypackage}}}

The resulting .deb files will be in the current directory. If you want to make modifications to the source code before you build it, then omit the -b option, cd into the resulting directory, make your changes, and then run:

fakeroot debian/rules binary

(or dpkg-buildpackage -uc -us -rfakeroot if you prefer). For more details, see the next question.

Is there a good howto on building debian packages?

Try http://www.linuks.mine.nu/irc/debian-packaging/ which is a very short introduction with nice pointers.

How do I recompile packages with CPU-specific optimizations?

Install the pentium-builder package and read the instructions.