More dkms fixes for exact cc compiler

Bug #1997841 reported by Dimitri John Ledkov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dkms (Ubuntu)
New
Undecided
Unassigned
Jammy
New
Undecided
Unassigned
Kinetic
Won't Fix
Undecided
Unassigned
Lunar
New
Undecided
Unassigned

Bug Description

[ Impact ]

 * Previously https://bugs.launchpad.net/ubuntu/+source/dkms/+bug/1991664 has fixed up some dkms modules that use makefiles without setting a CC= variable inside them. However, there is a class of dkms modules that set a CC= variable inside the makefile, and then the environment variable is ignored, thus resulting in hwe-5.19 dkms modules to FTBFS.

 * Fix those by setting MAKEFLAGS="--environment-overrides" to really ensure that environmental variable compiler is really being used.

Observe the following:

$ cat Makefile.just-cc
all:
 echo $(CC)

$ cat Makefile.cc-set
CC=cc-set-in-makefile
all:
 echo $(CC)

# cmdline override works in both cases

$ make -f Makefile.just-cc CC=make-var-cmdline
echo make-var-cmdline
make-var-cmdline

$ make -f Makefile.cc-set CC=make-var-cmdline
echo make-var-cmdline
make-var-cmdline

# environment/shell variable override only works in one of them

$ CC=env-cc make -f Makefile.just-cc
echo env-cc
env-cc

$ CC=env-cc make -f Makefile.cc-set
echo cc-set-in-makefile
cc-set-in-makefile

# unless environment-overrides is set

$ MAKEFLAGS=--environment-overrides CC=env-cc make -f Makefile.cc-set
echo env-cc
env-cc

[ Test Plan ]

 * Divert /usr/bin/gcc to /bin/false

   $ sudo ln -sf /bin/false /usr/bin/gcc

 * Install a v5.19 kernel that must be built with gcc-12 and a dkms module that uses a CC variable set inside its makefile

   $ sudo apt install linux-virtual-hwe-22.04-edge gost-crypto-dkms

 * Check that dkms status has the module successfully installed for v5.19 kernel

   $ dkms status

[ Where problems could occur ]

 * dkms cleans environment of all tool-chain related variables already, but MAKEFLAGS=--environment-overrides may result in additional/new/unexpected variables leaking into the dkms module build, which were previously ignored.

 * A better solution might be for our kernel builds to emit a makefile snippet that is included by the Kbuild makefiles, but that too will only cover a subset of dkms modules, not all of them.

 * It might be nice if environment-overrides command line option of make accepted a list of allowed variables that are desired to be honored from the environment.

[ Other Info ]

 * Any better suggestions of how to handle toolchain export would be welcome here, as this is starting to be silly.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dkms - 3.0.8-3

---------------
dkms (3.0.8-3) unstable; urgency=high

  * Revert back to 3.0.8-1 behavior to prevent breakages for sid users
    (Closes: #1025214, #1025171)

 -- Aron Xu <email address hidden> Fri, 02 Dec 2022 19:49:16 +0800

Changed in dkms (Ubuntu Lunar):
status: New → Fix Released
Revision history for this message
Aron Xu (happyaron) wrote :

Re-open because 3.0.8-3 has restored to old behavior.

Changed in dkms (Ubuntu Lunar):
status: Fix Released → New
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Ubuntu 22.10 (Kinetic Kudu) has reached end of life, so this bug will not be fixed for that specific release.

Changed in dkms (Ubuntu Kinetic):
status: New → Won't Fix
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.