Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build ZFS release branch against 5.4 kernels #9755

Closed
jinnko opened this issue Dec 20, 2019 · 10 comments
Closed

Unable to build ZFS release branch against 5.4 kernels #9755

jinnko opened this issue Dec 20, 2019 · 10 comments
Labels
Type: Building Indicates an issue related to building binaries

Comments

@jinnko
Copy link

jinnko commented Dec 20, 2019

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version 18.04
Linux Kernel 5.4.5
Architecture amd64
ZFS Version 0.8.2-1 (from zfs-0.8-release branch)
SPL Version 0.8.2-1

Describe the problem you're observing

DKMS fails to build the stable branch against linux 5.4.5.

linux 5.3.18 has been announced to be the last of the 5.3 branch. See https://lwn.net/Articles/807636/

Attempt to build from master appears to build 0.8.0, and therefore wasn't fully tested as part of this and there's already a ticket for it: #9754

Describe how to reproduce the problem

On Ubuntu 18.04, using Ukuu, install the latest mainline kernel from https://kernel.ubuntu.com/~kernel-ppa/mainline/

Then get the latest ZFS 0.8-release branch. Build and install.

git clone https://github.com/zfsonlinux/zfs.git
git checkout -b zfs-0.8-release zfs-0.8-release
sh autogen.sh
./configure
make -s -j4
make deb
sudo dpkg -i \
  libnvpair1_*_amd64.deb \
  libuutil1_*_amd64.deb \
  libzfs2_*_amd64.deb \
  libzpool2_*_amd64.deb \
  python3-pyzfs_*_amd64.deb \
  zfs-initramfs_*_amd64.deb \
  zfs_*_amd64.deb \
  zfs-dkms_*_amd64.deb

During DKMS package installation the modules are build for the current kernel (5.3.18), however fail for 5.4.5:

...
Building initial module for 5.4.5-050405-generic
configure: error: *** Unable to build an empty module.
ERROR (dkms apport): kernel package linux-headers-5.4.5-050405-generic is not supported
Error! Bad return status for module build on kernel: 5.4.5-050405-generic (x86_64)
Consult /var/lib/dkms/zfs/0.8.2/build/make.log for more information.

The referenced log file contains:

DKMS make.log for zfs-0.8.2 for kernel 5.4.5-050405-generic (x86_64)
Fri 20 Dec 12:56:57 GMT 2019
make: *** No targets specified and no makefile found. Stop.

Include any warning/errors/backtraces from the system logs

Error message as returned by DKMS build (also pasted above).

...
Building initial module for 5.4.5-050405-generic
configure: error: *** Unable to build an empty module.
ERROR (dkms apport): kernel package linux-headers-5.4.5-050405-generic is not supported
Error! Bad return status for module build on kernel: 5.4.5-050405-generic (x86_64)
Consult /var/lib/dkms/zfs/0.8.2/build/make.log for more information.
@jinnko jinnko changed the title Unable to build ZFS against 5.4 kernels Unable to build ZFS release branch against 5.4 kernels Dec 20, 2019
@behlendorf behlendorf added the Type: Building Indicates an issue related to building binaries label Dec 20, 2019
@cdluminate
Copy link
Contributor

I think that problem can be avoided by applying this patch locally: c587b2c

@jinnko
Copy link
Author

jinnko commented Jan 16, 2020

Unfortunately updating the info in META hasn't worked. Followed the same procedure as before. When doing the ./configure stage, this ends with configure: error: *** Unable to build an empty module. The same issue exists on the master branch.

Edit: You can also find the config.log output in this gist: https://gist.github.com/jinnko/350d63cc0855958fe6ff718c7b544547

