Skip to content

Conversation

maskimko
Copy link
Contributor

@maskimko maskimko commented Aug 28, 2025

Motivation and Context

I encountered an nasty issue when building zfs in the docker container, where environment variable ARCH was set to 'x86_64' value, and it was used for non zfs build related purpose.
Then I got the configure error message like this one:

checking for kernel config option compatibility... done
checking whether CONFIG_MODULES is defined... no
configure: error:
*** This kernel does not include the required loadable module
*** support!
***
*** To build OpenZFS as a loadable Linux kernel module
*** enable loadable module support by setting
*** CONFIG_MODULES=y in the kernel configuration and run
*** make modules_prepare in the Linux source tree.
***
*** If you don't intend to enable loadable kernel module
*** support, please compile OpenZFS as a Linux kernel built-in.
***
*** Prepare the Linux source tree by running make prepare,
*** use the OpenZFS --enable-linux-builtin configure option,
*** copy the OpenZFS sources into the Linux source tree using
*** ./copy-builtin <linux source directory>,
*** set CONFIG_ZFS=y in the kernel configuration and compile
*** kernel as usual.

It confused me, and I spent some time debugging the possible modules build issues.
The fact that on my VMs the same configuration of ZFS built well, initially led me to a wrong investigation path.
hence to save time of other users I'd like to introduce a warning message during the configure phase.

Description

This change adds autotools macros to the config/always-arch.m4 file, which produces the warning message if the ARCH variable is set in the building environment. This helps to avoid issues described above.

How Has This Been Tested?

When ARCH variable is set to some unsupported by kernel Makefile value, like ARCH="x86_64", I got this warning and failure:

checking for conflicting environment variables... warning
configure: WARNING: ARCH environment variable is set to "x86_64". This can cause build kernel modules support check failure. Please unset it.

checking for kernel config option compatibility... done
checking whether CONFIG_MODULES is defined... no
configure: error:
*** This kernel does not include the required loadable module
*** support!
***
*** To build OpenZFS as a loadable Linux kernel module
*** enable loadable module support by setting
*** CONFIG_MODULES=y in the kernel configuration and run
*** make modules_prepare in the Linux source tree.

If ARCH variable is unset I got:

checking for conflicting environment variables... done

checking for kernel config option compatibility... done
checking whether CONFIG_MODULES is defined... yes
checking whether CONFIG_BLOCK is defined... yes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

If ARCH environment variable is set, it can cause the failure of the
kernel modules check during the configure step. The resulting error will
be confusing, and may looks like this:

>    checking for kernel config option compatibility... done
>
>    checking whether CONFIG_MODULES is defined... no
>
>    configure: error:
>
>        *** This kernel does not include the required loadable module
>
>        *** support!
>

Signed-off-by: Maksym Shkolnyi <[email protected]>
@maskimko
Copy link
Contributor Author

This is a duplicate of #17678, but with formatted commit to pass check style

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for running this down. Just a few comments.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Sep 2, 2025
Reformat comments to fit 80 columns

Signed-off-by: Maksym Shkolnyi <[email protected]>
Signed-off-by: Maksym Shkolnyi <[email protected]>
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Sep 3, 2025
@behlendorf behlendorf merged commit 69b65dd into openzfs:master Sep 3, 2025
35 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants