Public bug reported: [ 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. ** Affects: dkms (Ubuntu) Importance: Undecided Status: New ** Affects: dkms (Ubuntu Jammy) Importance: Undecided Status: New ** Affects: dkms (Ubuntu Kinetic) Importance: Undecided Status: New ** Affects: dkms (Ubuntu Lunar) Importance: Undecided Status: New ** Also affects: dkms (Ubuntu Lunar) Importance: Undecided Status: New ** Also affects: dkms (Ubuntu Kinetic) Importance: Undecided Status: New ** Also affects: dkms (Ubuntu Jammy) Importance: Undecided Status: New -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to dkms in Ubuntu. https://bugs.launchpad.net/bugs/1997841 Title: More dkms fixes for exact cc compiler Status in dkms package in Ubuntu: New Status in dkms source package in Jammy: New Status in dkms source package in Kinetic: New Status in dkms source package in Lunar: New 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. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/dkms/+bug/1997841/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp