Message ID | 20220720152440.1568667-1-sigmaepsilon92@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/1] package/zfs: fix cross-compilation | expand |
On 20/07/2022 17:24, Michael Zimmermann wrote: > Currently, the kernel module gets built using the host-compiler(from the > user distro, not from buildroot). That shouldn't happen. The kernel-module infrastructure passes LINUX_MAKE_FLAGS in the environment already. And if the module were built during the userspace build stage, that one already has the cross-compiler as well through the autotools infrastructure. Can you give a bit more detail about the config where you get the issue, and how exactly it fails? Regards, Arnout > That might work when target and host > arch are the same but during cross compilation that results in the > message `Unable to build an empty module.` because tests for compiling > modules fail due to missing headers. > > Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com> > --- > package/zfs/zfs.mk | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk > index 07ce3295ec..30f966bdeb 100644 > --- a/package/zfs/zfs.mk > +++ b/package/zfs/zfs.mk > @@ -57,6 +57,9 @@ else > ZFS_CONF_OPTS += --disable-pam > endif > > +ZFS_CONF_ENV += $(LINUX_MAKE_FLAGS) > +ZFS_MAKE_ENV += $(LINUX_MAKE_FLAGS) > + > # ZFS userland tools are unfunctional without the Linux kernel modules. > ZFS_MODULE_SUBDIRS = \ > module/avl \
On 23/07/2022 14:42, Arnout Vandecappelle wrote: > > > On 20/07/2022 17:24, Michael Zimmermann wrote: >> Currently, the kernel module gets built using the host-compiler(from the >> user distro, not from buildroot). > > That shouldn't happen. The kernel-module infrastructure passes > LINUX_MAKE_FLAGS in the environment already. And if the module were built > during the userspace build stage, that one already has the cross-compiler as > well through the autotools infrastructure. > > Can you give a bit more detail about the config where you get the issue, and > how exactly it fails? It's actually easy to reproduce, just change the architecture to anything other than x86. I've looked around a bit and it seems to me that zfs already builds the kernel module from the autotools infrastructure, so we're actually building it twice. I think we should therefore remove the kernel-module infra for this package, and instead add a dependency on linux and copy this part: # If the package is enabled, ensure the kernel will support modules ifeq ($$(BR2_PACKAGE_$(2)),y) LINUX_NEEDS_MODULES = y endif Regards, Arnout > > Regards, > Arnout > >> That might work when target and host >> arch are the same but during cross compilation that results in the >> message `Unable to build an empty module.` because tests for compiling >> modules fail due to missing headers. >> >> Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com> >> --- >> package/zfs/zfs.mk | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk >> index 07ce3295ec..30f966bdeb 100644 >> --- a/package/zfs/zfs.mk >> +++ b/package/zfs/zfs.mk >> @@ -57,6 +57,9 @@ else >> ZFS_CONF_OPTS += --disable-pam >> endif >> +ZFS_CONF_ENV += $(LINUX_MAKE_FLAGS) >> +ZFS_MAKE_ENV += $(LINUX_MAKE_FLAGS) >> + >> # ZFS userland tools are unfunctional without the Linux kernel modules. >> ZFS_MODULE_SUBDIRS = \ >> module/avl \
Michael, All, On 2022-07-23 15:41 +0200, Arnout Vandecappelle spake thusly: > On 23/07/2022 14:42, Arnout Vandecappelle wrote: > >On 20/07/2022 17:24, Michael Zimmermann wrote: > >>Currently, the kernel module gets built using the host-compiler(from the > >>user distro, not from buildroot). > It's actually easy to reproduce, just change the architecture to anything > other than x86. > > I've looked around a bit and it seems to me that zfs already builds the > kernel module from the autotools infrastructure, so we're actually building > it twice. I checked, and it is not possible to tell the zfs buildsystem to not build it. > I think we should therefore remove the kernel-module infra for > this package, and instead add a dependency on linux and copy this part: > > # If the package is enabled, ensure the kernel will support modules > ifeq ($$(BR2_PACKAGE_$(2)),y) > LINUX_NEEDS_MODULES = y > endif ... and add linux to ZFS_DEPDENDENCIES So, I've marked the patch as changes requested in patchwork. Regards, Yann E. MORIN.
Yann, All, Noticed the same issue on x86-64 without cross-compiling. Here again the host compiler was used instead of toolchain. The build failed because the host compiler was older and did not support some fancy flags. Host: Debian 11.7 x86_64 Host gcc: 10.2.1 Toolchain: x86-64--glibc--bleeding-edge-2022.08-1 Toolchain gcc: 12.2.0 The patch proposed by Michael Zimmermann fixed the issue.
diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk index 07ce3295ec..30f966bdeb 100644 --- a/package/zfs/zfs.mk +++ b/package/zfs/zfs.mk @@ -57,6 +57,9 @@ else ZFS_CONF_OPTS += --disable-pam endif +ZFS_CONF_ENV += $(LINUX_MAKE_FLAGS) +ZFS_MAKE_ENV += $(LINUX_MAKE_FLAGS) + # ZFS userland tools are unfunctional without the Linux kernel modules. ZFS_MODULE_SUBDIRS = \ module/avl \
Currently, the kernel module gets built using the host-compiler(from the user distro, not from buildroot). That might work when target and host arch are the same but during cross compilation that results in the message `Unable to build an empty module.` because tests for compiling modules fail due to missing headers. Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com> --- package/zfs/zfs.mk | 3 +++ 1 file changed, 3 insertions(+)