jsatubnutufroums
April 23rd, 2008, 07:19 AM
Hi,
I write a simple program:
#include <stdio.h>
#include <linux/init.h>
#include <linux/timer.h>
int main()
{
return 0;
}
And I compile it by 'gcc -o test test.c' and get the error message:
test.c:2:24: error: linux/init.h: No such file or directory
test.c:3:25: error: linux/timer.h: No such file or directory
I already install linux-kernel-devel and linux-headers by the following instructions:
apt-get install linux-kernel-devel
apt-get install linux-headers-`uname-r'
Someone tells me to try to re-build a kernel module. I follow this article 'Kernel/Compile (https://help.ubuntu.com/community/Kernel/Compile)'.
sudo apt-get install linux-kernel-devel fakeroot build-essential
sudo apt-get build-dep linux-source
apt-get source linux-source
sudo apt-get install linux-source
mkdir ~/src
cd ~/src
tar xjvf /usr/src/linux-source-<version-number-here>.tar.bz2
cd linux-source-<version-number-here>
cp -vi /boot/config-`uname -r` .config
sudo apt-get install qt3-dev-tools libqt3-mt-dev # if you plan to use 'make xconfig'
sudo apt-get install libncurses5 # if you plan to use 'make menuconfig'
make menuconfig # or "make xconfig" if you prefer
make-kpkg clean # only needed if you want to do a "clean" build
fakeroot make-kpkg --initrd --append-to-version=-some-string-here kernel-image kernel-headers
sudo dpkg -i linux-image-2.6.20-16-2be-k7_2.6.20-16_i386.deb
sudo dpkg -i linux-headers-2.6.20-16-2be-k7_2.6.20-16_i386.deb
After I reboot the OS, I compile the test.c program and stiil get the same error message. What should I do? :confused:
Thank you.
I write a simple program:
#include <stdio.h>
#include <linux/init.h>
#include <linux/timer.h>
int main()
{
return 0;
}
And I compile it by 'gcc -o test test.c' and get the error message:
test.c:2:24: error: linux/init.h: No such file or directory
test.c:3:25: error: linux/timer.h: No such file or directory
I already install linux-kernel-devel and linux-headers by the following instructions:
apt-get install linux-kernel-devel
apt-get install linux-headers-`uname-r'
Someone tells me to try to re-build a kernel module. I follow this article 'Kernel/Compile (https://help.ubuntu.com/community/Kernel/Compile)'.
sudo apt-get install linux-kernel-devel fakeroot build-essential
sudo apt-get build-dep linux-source
apt-get source linux-source
sudo apt-get install linux-source
mkdir ~/src
cd ~/src
tar xjvf /usr/src/linux-source-<version-number-here>.tar.bz2
cd linux-source-<version-number-here>
cp -vi /boot/config-`uname -r` .config
sudo apt-get install qt3-dev-tools libqt3-mt-dev # if you plan to use 'make xconfig'
sudo apt-get install libncurses5 # if you plan to use 'make menuconfig'
make menuconfig # or "make xconfig" if you prefer
make-kpkg clean # only needed if you want to do a "clean" build
fakeroot make-kpkg --initrd --append-to-version=-some-string-here kernel-image kernel-headers
sudo dpkg -i linux-image-2.6.20-16-2be-k7_2.6.20-16_i386.deb
sudo dpkg -i linux-headers-2.6.20-16-2be-k7_2.6.20-16_i386.deb
After I reboot the OS, I compile the test.c program and stiil get the same error message. What should I do? :confused:
Thank you.