app-emulation/kvm with USE=modules doesn't pass $KERNEL_DIR to the configure script. This means the configure script will use `uname -r` to try to find kernel source, rather than use the kernel source the linux-mod eclass finds. Adding the following to the ebuild's src_compile avoids the `uname -r` lookup and instead uses the $KERNEL_DIR from linux-mod.eclass. use modules && conf_opts="$conf_opts --kerneldir=$KERNEL_DIR" Reproducible: Always Steps to Reproduce: 1. Update kernel source to a newer version, build a new kernel, change /usr/src/linux symlink, but don't reboot yet. 2. emerge kvm Actual Results: make -C /lib/modules/2.6.27-rc7/build M=`pwd` \ LINUXINCLUDE="-I`pwd`/include -Iinclude -Iarch/x86/include -I`pwd`/include-compat \ -include include/linux/autoconf.h \ -include `pwd`/x86/external-module-compat.h" make: *** /lib/modules/2.6.27-rc7/build: No such file or directory. Stop. make: *** [all] Error 2 Expected Results: make -C /usr/src/linux M=`pwd` \ LINUXINCLUDE="-I`pwd`/include -Iinclude -Iarch/x86/include -I`pwd`/include-compat \ -include include/linux/autoconf.h \ -include `pwd`/x86/external-module-compat.h" make[1]: Entering directory `/usr/src/linux-2.6.27-rc8'
Created attachment 166863 [details, diff] kerneldir patch for app-emulation/kvm-75
Created attachment 166864 [details, diff] patch to use --kerneldir=$KV_DIR Actually, it looks like the correct variable is $KV_DIR from linux-info.eclass, not $KERNEL_DIR. Revised patch attached.
Hrm... As far as I can tell, the kvm build system shouldn't be attempting to build any kernel modules, so it doesn't need that option. Could you attach a full build log?
Created attachment 166913 [details] full build.log for the failing case The USE=modules flag tells the ebuild to build from the module source in the package. pkg_setup does: elif use modules ; then BUILD_TARGETS="all" MODULE_NAMES="kvm(kvm:${S}/kernel:${S}/kernel/x86)" MODULE_NAMES="${MODULE_NAMES} kvm-intel(kvm:${S}/kernel:${S}/kernel/x86)" MODULE_NAMES="${MODULE_NAMES} kvm-amd(kvm:${S}/kernel:${S}/kernel/x86)" linux-mod_pkg_setup When src_compile does: if use modules && ! use havekernel ; then linux-mod_src_compile fi then linux-mod_src_compile will run `emake all` in the kernel directory of the kvm package (because of the MODULE_NAMES), and kernel/Makefile pulls in the KERNELDIR setting from ../config.mk, which is the --kerneldir passed to the configure step.
*** Bug 245953 has been marked as a duplicate of this bug. ***
Sorry, I lost track of this. Fixed in 78 without a bump.