kvm userland: Build misses -I <kernel include dir>
configure accepts the kernel source dir as input param, or automatically finds /lib/modules/2.6.27-rc5/build/ or similar. But the build only uses the dir to copy the latest kvm*.h into the local dir. The directory is not passed to gcc via -I . This results in a "linux/ioctl.h not found" and resulting errors, if /usr/include/linux/ does not exist. If I pass the kernel source explicitly, then please use it.
1. Please pass gcc -I <kernel source dir in configure>/include/
Quoted 10 lines · Ben Bucksch
configure accepts the kernel source dir as input param, or automatically finds
/lib/modules/2.6.27-rc5/build/or similar. But the build only uses the dir to copy the latest kvm*.h into the local dir. The directory is not passed to gcc via -I . This results in a "linux/ioctl.hnot found" and resulting errors, if/usr/include/linux/does not exist. If I pass the kernel source explicitly, then please use it.1. Please pass gcc -I <kernel source dir in configure>/include/
What are you doing exactly? I've never had such issues.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 10 lines · Avi Kivity
Quoted 8 lines · Ben Bucksch
configure accepts the kernel source dir as input param, or automatically finds
/lib/modules/2.6.27-rc5/build/or similar. But the build only uses the dir to copy the latest kvm*.h into the local dir. The directory is not passed to gcc via -I . This results in a "linux/ioctl.hnot found" and resulting errors, if/usr/include/linux/does not exist. If I pass the kernel source explicitly, then please use it.
Quoted 3 lines
Quoted 1 line
1. Please pass gcc -I<kernel source dir in configure>/include/
What are you doing exactly? I've never had such issues.
Well, I'd assume so, otherwise they'd be fixed I hope :).
What I did:
1. Extract Linus kernel source in /usr/src/, resulting in
/usr/src/linux-2.6.26/
2. Build kernel (in source dir)
3. Install kernel to /boot/ and /lib/modules/ via make install; make
modules_install etc.
4. Extract kvm git
5. KVM source dir: ./configure --with-patched-kernel --disable-sdl
--disable-gfx-check ; make
6. Get lots of errors due to Version mismatch of kvm.h in kernel and
libkvm.c in KVM, which actually turned out to be bogus (other bug,
see other mail)
7. rm -rf /usr/include/linux/
8. KVM source dir: ./configure --with-patched-kernel --disable-sdl
--disable-gfx-check --kerneldir=/usr/src/linux-2.6.26/ ; make9. Above error
Reason is, as said, that the build assumes that /usr/include/linux/ioctl.h exists, i.e. it just #include <linux/ioctl.h> , but does not pass the kernel dir *that I explicitly passed to configure* to gcc. If I explicitly pass the kernel dir to configure, I expect that to be used, and only that.
So, just pass gcc -I<kernel source dir passed to configure>/include/
iggy on IRC noted that kernel source and build dir may be separate. That's true - you probably need two configure flags --kernel-source-dir and --kernel-build-dir. The existing --kerneldir could stay and set both to the same value.
Quoted 1 line · Ben Bucksch
Reason is, as said, that the build assumes that
/usr/include/linux/ioctl.hexists, i.e. it just #include <linux/ioctl.h>
Oh, that's not nice. Certainly for me /usr/include/linux will never point to the kernel I'm building against so that's just a problem waiting to happen.
Quoted 1 line
, but does not pass the kernel dir *that I explicitly passed to configure* to gcc. If I explicitly pass the kernel dir to configure, I expect that to be used, and only that.
Seconded.
Especially when building external modules the only path being used should be the one passed in as the KERNELDIR I want to build against. Using /usr/include/linux or something under /lib/modules/$(uname -r)/build is fraught with problems.
Quoted 1 line
iggy on IRC noted that kernel source and build dir may be separate. That's true - you probably need two configure flags --kernel-source-dir and --kernel-build-dir. The existing --kerneldir could stay and set both to the same value.
That's the issue I found with kvm-74, building the kernel with O= to have seperate source and build dirs fails as the makefile for the external kvm modules assumes that isn't an option.
There's a very minimal patch to get that working in this post:
<http://article.gmane.org/gmane.comp.emulators.kvm.devel/21172>
Iain