Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 434710 - linux-mod.eclass should set KERNEL_DIR and KBUILD_OUTPUT if not present
Summary: linux-mod.eclass should set KERNEL_DIR and KBUILD_OUTPUT if not present
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
Depends on:
Reported: 2012-09-11 09:36 UTC by Dennis Schridde
Modified: 2021-01-04 03:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Schridde 2012-09-11 09:36:51 UTC
For example, app-emulation/virtualbox-modules does not compile when KERNEL_DIR and KBUILD_OUTPUT are not set and the sources and binaries are not both in /usr/src/linux.

Hence it would be nice if linux-info.eclass (or linux-mod - might be more appropriate) would set these variables depending on the detected running kernel version. It is difficult to automatically set these variables as make.conf, for example does not support $() substitutions (e.g. $(uname -r)).

Reproducible: Always
Comment 1 David Zaslavsky 2021-01-04 03:30:03 UTC
I'm not sure if there's any interest in dealing with this, but I am having the same problem: emerging virtualbox fails because the build products of the kernel are not placed in /usr/src/linux.

>>> Emerging (1 of 1) app-emulation/virtualbox-modules-6.1.16-r1::gentoo
>>> Failed to emerge app-emulation/virtualbox-modules-6.1.16-r1, Log file:
>>>  '/var/tmp/portage/portage/app-emulation/virtualbox-modules-6.1.16-r1/temp/build.log'
 * Package:    app-emulation/virtualbox-modules-6.1.16-r1
 * Repository: gentoo
 * Maintainer:
 * USE:        abi_x86_64 amd64 elibc_glibc kernel_linux userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     5.10.4-gentoo
 * Could not find a usable .config in the kernel source directory.
 * Please ensure that /usr/src/linux points to a configured set of Linux sources.
 * If you are using KBUILD_OUTPUT, please set the environment var so that
 * it points to the necessary object directory so that it might find .config.
 * ERROR: app-emulation/virtualbox-modules-6.1.16-r1::gentoo failed (setup phase):
 *   Kernel not configured; no .config found in /usr/src/linux
 * Call stack:
 *                   , line 125:  Called pkg_setup
 *   virtualbox-modules-6.1.16-r1.ebuild, line  37:  Called linux-mod_pkg_setup
 *                      linux-mod.eclass, line 586:  Called linux-info_pkg_setup
 *                     linux-info.eclass, line 962:  Called check_extra_config
 *                     linux-info.eclass, line 770:  Called require_configured_kernel
 *                     linux-info.eclass, line 304:  Called die
 * The specific snippet of code:
 *              die "Kernel not configured; no .config found in ${KV_OUT_DIR}"
 * If you need support, post the output of `emerge --info '=app-emulation/virtualbox-modules-6.1.16-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-emulation/virtualbox-modules-6.1.16-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/portage/app-emulation/virtualbox-modules-6.1.16-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/portage/app-emulation/virtualbox-modules-6.1.16-r1/temp/die.env'.
 * Working directory: '/var/tmp/portage/portage/app-emulation/virtualbox-modules-6.1.16-r1/homedir'
 * S: '/var/tmp/portage/portage/app-emulation/virtualbox-modules-6.1.16-r1/work'
 * The following package has failed to build, install, or execute postinst:
 *  (app-emulation/virtualbox-modules-6.1.16-r1:0/6.1::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/tmp/portage/portage/app-emulation/virtualbox-modules-6.1.16-r1/temp/build.log'

Bug #87242 seems to be related.