"64-bit mode not compiled in" error while compiling Linux kernel

1

I am building 2.6.18 from CentOS source code.

I'm at the last step to the build process in their instructions but seem to be getting an error that I can't understand.

Instructions I'm following: http://wiki.centos.org/HowTos/Custom_Kernel

I ran... [user@host SPECS]$ rpmbuild -bb --target=uname -m kernel.spec 2> build-err.log | tee build-out.log

and got...

[...]

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:

I'm not sure why there's no useful messages after "RPM build errors". After I run the above rpmbuild command, I'm supposed to see "custom kernel rpm files" generated in the ~/rpmbuild/RPMS/uname -m/ directory. I do not see anything in that folder.

Here's what I see in the 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)

barrrista

Posted 2012-01-31T00:19:37.710

Reputation: 1 519

Answers

1

It looks like you're trying to cross-compile a 64-bit kernel on a 32-bit platform (or platform with only a 32-bit development toolchain). 64-bit targets aren't supported by the toolchain you have installed (or the one you have selected if you have more than one).

David Schwartz

Posted 2012-01-31T00:19:37.710

Reputation: 58 310

Okay, so I checked in the makefile and the compiler is GCC. I checked my GCC version and it says it's compiling to a target i386. Is it possible for me to simply change this configuration? Or do I need to reinstall GCC to be x86_64 compatible. I have GCC 4.1.2. – barrrista – 2012-01-31T22:47:22.223

If you pass GCC the -m64 flag, what happens? What is the output of gcc -m64 -v? – David Schwartz – 2012-01-31T23:25:56.560

didn't know you could do that. gcc -m64 -v
Using built-in specs. Target: i386-redhat-linux [...] --host=i386-redhat-linux gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)
– barrrista – 2012-01-31T23:37:13.520

Sounds like you don't have the 64-bit compiler installed on your platform. Are you on a 64-bit platform? – David Schwartz – 2012-02-01T00:04:07.650

Yes, I believe so. I get uname -a x86_64. I'm trying to update my gcc now via yum. Is this the right way to go? I seem to be having problems with this and created a separate question here: http://superuser.com/questions/384566/cant-seem-to-install-64bit-gcc-with-yum

– barrrista – 2012-02-01T00:07:56.413

Thank you. This was the right answer and I was able to eliminate these errors after updating gcc, cpp, and their dependencies to 64bit. I am still trying to build the kernel and now see other errors in my build log. I've created a new question here: http://superuser.com/questions/384867/errors-in-building-linux-kernel

– barrrista – 2012-02-01T18:57:27.510