fixdep, etc. gets built for wrong arch when cross-compiling Ubuntu kernel

Bug #1916782 reported by Kamal Mostafa
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

Cross-compiling the Ubuntu kernel using the standard debian/rules methods produces a linux-headers-{version}-{flavour} package which contains executables (e.g. fixdep, several others) built for the build host architecture, not the target host architecture. Those executables are unusable when that linux-headers package gets installed on the target.

Example from an ARM64 cross-compiled linux-headers package (note the x86-64 executable):
usr/src/linux-headers-5.10.0-14-generic/scripts/basic/fixdep: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=77b1c89ff5560389ea272ec0e81a4770246481a1, for GNU/Linux 3.2.0, not stripped

The kernel itself, of course, gets properly cross-compiled and the generated packages (including linux-headers) will install fine on the target. But the bogus executables prevent full functionality on that installation, i.e. it cannot be used for kernel driver development.

The fundamental reason why this occurs is that the build host needs to run some of those compiled executables itself during the build, but those executables should NOT get packaged. Instead, the build should be reorganized so that it compiles a set of temporary host-arch-execs for use during the build, but then separately (cross)-compiles them as target-arch-execs for inclusion in the linux-headers package.

This bug is Importance:Wishlist because:
 - cross-compiled Ubuntu kernel package builds aren't technically "supported".
 - this glitch only happens with engineer-built cross-compiled test kernels.
 - building natively instead (i.e. in a Launchpad PPA) avoids the problem.
 - this is not a new misbehavior; our cross-compile build rules have always been this way.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.