编译 Linux 内核是否有推荐的 GCC 版本?
我在 Linux 内核的头文件 "compiler-GCC" 中找到了一些信息。它是否包含了内核推荐的 GCC 版本信息?也就是说,我是否可以在 Linux 内核源代码中找到编译相关的信息?
- Make sure you have at least gcc 3.2 available.
For more information, refer to Documentation/Changes.
====================== =============== ========================================
Program Minimal version Command to check the version
====================== =============== ========================================
GNU C 3.2 gcc --version
GNU make 3.80 make --version
binutils 2.12 ld -v
util-linux 2.10o fdformat --version
module-init-tools 0.9.10 depmod -V
e2fsprogs 1.41.4 e2fsck -V
jfsutils 1.1.3 fsck.jfs -V
reiserfsprogs 3.6.3 reiserfsck -V
xfsprogs 2.6.0 xfs_db -V
squashfs-tools 4.0 mksquashfs -version
btrfs-progs 0.18 btrfsck
pcmciautils 004 pccardctl -V
quota-tools 3.09 quota -V
PPP 2.4.0 pppd --version
isdn4k-utils 3.1pre1 isdnctrl 2>&1|grep version
nfs-utils 1.0.5 showmount --version
procps 3.2.0 ps --version
oprofile 0.9 oprofiled --version
udev 081 udevd --version
grub 0.93 grub --version || grub-install --version
mcelog 0.6 mcelog --version
iptables 1.4.2 iptables -V
openssl & libcrypto 1.0.0 openssl version
bc 1.06.95 bc --version
Sphinx\ [#f1]_ 1.2 sphinx-build --version
====================== =============== ========================================
.. [#f1] Sphinx is needed only to build the Kernel documentation
在计划编译的内核源代码中,检查Documentation/Changes
文件是个好主意。
话虽如此,使用相对较新的GCC版本可能是个不错的选择,因为新版本具有更好的优化器,因此通常可以生成更快的代码,并且新版本具有更易读的诊断信息,这样在构建失败时更容易找出问题所在。
总的来说,我建议使用官方打包的适用于您系统的GCC版本。在Ubuntu中,作为build-essential
元包的依赖项安装的GCC版本应该足够使用,至少对于构建与您系统官方打包的内核不是过于新的内核而言。
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/process/changes.rst?id=refs/tags/vX.X.X
。只需将 X.X.X
更改为所需的版本即可。 - undefined
include/linux/compiler-gcc.h
在内核头文件中的意义吗?这与构建当前运行的内核二进制文件所使用的GCC版本有关,如cat /proc/version
命令的输出所示吗?Linux内核和GCC是独立的项目,它们不会同时发布。你能解释一下你所说的“匹配内核和GCC版本”是什么意思吗? - Eliah Kagan