john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Make build compile from source uninstall

LINUX was orignally a programmer's OS

It has many distributions now and unfortunately some of them don't include the essential components to compile from the command line... which is odd because so much linux software still depends on compiling from the source code (see the kernel drivers below!)

apt-get install build-essential (designed for building debian packages)

apt-get instasll libstdc++6-dev

The "manual" method below doesn't get all of the items (at least not for ubuntu) apt-get install gcc-4.1

Debian packages: gcc, cpp, binutils, libc-dev. C++ programs also require: g++, and libstdc++

RedHat packages: egcs, cpp, binutils, glibc-devel. C++ programs also require: egcs-c++, libstdc++.


cd DIRECTORY-WITH-MAKE-FILE make uninstall

in order to avoid situations where the programmer may not have done an uninstall, use checkinstall auto .deb

sudo apt-get install checkinstall

sudo checkinstall # no arguments calls make install , or use sudo checkinstall make install_package

sudo dpkg -r PACKAGENAME


To use make to compile things for your kernel you'll need kernel headers installed.

Kernel header files (a.k.a. "kernel source" files) are a set of pre-compiled binary files reflecting your currently running kernel. Essentially the kernel headers are simply a "raw" mirror image of the kernel that's running your computer. You need kernel headers (or kernel source) files in order to make drivers, fix things etc..

uname -r shows me exactly what kernel I have... very important when compiling modules that will interact with the kernel (aka drivers)

I had to use google to find the exact debian page with 2.6.26-2-686 (lenny) kernel headers (.deb so at least that's easy)...

e.g.

make -C /lib/modules/2.6.26-2-686/build M=pwd clean

this doesn't actually help much... thanks for the crappy instructions broadcom...


The kernel headers package is specifically for precompiled kernels. thus you can download: linux-headers-2.6.26-2-686.deb

Of course, the kernel headers deb has some dependencies... (download them also!)

linux-headers-2.6.26-2-common (= 2.6.26-17) linux-kbuild-2.6.26 gcc-4.1

download the above .deb files and then use dpkg -i gcc-4.1.deb

of course you'll get errors because gcc-4.1 depends on:

gcc-4.1-base cpp-4.1 binutils

Normally all of this is done for you with apt-get or yum (and an internet connection...)


now /usr/src contains 3 directories: linux-headers linux-headers-common linux-kbuild


cd /linksys/hybrid_wl make -C /lib/modules/2.6.26-2-686/build M=pwd clean make -C /lib/modules/2.6.26-2-686/build M=pwd

now shows all sorts of good geeky messages

make --help | more //reveals much more!

make -C /linksys/hybrid_wl -f Makefile -C //change to directory -f //file to be used as makefile

unfortunately "no rule to make target" "no targets"

from someone with a similar problem

make -C /lib/modules/uname -r/build M=pwd

The kernel headers are stored in /usr/src and usually appear as a directory reflecting the version of the currently running kernel. You can check that (currently running kernel version) by typing uname -r.

-> Kernel source (i.e. kernel headers) is what I described above. Kernel source (header) files are pre-compiled set of binaries (inlcuding bug fixes and patches) that reflect the kernel that's running your system. These files are named in the following manner: "kernel-source-.rpm"

--> Source kernel files are simply the source file for making a kernel. If you plan to make (compile) your own kernel (the core of linux) then you must use the "source" files - as you would with some programs... obtain the source and then compile your own program based on the "source files". These are normally named: "kernel-.src.rpm"

In the Makefile you may find a line like:

KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build

When this is read the $(shell uname -r) part gets changed to whatever the output of the command 'uname -r' is.

Check that there really are kernel header files in that location. If not just edit the Makefile to set the correct location.

good advice for building from make...

/lib/modules/uname -r/build


To compile modules to get my graphics card working I needed the kernel header package that matched my precompiled kernel. If you have compiled your own kernel, you already have the headers on your computer, since these were needed to compile the kernel.

You should find them in the include foder where ever you unpacked the kernel source. They end in .h and there are lots of them in folders depending what their for: /net for network, /scsi for scsi etc.

Installing kernel modules, which are in fact part of the kernel (except loaded on demand rather than built in), so they have include the same bit of code as your kernel to work.


To get the Debian kernel source at the current maximum patchlevel, it is sufficient to install the latest linux-source-version package and unpack the source, for example: # apt-get install linux-source-2.6.18 $ tar jxf /usr/src/linux-source-2.6.18.tar.bz2


  • « ternary search trie INCOMPLETE
  • Arandr save config permanent customizations »

Published

Jul 22, 2013

Category

linux

~752 words

Tags

  • build 3
  • compile 2
  • from 24
  • linux 249
  • make 7
  • source 9
  • uninstall 3