编译LineageOS15.1时提示INSTALLED_KERNEL_HEADERS缺失求助
Hey there, I’ve seen this exact issue pop up when working on older LineageOS builds, and since reinstalling your host Ubuntu kernel headers didn’t help, the problem is almost certainly tied to your device’s kernel setup rather than your system’s headers. Let’s walk through the fixes that usually resolve this:
First, manually install device-specific kernel headers
The build system might not be correctly pulling headers from your device’s kernel tree. Navigate to your kernel source directory and run this command, replacing<your-rom-out-path>with the actual path to your LineageOS output directory (looks likeout/target/product/<your-device>):make headers_install INSTALL_HDR_PATH=<your-rom-out-path>/usrThis forces the kernel headers to be placed exactly where the ROM build expects them.
Verify your BoardConfig.mk settings
Head to your device’s tree directory (usuallydevice/<vendor>/<device>) and openBoardConfig.mk:- Check if there’s a line defining
TARGET_KERNEL_HEADERS. It should point to the include directory in your kernel source, like:
If this line is missing or incorrect, add or fix it.TARGET_KERNEL_HEADERS := kernel/<vendor>/<device>/include - Also confirm
TARGET_KERNEL_SOURCEis correctly set to your kernel’s directory path—this ensures the build system knows where to find the kernel source in the first place.
- Check if there’s a line defining
Clean stale build artifacts and restart
Old cached files can cause weird header detection issues. Run these commands to wipe the build cache and reinitialize the environment:make clean source build/envsetup.sh breakfast <your-device-codename>Then try compiling again with
brunch <your-device-codename>.Compile the kernel first
Sometimes the error happens because the kernel hasn’t finished compiling (so headers aren’t generated yet). Try building the kernel alone first:make bootimageOnce that completes successfully, proceed with the full ROM build.
These steps should get past the INSTALLED_KERNEL_HEADERS missing error. Let me know if you hit any snags along the way!
内容的提问来源于stack exchange,提问作者Oveno

