johnramsden/zectl

Incompatibilities after update to ZFS 2.0.0

Closed this issue · 3 comments

Just updated my Arch (archzfs, zfs-dkms) system this morning.

$ zectl 
zectl: error while loading shared libraries: libzfs.so.2: cannot open shared object file: No such file or directory
$ pacman -Qo /usr/lib/libzfs.so
/usr/lib/libzfs.so is owned by zfs-utils 2.0.0-1
$ ls -lh /usr/lib/libzfs.so
lrwxrwxrwx 1 root root 15 Dec  2 06:25 /usr/lib/libzfs.so -> libzfs.so.4.0.0

Ok, so try rebuilding zectl through AUR, taking care to do a "clean build":

$ yay -S zectl
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1]  zectl-0.1.2-1

  1 zectl                                    (Installed) (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 1
:: Deleting (1/1): /home/colvin/.cache/yay/zectl
:: Downloaded PKGBUILD (1/1): zectl
  1 zectl                                    (Installed) (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 
:: (1/1) Parsing SRCINFO: zectl
==> Making package: zectl 0.1.2-1 (Thu 03 Dec 2020 07:50:16 AM EST)
==> Retrieving sources...
  -> Downloading zectl-0.1.2.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   125  100   125    0     0    615      0 --:--:-- --:--:-- --:--:--   615
100 77399    0 77399    0     0   144k      0 --:--:-- --:--:-- --:--:-- 1303k
==> Validating source files with sha256sums...
    zectl-0.1.2.tar.gz ... Passed
==> Making package: zectl 0.1.2-1 (Thu 03 Dec 2020 07:50:17 AM EST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found zectl-0.1.2.tar.gz
==> Validating source files with sha256sums...
    zectl-0.1.2.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting zectl-0.1.2.tar.gz with bsdtar
==> Sources are ready.
==> Making package: zectl 0.1.2-1 (Thu 03 Dec 2020 07:50:19 AM EST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting build()...
-- The C compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
Searching for required ZFS include directories
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3") 
Found pkg-config
Found zfs include directories in /usr/include/libzfs;/usr/include/libspl;/usr/include/blkid;/usr/include/uuid;/usr/include/tirpc

Searching for ZFS libraries
libzfs library found at: /usr/lib/libzfs.so
libzpool library found at: /usr/lib/libzpool.so
libzfs_core library found at: /usr/lib/libzfs_core.so
libnvpair library found at: /usr/lib/libnvpair.so
libuutil library found at: /usr/lib/libuutil.so
PLUGINS_DIRECTORY=/usr/share/zectl/libze_plugin
PLUGINS_DIRECTORY=/usr/share/zectl/libze_plugin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/colvin/.cache/yay/zectl/src/zectl-0.1.2
/usr/bin/cmake -S/home/colvin/.cache/yay/zectl/src/zectl-0.1.2 -B/home/colvin/.cache/yay/zectl/src/zectl-0.1.2 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/CMakeFiles /home/colvin/.cache/yay/zectl/src/zectl-0.1.2//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/colvin/.cache/yay/zectl/src/zectl-0.1.2'
make  -f lib/libze/CMakeFiles/libze.dir/build.make lib/libze/CMakeFiles/libze.dir/depend
make[2]: Entering directory '/home/colvin/.cache/yay/zectl/src/zectl-0.1.2'
cd /home/colvin/.cache/yay/zectl/src/zectl-0.1.2 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/colvin/.cache/yay/zectl/src/zectl-0.1.2 /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze /home/colvin/.cache/yay/zectl/src/zectl-0.1.2 /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/CMakeFiles/libze.dir/DependInfo.cmake --color=
Dependee "/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/CMakeFiles/libze.dir/DependInfo.cmake" is newer than depender "/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/CMakeFiles/libze.dir/depend.internal".
Dependee "/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/CMakeFiles/libze.dir/depend.internal".
Scanning dependencies of target libze
make[2]: Leaving directory '/home/colvin/.cache/yay/zectl/src/zectl-0.1.2'
make  -f lib/libze/CMakeFiles/libze.dir/build.make lib/libze/CMakeFiles/libze.dir/build
make[2]: Entering directory '/home/colvin/.cache/yay/zectl/src/zectl-0.1.2'
[  4%] Building C object lib/libze/CMakeFiles/libze.dir/libze.c.o
cd /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze && /usr/bin/cc -DBUILD_TESTING=0 -DDEBUG=0 -DPLUGINS_DIRECTORY=\"/usr/share/zectl/libze_plugin\" -Dlibze_EXPORTS -I/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/include -I/usr/include/libzfs -I/usr/include/libspl -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/tirpc -I/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/. -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fmacro-prefix-map=/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/= -fPIC -std=gnu11 -o CMakeFiles/libze.dir/libze.c.o -c /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c
/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c: In function ‘libze_rename’:
/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:2646:38: error: incompatible type for argument 3 of ‘zfs_rename’
 2646 |     if (zfs_rename(be_zh, new_be_ds, B_FALSE, B_FALSE) != 0) {
      |                                      ^~~~~~~
      |                                      |
      |                                      int
In file included from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/include/libze/libze.h:4,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:6:
/usr/include/libzfs/libzfs.h:657:53: note: expected ‘renameflags_t’ {aka ‘struct renameflags’} but argument is of type ‘int’
  657 | extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t);
      |                                                     ^~~~~~~~~~~~~
/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:2646:9: error: too many arguments to function ‘zfs_rename’
 2646 |     if (zfs_rename(be_zh, new_be_ds, B_FALSE, B_FALSE) != 0) {
      |         ^~~~~~~~~~
In file included from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/include/libze/libze.h:4,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:6:
/usr/include/libzfs/libzfs.h:657:12: note: declared here
  657 | extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t);
      |            ^~~~~~~~~~
/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:2654:54: error: incompatible type for argument 3 of ‘zfs_rename’
 2654 |         if (zfs_rename(be_bpool_zh, new_be_bpool_ds, B_FALSE, B_FALSE) != 0) {
      |                                                      ^~~~~~~
      |                                                      |
      |                                                      int
In file included from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/include/libze/libze.h:4,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:6:
/usr/include/libzfs/libzfs.h:657:53: note: expected ‘renameflags_t’ {aka ‘struct renameflags’} but argument is of type ‘int’
  657 | extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t);
      |                                                     ^~~~~~~~~~~~~
/home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:2654:13: error: too many arguments to function ‘zfs_rename’
 2654 |         if (zfs_rename(be_bpool_zh, new_be_bpool_ds, B_FALSE, B_FALSE) != 0) {
      |             ^~~~~~~~~~
In file included from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/include/libze/libze.h:4,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze.c:6:
/usr/include/libzfs/libzfs.h:657:12: note: declared here
  657 | extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t);
      |            ^~~~~~~~~~
make[2]: *** [lib/libze/CMakeFiles/libze.dir/build.make:82: lib/libze/CMakeFiles/libze.dir/libze.c.o] Error 1
make[2]: Leaving directory '/home/colvin/.cache/yay/zectl/src/zectl-0.1.2'
make[1]: *** [CMakeFiles/Makefile2:173: lib/libze/CMakeFiles/libze.dir/all] Error 2
make[1]: Leaving directory '/home/colvin/.cache/yay/zectl/src/zectl-0.1.2'
make: *** [Makefile:149: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
error making: zectl

I hacked in a crappy fix for the error above, which appears to be a change in the zfs_rename function:

0.8.5:

extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t);

2.0.0:

typedef struct renameflags {
	/* recursive rename */
	int recursive : 1;

	/* don't unmount file systems */
	int nounmount : 1;

	/* force unmount file systems */
	int forceunmount : 1;
} renameflags_t;

extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t);

I now receive this:

$ make
Scanning dependencies of target libze
[  4%] Building C object lib/libze/CMakeFiles/libze.dir/libze.c.o
[  9%] Building C object lib/libze/CMakeFiles/libze.dir/system_linux.c.o
[ 14%] Building C object lib/libze/CMakeFiles/libze.dir/libze_bootloader.c.o
In file included from /usr/include/libspl/sys/stat.h:29,
                 from /usr/include/libspl/sys/mnttab.h:35,
                 from /usr/include/libzfs/libzfs.h:38,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/include/libze/libze.h:4,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze_bootloader.c:1:
/usr/include/libspl/sys/stat.h: In function ‘fstat64_blk’:
/usr/include/libspl/sys/stat.h:43:6: error: invalid use of undefined type ‘struct stat64’
   43 |  if (S_ISBLK(st->st_mode)) {
      |      ^~~~~~~
In file included from /usr/include/libspl/sys/mnttab.h:35,
                 from /usr/include/libzfs/libzfs.h:38,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/include/libze/libze.h:4,
                 from /home/colvin/.cache/yay/zectl/src/zectl-0.1.2/lib/libze/libze_bootloader.c:1:
/usr/include/libspl/sys/stat.h:44:34: error: invalid use of undefined type ‘struct stat64’
   44 |   if (ioctl(fd, BLKGETSIZE64, &st->st_size) != 0)
      |                                  ^~
make[2]: *** [lib/libze/CMakeFiles/libze.dir/build.make:108: lib/libze/CMakeFiles/libze.dir/libze_bootloader.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:173: lib/libze/CMakeFiles/libze.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

I don't think I'll have the time or expertise to get into this one.

Same here

Thanks, will get fix asap.