编译Linux内核时出现“未编译为64位模式”错误


1

我正在从CentOS源代码构建2.6.18。

在他们的说明中,我处于构建过程的最后一步,但似乎遇到了我无法理解的错误。

我遵循的说明:http : //wiki.centos.org/HowTos/Custom_Kernel

我跑了... [user @ host SPECS] $ rpmbuild -bb --target = uname -mkernel.spec 2> build-err.log | 发球楼out-log

并得到...

[...]

Patch #20239 (xen-vtd-let-iommu-use-another-irq-without-conflict.patch):
Patch #20240 (xen-hvm-add-hvmop_get_time-hypercall.patch):
Patch #20241 (xen-fix-64-bit-pv-guest-user-mode-segv-crashing-host.patch):
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.57640
cc     linux-2.6.18.x86_64/scripts/bin2c.c   -o linux-2.6.18.x86_64/scripts/bin2c
make -f Rules.mk _build
make[1]: Entering directory `/home/~~~~/rpmbuild/BUILD/kernel-2.6.18/xen'
make -C include/public/foreign
make[2]: Entering directory `/home/~~~~/rpmbuild/BUILD/kernel-2.6.18/xen/include/public/foreign'
python mkheader.py x86_32 x86_32.h ../arch-x86/xen-x86_32.h ../arch-x86/xen.h ../xen.h
python mkheader.py x86_64 x86_64.h ../arch-x86/xen-x86_64.h ../arch-x86/xen.h ../xen.h
python mkheader.py ia64 ia64.h ../arch-ia64.h ../xen.h
python mkchecker.py x86_64 checker.c x86_32 x86_64 ia64
gcc -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -m64        
-Wdeclaration-after-statement -o checker checker.c
make[2]: Leaving directory `/home/~~~~/rpmbuild/BUILD/kernel-2.6.18/xen/include/public/foreign'
make[1]: Leaving directory `/home/~~~~/rpmbuild/BUILD/kernel-2.6.18/xen'

RPM build errors:

我不确定为什么“ RPM构建错误”之后没有有用的消息。运行上面的rpmbuild命令后,应该在〜/ rpmbuild / RPMS / uname -m/目录中看到“自定义内核rpm文件” 。我在该文件夹中看不到任何东西。

这是我在build-err.log中看到的内容:

gpg: WARNING: unsafe permissions on homedir `.'
gpg: keyring `./secring.gpg' created
gpg: keyring `./pubring.gpg' created
  ++++++++++.++++++++++++++++++++.+++++.+++++.++++++++++++++++++++.++++++++++++++++++++.+++++++++++++++++++++++++++++++++++..+++++++++++++++>++++++++++....................................................................................................................+++++

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 275 more bytes)
+ gpg --homedir . --export --keyring ./kernel.pub CentOS
gpg: WARNING: unsafe permissions on homedir `.'
+ make linux-2.6.18.x86_64/scripts/bin2c
+ linux-2.6.18.x86_64/scripts/bin2c ksign_def_public_key __initdata
+ rm -rf /var/tmp/kernel-2.6.18-238.9.1.el5.local-root
+ mkdir -p /var/tmp/kernel-2.6.18-238.9.1.el5.local-root/boot
+ cd xen
+ mkdir -p /var/tmp/kernel-2.6.18-238.9.1.el5.local-root/boot /var/tmp/kernel-    
2.6.18-238.9.1.el5.local-root/boot
+ make -j2 verbose=y crash_debug=y max_phys_cpus=256 XEN_VENDORVERSION=-238.9.1.el5.local
checker.c:1: sorry, unimplemented: 64-bit mode not compiled in
make[2]: *** [checker] Error 1
make[1]: *** [build-headers] Error 2
make: *** [build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.57640 (%build)
Bad exit status from /var/tmp/rpm-tmp.57640 (%build)

Answers:


1

看来您正在尝试在32位平台(或仅具有32位开发工具链的平台)上交叉编译64位内核。您安装的工具链不支持64位目标(如果有多个,则不选择64位目标)。


好的,所以我签入了makefile,编译器为GCC。我检查了我的GCC版本,并说它正在编译为目标i386。我可以简单地更改此配置吗?还是我需要重新安装GCC才能兼容x86_64。我有GCC 4.1.2。
barrrista 2012年

如果您通过GCC -m64标志,会发生什么?输出是gcc -m64 -v什么?
大卫·史瓦兹

不知道你能做到这一点。gcc -m64 -v使用内置规格。目标:i386-redhat-linux [...] --host = i386-redhat-linux gcc版本4.1.2 20080704(Red Hat 4.1.2-48)
barrrista 2012年

听起来您的平台上没有安装64位编译器。您是否在64位平台上?
David Schwartz

是的,我相信。我得到uname -a x86_64。我正在尝试通过yum更新我的gcc。这是正确的方法吗?我似乎有这个问题,并创建了一个单独的问题在这里:superuser.com/questions/384566/...
barrrista
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.