Common Fedora Compiling Problems

On Fedora forums, newcomers often post with the issue that they tried to compile something, and get a message that the kernel sources aren't found. Some of them realize that they need kernel-devel, but miss a few points.

My own procedure is do a minimal installation, then add things afterwards. While there are groups for development tools, they give me too much that I don't need, so generally, I find that running
yum install tar bzip2 make automake gcc gcc-c++ kernel-devel 

will pull in most of the basics. (I've never checked, but I'm pretty sure that some of those pull in some of the others so I'm probably typing a few more keystrokes than necessary.)

The two common mistakes that I note on the forums are with the PAE kernel and not rebooting after a later kernel has been installed.

When installing Fedora on a 32 bit machine, it tends to install a PAE kernel. (Not sure if this still holds, I haven't installed on a 32 bit machine in awhile.) The PAE (Physical Address Extension) kernel can use more than 4 GB of RAM, while a standard 32 bit kernel cannot.

However, if you then run yum install kernel-devel, it will install the latest kernel-devel package, as opposed to the kernel-PAE-devel package. The solution is first check your kernel.
uname -r

If the result has PAE in it, then when installing the kernel-devel package use
yum install kernel-PAE-devel

The second common problem has to do with kernel versions. I will shorten the version numbers for ease of typing. Suppose the user is running kernel 3-8.1. Now the user runs yum update, and kernel 3-8.2 is installed. However, until the user reboots, the machine will be using 3-8.1. Running the command uname -r (the r is for running) will tell you what kernel you are using.

If the user now installs kernel-devel with yum install kernel-devel, yum will pull in kernel-devel-3-8.2 and kernel-headers-3.8.2, NOT 3-8.1. So, if the user tries to compile anything, or even run, for example, the VirtualBox command, vboxdrv setup, they will receive a message that kernel sources can't be found. The reason is that they only have the sources for kernel 3-8.2, not the currently running kernel 3-8.1. Therefore, the options are to either find and download kernel-devel for the running package, or the usually more simple option of rebooting. Upon reboot, Fedora should use the later 3-8.2 kernel and this time, vboxdrv setup or whatever command you are using, should be able to find kernel sources.

To sum up, the kernel-devel and kernel-headers packages installed should match the result of running the command uname -r.