Contents
-
Development questions
- I'm trying to build something and it says "C compiler cannot create executables".
- I'm trying to configure my kernel with make menuconfig, and it says "curses.h not found".
- What do I need to build GTK programs?
- What do I need to build programs that require glib, but not GTK?
- What do I need to build QT programs?
- What do I need to build SDL programs?
- What do I need to build programs that use libz?
- How do I build a Linux kernel the Debian way?
- How do I recompile a Debian package from source?
- How do I recompile packages with CPU-specific optimizations?
Development questions
I'm trying to build something and it says "C compiler cannot create executables".
apt install build-essential
I'm trying to configure my kernel with make menuconfig, and it says "curses.h not found".
apt install build-essential libncurses5-dev
What do I need to build GTK programs?
apt install libgtk-3-dev
What do I need to build programs that require glib, but not GTK?
apt install libglib2.0-dev
What do I need to build QT programs?
apt install qtbase5-dev
What do I need to build SDL programs?
apt install libsdl2-dev
What do I need to build programs that use libz?
apt install libz-dev
How do I build a Linux kernel the Debian way?
apt install build-essential kernel-package
Also install libncurses-dev if you want to use menuconfig, or libgtk2.0-dev for gconfig.
Extract your Linux kernel source, cd into the resulting directory, apply any patches you wanted (optional), then run the command
make bindeb-pkg EXTRAVERSION=custom.1
This should create several .deb files in the parent directory. You can change the revision string to include a hostname, etc.
If you're building older Linux kernel sources on newer versions of Debian, you may have to use an older version of gcc than the default.
The building process is quite slow so you can use ccache to speed it up (helps after the first build). In order to do so you'll need to set it up before building:
export PATH="/usr/lib/ccache:$PATH"
Speeding up the build even more is possible by using distcc. More information how to combine distcc and ccache is available here.
How do I recompile a Debian package from source?
First, add a deb-src entry to your apt sources.
If you're trying to build a backport, you may want testing instead of stable. It won't affect your system because this is only source code. Then:
apt update apt build-dep mypackage apt -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:
dpkg-buildpackage
How do I recompile packages with CPU-specific optimizations?
Install the pentium-builder package and read the instructions.