$ sh autogen.sh && ./configure && make -s -j4 && make deb       
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I config
autoreconf: configure.ac: tracing
autoreconf: configure.ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION
autoreconf: running: glibtoolize --copy --force
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.
glibtoolize: copying file 'config/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'config'.
glibtoolize: copying file 'config/libtool.m4'
glibtoolize: copying file 'config/ltoptions.m4'
glibtoolize: copying file 'config/ltsugar.m4'
glibtoolize: copying file 'config/ltversion.m4'
glibtoolize: copying file 'config/lt~obsolete.m4'
autoreconf: running: /home/linuxbrew/.linuxbrew/Cellar/autoconf/2.69_1/bin/autoconf --force
autoreconf: running: /home/linuxbrew/.linuxbrew/Cellar/autoconf/2.69_1/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:49: installing 'config/compile'
configure.ac:39: installing 'config/config.guess'
configure.ac:39: installing 'config/config.sub'
configure.ac:42: installing 'config/install-sh'
configure.ac:42: installing 'config/missing'
cmd/mount_zfs/Makefile.am: installing 'config/depcomp'
autoreconf: Leaving directory `.'
checking for gawk... gawk
checking metadata... META file
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /home/linuxbrew/.linuxbrew/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /home/linuxbrew/.linuxbrew/bin/gmkdir -p
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking how to print strings... printf
checking for a sed that does not truncate output... /home/linuxbrew/.linuxbrew/bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for pkg-config... /home/linuxbrew/.linuxbrew/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking dependency style of gcc... gcc3
checking whether to build with code coverage support... no
checking how to create a pax tar archive... gnutar
checking zfs author... OpenZFS on Linux
checking zfs license... CDDL
checking linux distribution... ubuntu
checking default package type... deb
checking default init directory... ${prefix}/etc/init.d
checking default init script type... lsb
checking default init config direectory... /etc/default
checking whether initramfs-tools is available... yes
checking whether rpm is available... yes (4.14.1)
checking whether rpmbuild is available... yes (4.14.1)
checking whether spec files are available... yes (rpm/generic/*.spec.in)
checking whether dpkg is available... yes (1.19.0.5)
checking whether dpkg-buildpackage is available... yes (1.19.0.5)
checking whether alien is available... yes (8.95)
checking for ld... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking for shared library run path origin... done
checking 32-bit host C ABI... no
checking for the common suffixes of directories in the library search path... lib,lib
checking for iconv... yes
checking for working iconv... yes
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking whether NLS is requested... yes
checking for msgfmt... /home/linuxbrew/.linuxbrew/bin/msgfmt
checking for gmsgfmt... /home/linuxbrew/.linuxbrew/bin/msgfmt
checking for xgettext... /home/linuxbrew/.linuxbrew/bin/xgettext
checking for msgmerge... /home/linuxbrew/.linuxbrew/bin/msgmerge
checking zfs config... all
checking whether gcc supports -Wno-unused-but-set-variable... yes
checking whether gcc supports -Wno-bool-compare... yes
checking whether gcc supports -Wframe-larger-than=<size>... yes
checking whether gcc supports -Wno-format-truncation... yes
checking whether gcc supports -fno-omit-frame-pointer... yes
checking whether to build with -fsanitize=address support... no
checking whether host toolchain supports SSE... yes
checking whether host toolchain supports SSE2... yes
checking whether host toolchain supports SSE3... yes
checking whether host toolchain supports SSSE3... yes
checking whether host toolchain supports SSE4.1... yes
checking whether host toolchain supports SSE4.2... yes
checking whether host toolchain supports AVX... yes
checking whether host toolchain supports AVX2... yes
checking whether host toolchain supports AVX512F... yes
checking whether host toolchain supports AVX512CD... yes
checking whether host toolchain supports AVX512DQ... yes
checking whether host toolchain supports AVX512BW... yes
checking whether host toolchain supports AVX512IFMA... yes
checking whether host toolchain supports AVX512VBMI... yes
checking whether host toolchain supports AVX512PF... yes
checking whether host toolchain supports AVX512ER... yes
checking whether host toolchain supports AVX512VL... yes
checking whether host toolchain supports AES... yes
checking whether host toolchain supports PCLMULQDQ... yes
checking for target asm dir... asm-x86_64
checking for python3... python3
checking for python version... 3.7
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.7/site-packages
checking for python3.7... /home/linuxbrew/.linuxbrew/bin/python3.7
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python >= '3.4.0'... yes
checking for the distutils Python package... yes
checking for Python include path... -I/home/linuxbrew/.linuxbrew/Cellar/python/3.7.4_2/include/python3.7m
checking for Python library path... -L/home/linuxbrew/.linuxbrew/opt/python/lib -lpython3.7m
checking for Python site-packages path... /home/linuxbrew/.linuxbrew/Cellar/python/3.7.4_2/lib/python3.7/site-packages
checking python extra libraries... -lcrypt -lpthread -ldl  -lutil -lm
checking python extra linking flags... -Xlinker -export-dynamic
checking consistency of all components of python development environment... yes
checking for python3.7 module: setuptools... yes
checking for python3.7 module: cffi... yes
checking whether to enable pyzfs: ... yes
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for CFLocaleCopyPreferredLanguages... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking for udev directories... /lib/udev;/lib/udev/rules.d
checking for systemd support... yes
checking for dracut directory... /usr/lib/dracut
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for library containing compress2... -lz
checking for library containing uncompress... none required
checking for library containing crc32... none required
checking uuid/uuid.h usability... yes
checking uuid/uuid.h presence... yes
checking for uuid/uuid.h... yes
checking for library containing uuid_generate... -luuid
checking for library containing uuid_is_null... none required
checking for library containing xdrmem_create... none required
checking blkid/blkid.h usability... yes
checking blkid/blkid.h presence... yes
checking for blkid/blkid.h... yes
checking libudev.h usability... yes
checking libudev.h presence... yes
checking for libudev.h... yes
checking for library containing udev_device_get_is_initialized... -ludev
checking openssl/evp.h usability... yes
checking openssl/evp.h presence... yes
checking for openssl/evp.h... yes
checking libaio.h usability... yes
checking libaio.h presence... yes
checking for libaio.h... yes
checking makedev() is declared in sys/sysmacros.h... yes
checking makedev() is declared in sys/mkdev.h... no
checking for mlockall... yes
checking for strlcat... no
checking for strlcpy... no
checking kernel source directory... /usr/src/linux-headers-5.4.12-050412-generic
checking kernel build directory... /usr/src/linux-headers-5.4.12-050412-generic
checking kernel source version... 5.4.12-050412-generic
checking kernel file name for module symbols... Module.symvers
checking whether access_ok() has 'type' parameter... no
checking whether modules can be built... no
configure: error: *** Unable to build an empty module.

@Rid
Copy link

Rid commented Jan 28, 2020

I'm also seeing the same with 5.4 mainline kernels and the new 5.5 kernel on Ubuntu 18.04, when built using master.

@tonyhutter
Copy link
Contributor

Are you able to build with 0.8.3?

@Rid
Copy link

Rid commented Jan 30, 2020

@tonyhutter Unfortunately not

Building initial module for 5.4.16-050416-generic
configure: error:
	*** Unable to build an empty module.

Error! Bad return status for module build on kernel: 5.4.16-050416-generic (x86_64)
Consult /var/lib/dkms/zfs/0.8.3/build/make.log for more information.

> cat /var/lib/dkms/zfs/0.8.3/build/make.log
DKMS make.log for zfs-0.8.3 for kernel 5.4.16-050416-generic (x86_64)
Thu Jan 30 15:57:06 GMT 2020
make: *** No targets specified and no makefile found.  Stop.

@tonyhutter
Copy link
Contributor

@Rid I'm able to reproduce this with Ubuntu 18.0.4 using the 5.4.16-050416-generic kernel as you suggested. Here's where it's failing in configure:

hutter@ubuntu18:~/zfs$ make modules -k -C /usr/src/linux-headers-5.4.16-050416-generic M=/home/hutter/zfs/build/conftest 2>&1 | head -n 20
make: Entering directory '/usr/src/linux-headers-5.4.16-050416-generic'
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: modpost: missing MODULE_LICENSE() in /home/hutter/zfs/build/conftest/conftest.o
see include/linux/module.h for more information
  CC [M]  /home/hutter/zfs/build/conftest/conftest.mod.o
In file included from <command-line>:0:0:
./arch/x86/include/asm/page_64.h: In function ‘clear_page’:
././include/linux/compiler_types.h:210:24: error: expected ‘(’ before ‘__inline’
 #define asm_inline asm __inline
                        ^
./arch/x86/include/asm/alternative.h:256:2: note: in expansion of macro ‘asm_inline’
  asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\
  ^~~~~~~~~~
./arch/x86/include/asm/page_64.h:49:2: note: in expansion of macro ‘alternative_call_2’
  alternative_call_2(clear_page_orig,
  ^~~~~~~~~~~~~~~~~~
In file included from ./arch/x86/include/asm/barrier.h:5:0,
                 from ./include/linux/compiler.h:256,
                 from ./include/asm-generic/bug.h:5,

This appears to be a bug in the kernel headers or GCC. Other external modules are hitting the issue with the 5.4 kernel:
https://bugs.launchpad.net/ubuntu/+source/fwts/+bug/1853090
http://rglinuxtech.com/?p=2645

One of the threads suggested installing GCC9 to fix it. Maybe try running though the steps here to get GCC9 installed? (totally untested by me)

https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

@Rid
Copy link

Rid commented Jan 31, 2020

Thanks @tonyhutter I can confirm it does indeed compile with gcc-9:

Building initial module for 5.4.16-050416-generic
Done.

zavl:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

znvpair.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

zunicode.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

zcommon.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

zfs.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

icp.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

zlua.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

spl.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.16-050416-generic/updates/dkms/

depmod...

DKMS: install completed.

@tonyhutter
Copy link
Contributor

@Rid thanks, I'll close the issue as a GCC bug.

@jinnko
Copy link
Author

jinnko commented Feb 3, 2020

Thanks for identifying the issue. Can confirm that using stock gcc 8 on Ubuntu 18.04 resolved the issue. Steps to achieve this were:

  1. Install gcc 8 and enable update-alternatives management of GCC version

    sudo apt install gcc-8
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7
    
  2. Activate gcc 8

    sudo update-alternatives --config gcc
    

After this the latest zfs-0.8-release branch (0.8.3-1) built successfully against linux 5.4.17.

@gordan-bobic
Copy link
Contributor

gordan-bobic commented Jul 10, 2020

This comes up on EL8 when using mainline 5.4.x kernel.
EL8 comes with GCC 8 as standard:

[root@orcone /usr/src/zfs-0.8.4]# gcc --version
gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I tried installing gcc9, but the same error comes up when running configure with CC set to gcc9:
CC=/opt/rh/gcc-toolset-9/root/bin/gcc CPP=/opt/rh/gcc-toolset-9/root/bin/cpp ./configure --with-linux=/usr/src/kernels/5.4.51-1.el8.aarch64 --with-linux-obj=/usr/src/kernels/5.4.51-1.el8.aarch64

I think an alternative fix ix required.

Edit:
Same problem on 4.19.x as well.

4.9.x works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Building Indicates an issue related to building binaries
Projects
None yet
Development

No branches or pull requests

6 participants