Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any link between gcc versions and the version of a kernel ? Specifically, would I be able to install a very old version of gcc onto the latest kernel. Alternatively would I be able to build the latest version of gcc on a very old kernel? Are there any compatibility problems between the two for any version ??

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

You might have trouble compiling new kernels with very old versions of GCC.

Besides that, no, GCC versions are not tied to the Linux kernel's version:

  • You can run an ancient GCC version on a system with a new kernel.
  • You can run a new GCC version on a system with a very old kernel. The only thing that would stop you from doing this would be if your new GCC version requires a version of libc that will not run on that kernel. But this is not a particularly likely scenario.

With that said, you should be careful about installing an older GCC over a newer GCC, since the newer GCC may be needed. If you're building GCC yourself from source, you can configure the build to install in its own prefix (rather than /usr). If this still breaks builds, make sure the newer GCC (which was there before) is in a directory earlier in the PATH environment variable than the older GCC (which you more recently installed).

share|improve this answer
add comment

Yes. Some new kernel features need the last version of gcc and glibc to work fine. But it's not a restricted constraint like kernel 3.0.2 work only with gcc 4.2.1. It's more like kernel 3.x work only with gcc 4.2.x

share|improve this answer
    
It seems like you might be confusing compiler versions required to build a kernel with what is required to run a kernel. Running a kernel never requires that a compiler be installed at all. You may want to expand this answer, though, because you are on to something that the other answers don't currently cover: With some compiler versions, you may not be able to build modules for the currently running kernel. –  Eliah Kagan Jul 11 '12 at 17:34
add comment

I would be wary of using older GCC versions on newer systems, especially if the older version's executables arent named gcc-1.3 (for example, if in this instance the version is 1.3), because otherwise it may conflict with the current version used for everything on your Ubuntu system, and break things.

To answer your question though, the kernel and GCC aren't directly related, but its likely the kernel was built with the GCC version you're using (or slightly older).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.