是否有推荐的 GCC 版本来编译 Linux 内核?
我找到了 Linux 内核的头文件“compiler-GCC”。它是否包含有关内核推荐的 GCC 版本的信息?也就是说,我能在Linux内核源代码中找到有关编译的信息吗?
您应该能够使用相当旧的 GCC 版本(可能早到 GCC 3.2)构建 Linux 内核。Linux 4.9.4 中的顶级 README 文件提到:
- Make sure you have at least gcc 3.2 available.
For more information, refer to Documentation/Changes.
Run Code Online (Sandbox Code Playgroud)
Documentation /Changes提供了所需的 GCC 版本(列为“GNU C”)和 Linux 的其他构建依赖项的列表,以及如何检查当前安装的每个版本:
====================== =============== ========================================
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
Run Code Online (Sandbox Code Playgroud)
最好检查Documentation/Changes
您实际计划编译的内核源代码中的文件。
话虽如此,使用相对较新版本的 GCC 可能是一个好主意,因为较新的版本具有更好的优化器,因此通常可以生成更快的代码,并且由于较新的版本具有更易读的诊断,因此可能更容易找出什么你的构建失败了。
一般来说,我建议使用官方为您的系统打包的 GCC 版本。在 Ubuntu 中,作为元包的依赖项安装的 GCC 版本build-essential
应该始终足够,至少对于构建比为系统正式打包的内核新不了多少的内核来说是这样。
归档时间: |
|
查看次数: |
12069 次 |
最近记录: |