#988509 building kernel modules on a multiarch host fails

#988509#5
Date:
2021-05-14 12:06:29 UTC
From:
To:
On a multiarch environment with a 32 bit version of dpkg,
when building for a 64 kernel (both running and installed but not
running at the moment of building)
the build fails beacause BUILD_TARGET_ARCH is set to i686 and this
triggers the use of "__cdecl" in various typedef.

I noticed that in the "Makefile-header.gmk" of the three actual kernel
modules,
the BUILD_TARGET_ARCH_DEF variable, that later reflects in
BUILD_TARGET_ARCH,
is set at line 48 by the shell command
$(shell dpkg-architecture -qDEB_HOST_GNU_CPU)

In the original package from virtualbox.org, the command is
$(shell uname -m)

I feel that the second method is a bit better, but the main problem is
that it seems that the variable ARCH is not set at all, causing
BUILD_TARGET_ARCH_DEF to be assigned to BUILD_TARGET_ARCH.

If I manually set ARCH := x86_64 or BUILD_TARGET_ARCH := amd64, inside
the Makefile-header.gmk, the build succeeds.

uname -a
Linux ics-18-31 5.10.0-4-amd64 #1 SMP Debian 5.10.19-1 (2021-03-02)
x86_64 GNU/Linux

dpkg 1.20.9
dkms 2.8.4-4

Regards
Claudio

#988509#10
Date:
2023-07-20 11:09:55 UTC
From:
To:
As a clue.. you may use the DEB_HOST_GNU_CPU
<https://www.google.com/search?q=DEB_HOST_GNU_CPU>*,* just try