kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
527 stars 239 forks source link

error: unknown type name ‘blkid_probe’ #741

Closed russdan closed 4 months ago

russdan commented 4 months ago

Hi, I'm trying to do a clean make/install of btrfs-progs-6.7 (tried 6.6.3 also, same issue) and I get

$ make
    [CC]     common/device-utils.o
common/device-utils.c: In function ‘btrfs_wipe_existing_sb’:
common/device-utils.c:157:9: error: unknown type name ‘blkid_probe’
  157 |         blkid_probe pr = NULL;
      |         ^~~~~~~~~~~
common/device-utils.c:157:26: warning: initialization of ‘int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
  157 |         blkid_probe pr = NULL;
      |                          ^~~~
common/device-utils.c:159:14: warning: implicit declaration of function ‘blkid_new_probe’ [-Wimplicit-function-declaration]
  159 |         pr = blkid_new_probe();
      |              ^~~~~~~~~~~~~~~
common/device-utils.c:163:13: warning: implicit declaration of function ‘blkid_probe_set_device’; did you mean ‘blkid_probe_all_new’? [-Wimplicit-function-declaration]
  163 |         if (blkid_probe_set_device(pr, fd, 0, 0)) {
      |             ^~~~~~~~~~~~~~~~~~~~~~
      |             blkid_probe_all_new
common/device-utils.c:168:15: warning: implicit declaration of function ‘blkid_probe_lookup_value’ [-Wimplicit-function-declaration]
  168 |         ret = blkid_probe_lookup_value(pr, "SBMAGIC_OFFSET", &off, NULL);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~
common/device-utils.c:211:9: warning: implicit declaration of function ‘blkid_free_probe’ [-Wimplicit-function-declaration]
  211 |         blkid_free_probe(pr);
      |         ^~~~~~~~~~~~~~~~
common/device-utils.c: In function ‘device_get_queue_param’:
common/device-utils.c:395:9: error: unknown type name ‘blkid_probe’
  395 |         blkid_probe probe;
      |         ^~~~~~~~~~~
common/device-utils.c:402:17: warning: implicit declaration of function ‘blkid_new_probe_from_filename’ [-Wimplicit-function-declaration]
  402 |         probe = blkid_new_probe_from_filename(file);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/device-utils.c:407:17: warning: implicit declaration of function ‘blkid_probe_get_devno’; did you mean ‘blkid_probe_all_new’? [-Wimplicit-function-declaration]
  407 |         devno = blkid_probe_get_devno(probe);
      |                 ^~~~~~~~~~~~~~~~~~~~~
      |                 blkid_probe_all_new
common/device-utils.c:414:15: warning: implicit declaration of function ‘blkid_devno_to_wholedisk’ [-Wimplicit-function-declaration]
  414 |         ret = blkid_devno_to_wholedisk(devno, wholedisk, sizeof(wholedisk), NULL);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:479: common/device-utils.o] Error 1

./configure seems to have worked:

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 the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
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 for an ANSI C-conforming const... yes
checking for working volatile... yes
checking whether byte ordering is bigendian... no
checking whether C compiler accepts -msse2... yes
checking whether C compiler accepts -msse4.1... yes
checking whether C compiler accepts -mavx2... yes
checking whether C compiler accepts -msha... yes
checking whether C compiler accepts -std=gnu11... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for ar... ar
checking for rm... /usr/bin/rm
checking for rmdir... /usr/bin/rmdir
checking for openat... yes
checking for reallocarray... yes
checking for clock_gettime... yes
checking for __GLIBC__ defined in features.h... yes
checking for __builtin_add_overflow... yes
checking for __builtin_sub_overflow... yes
checking for __builtin_mul_overflow... yes
checking for __builtin_cpu_supports__pclmul... yes
checking for linux/perf_event.h... yes
checking for linux/hw_breakpoint.h... yes
checking for linux/fsverity.h... yes
checking for printf.h... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for execinfo.h... yes
checking for backtrace... yes
checking for backtrace_symbols_fd... yes
checking for sphinx-build... /usr/bin/sphinx-build
checking for a sed that does not truncate output... /usr/bin/sed
checking for ext2fs... yes
checking for com_err... yes
checking for reiserfscore >= 3.6.27... yes
checking for FIEMAP_EXTENT_SHARED defined in linux/fiemap.h... yes
checking for EXT4_EPOCH_MASK defined in ext2fs/ext2_fs.h... yes
checking for linux/blkzoned.h... yes
checking for struct blk_zone.capacity... yes
checking for BLKGETZONESZ defined in linux/blkzoned.h... yes
checking for blkid... yes
checking for uuid... yes
checking for zlib... yes
checking for libzstd >= 1.0.0... yes
checking for libudev... yes
checking for a Python interpreter with version >= 3.4... python3
checking for python3... /usr/bin/python3
checking for python3 version... 3.11
checking for python3 platform... linux
checking for GNU default python3 prefix... ${prefix}
checking for GNU default python3 exec_prefix... ${exec_prefix}
checking for python3 script directory (pythondir)... ${PYTHON_PREFIX}/lib/python3.11/site-packages
checking for python3 extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python3.11/site-packages
checking for python-3.11... yes
checking for lzo_version in -llzo2... yes
configure: creating ./config.status
config.status: creating Makefile.inc
config.status: creating Documentation/Makefile
config.status: creating libbtrfs/version.h
config.status: creating libbtrfsutil/libbtrfsutil.pc
config.status: creating include/config.h
config.status: include/config.h is unchanged

        btrfs-progs:        v6.7
        libbtrfs:           0.1.2 (deprecated)
        libbtrfsutil:       1.2.0

        prefix:             /usr/local
        exec prefix:        ${prefix}

        bindir:             ${exec_prefix}/bin
        libdir:             ${exec_prefix}/lib
        includedir:         ${prefix}/include
        pkgconfigdir:       ${libdir}/pkgconfig

        compiler:           gcc
        CFLAGS:             -g -O1 -Wall -D_FORTIFY_SOURCE=2
        LDFLAGS:

        programs:           yes
        shared libraries:   yes
        static libraries:   yes
        documentation:      yes
        doc generator:      sphinx
        backtrace support:  yes
        btrfs-convert:      yes (ext2,reiserfs)
        zstd support:       yes
        lzo support:        yes
        fsverity support:   yes
        Python bindings:    yes
        Python interpreter: /usr/bin/python3
        crypto provider:    builtin
        libudev:            yes
        zoned device:       yes

        Type 'make' to compile.

Can anyone please help with what I've done wrong? It's a clean Debian 12.4 install with debian backport 6.5 kernel:

$ uname -a
Linux debian 6.5.0-0.deb12.4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.10-1~bpo12+1 (2023-11-23) x86_64 GNU/Linux

I have e2fsprogs-1.47.0 installed

e2fsck 1.47.0 (5-Feb-2023)
        Using EXT2FS Library version 1.47.0, 5-Feb-2023

and libreiserfscore-dev_3.6.27-6 plus all the dependencies needed to get configure to complete.... plus linux headers installed:

sudo dpkg --list | egrep 'linux-image|linux-headers'
ii  linux-headers-6.5.0-0.deb12.4-amd64           6.5.10-1~bpo12+1                        amd64        Header files for Linux 6.5.0-0.deb12.4-amd64
ii  linux-headers-6.5.0-0.deb12.4-common          6.5.10-1~bpo12+1                        all          Common header files for Linux 6.5.0-0.deb12.4
ii  linux-image-6.5.0-0.deb12.4-amd64             6.5.10-1~bpo12+1                        amd64        Linux 6.5 for 64-bit PCs (signed)

I can see a prior issue around blkzone support here 425 but I don't see the same error as that issue

checking for linux/blkzoned.h... yes
checking for struct blk_zone.capacity... yes
checking for BLKGETZONESZ defined in linux/blkzoned.h... yes

and I tried configure --disable-zoned but that gave the same error...

so I'm now stumped as to why it's failing to make....

config.log

kdave commented 4 months ago

If the build can detect blkid then the symbol should be present, it's been there for a long time and the code hasn't changed since its introdcution. It could be an artifact of previous builds, you can try to do a clearn checkout, ./autogen.sh, ./configure, make. On an existing build make clean-all tries to remove the generated files and scripts (so the full bootstrap sequence is needed).

russdan commented 4 months ago

Hi, doesn't seem to make a difference - I re-downloaded btrfs-progs-v6.7.tar.gz from https://mirrors.edge.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/, untar'd and then did an ./autogen.sh, ./configure and make with the same result. I then did

$ make clean-all
Cleaning tools and libraries
Cleaning object files and dependencies
Cleaning test targets
Cleanin other generated files
Cleanin libbtrfs python generated files
'build/lib.linux-x86_64-cpython-311' does not exist -- can't clean it
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.11' does not exist -- can't clean it
Cleaning Documentation
Cleaning Generated Files

$ ./autogen.sh
Generate build-system by:
   aclocal:    aclocal (GNU automake) 1.16.5
   autoconf:   autoconf (GNU Autoconf) 2.71
   autoheader: autoheader (GNU Autoconf) 2.71
   automake:   automake (GNU automake) 1.16.5

Now type './configure' and 'make' to compile.

$ ./configure
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 the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
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 for an ANSI C-conforming const... yes
checking for working volatile... yes
checking whether byte ordering is bigendian... no
checking whether C compiler accepts -msse2... yes
checking whether C compiler accepts -msse4.1... yes
checking whether C compiler accepts -mavx2... yes
checking whether C compiler accepts -msha... yes
checking whether C compiler accepts -std=gnu11... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for ar... ar
checking for rm... /usr/bin/rm
checking for rmdir... /usr/bin/rmdir
checking for openat... yes
checking for reallocarray... yes
checking for clock_gettime... yes
checking for __GLIBC__ defined in features.h... yes
checking for __builtin_add_overflow... yes
checking for __builtin_sub_overflow... yes
checking for __builtin_mul_overflow... yes
checking for __builtin_cpu_supports__pclmul... yes
checking for linux/perf_event.h... yes
checking for linux/hw_breakpoint.h... yes
checking for linux/fsverity.h... yes
checking for printf.h... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for execinfo.h... yes
checking for backtrace... yes
checking for backtrace_symbols_fd... yes
checking for sphinx-build... /usr/bin/sphinx-build
checking for a sed that does not truncate output... /usr/bin/sed
checking for ext2fs... yes
checking for com_err... yes
checking for reiserfscore >= 3.6.27... yes
checking for FIEMAP_EXTENT_SHARED defined in linux/fiemap.h... yes
checking for EXT4_EPOCH_MASK defined in ext2fs/ext2_fs.h... yes
checking for linux/blkzoned.h... yes
checking for struct blk_zone.capacity... yes
checking for BLKGETZONESZ defined in linux/blkzoned.h... yes
checking for blkid... yes
checking for uuid... yes
checking for zlib... yes
checking for libzstd >= 1.0.0... yes
checking for libudev... yes
checking for a Python interpreter with version >= 3.4... python3
checking for python3... /usr/bin/python3
checking for python3 version... 3.11
checking for python3 platform... linux
checking for GNU default python3 prefix... ${prefix}
checking for GNU default python3 exec_prefix... ${exec_prefix}
checking for python3 script directory (pythondir)... ${PYTHON_PREFIX}/lib/python3.11/site-packages
checking for python3 extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python3.11/site-packages
checking for python-3.11... yes
checking for lzo_version in -llzo2... yes
configure: creating ./config.status
config.status: creating Makefile.inc
config.status: creating Documentation/Makefile
config.status: creating libbtrfs/version.h
config.status: creating libbtrfsutil/libbtrfsutil.pc
config.status: creating include/config.h

        btrfs-progs:        v6.7
        libbtrfs:           0.1.2 (deprecated)
        libbtrfsutil:       1.2.0

        prefix:             /usr/local
        exec prefix:        ${prefix}

        bindir:             ${exec_prefix}/bin
        libdir:             ${exec_prefix}/lib
        includedir:         ${prefix}/include
        pkgconfigdir:       ${libdir}/pkgconfig

        compiler:           gcc
        CFLAGS:             -g -O1 -Wall -D_FORTIFY_SOURCE=2
        LDFLAGS:

        programs:           yes
        shared libraries:   yes
        static libraries:   yes
        documentation:      yes
        doc generator:      sphinx
        backtrace support:  yes
        btrfs-convert:      yes (ext2,reiserfs)
        zstd support:       yes
        lzo support:        yes
        fsverity support:   yes
        Python bindings:    yes
        Python interpreter: /usr/bin/python3
        crypto provider:    builtin
        libudev:            yes
        zoned device:       yes

        Type 'make' to compile.

$ make
    [CC]     btrfs.o
    [CC]     kernel-lib/list_sort.o
    [CC]     kernel-lib/raid56.o
    [CC]     kernel-lib/rbtree.o
    [CC]     kernel-lib/tables.o
    [CC]     kernel-shared/accessors.o
    [CC]     kernel-shared/async-thread.o
    [CC]     kernel-shared/backref.o
    [CC]     kernel-shared/ctree.o
    [CC]     kernel-shared/delayed-ref.o
    [CC]     kernel-shared/dir-item.o
    [CC]     kernel-shared/disk-io.o
    [CC]     kernel-shared/extent-io-tree.o
    [CC]     kernel-shared/extent-tree.o
    [CC]     kernel-shared/extent_io.o
    [CC]     kernel-shared/file-item.o
    [CC]     kernel-shared/file.o
    [CC]     kernel-shared/free-space-cache.o
    [CC]     kernel-shared/free-space-tree.o
    [CC]     kernel-shared/inode-item.o
    [CC]     kernel-shared/inode.o
    [CC]     kernel-shared/locking.o
    [CC]     kernel-shared/messages.o
    [CC]     kernel-shared/print-tree.o
    [CC]     kernel-shared/root-tree.o
    [CC]     kernel-shared/transaction.o
    [CC]     kernel-shared/tree-checker.o
    [CC]     kernel-shared/ulist.o
    [CC]     kernel-shared/uuid-tree.o
    [CC]     kernel-shared/volumes.o
    [CC]     kernel-shared/zoned.o
    [CC]     common/array.o
    [CC]     common/cpu-utils.o
    [CC]     common/device-scan.o
common/device-scan.c: In function ‘test_uuid_unique’:
common/device-scan.c:112:44: warning: passing argument 3 of ‘blkid_dev_set_search’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  112 |         blkid_dev_set_search(iter, "UUID", uuid_str);
      |                                            ^~~~~~~~
In file included from common/device-scan.c:33:
/usr/include/blkid/blkid.h:60:58: note: expected ‘char *’ but argument is of type ‘const char *’
   60 |                                 char *search_type, char *search_value);
      |                                                    ~~~~~~^~~~~~~~~~~~
    [CC]     common/device-utils.o
common/device-utils.c: In function ‘btrfs_wipe_existing_sb’:
common/device-utils.c:157:9: error: unknown type name ‘blkid_probe’
  157 |         blkid_probe pr = NULL;
      |         ^~~~~~~~~~~
common/device-utils.c:157:26: warning: initialization of ‘int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
  157 |         blkid_probe pr = NULL;
      |                          ^~~~
common/device-utils.c:159:14: warning: implicit declaration of function ‘blkid_new_probe’ [-Wimplicit-function-declaration]
  159 |         pr = blkid_new_probe();
      |              ^~~~~~~~~~~~~~~
common/device-utils.c:163:13: warning: implicit declaration of function ‘blkid_probe_set_device’; did you mean ‘blkid_probe_all_new’? [-Wimplicit-function-declaration]
  163 |         if (blkid_probe_set_device(pr, fd, 0, 0)) {
      |             ^~~~~~~~~~~~~~~~~~~~~~
      |             blkid_probe_all_new
common/device-utils.c:168:15: warning: implicit declaration of function ‘blkid_probe_lookup_value’ [-Wimplicit-function-declaration]
  168 |         ret = blkid_probe_lookup_value(pr, "SBMAGIC_OFFSET", &off, NULL);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~
common/device-utils.c:211:9: warning: implicit declaration of function ‘blkid_free_probe’ [-Wimplicit-function-declaration]
  211 |         blkid_free_probe(pr);
      |         ^~~~~~~~~~~~~~~~
common/device-utils.c: In function ‘device_get_queue_param’:
common/device-utils.c:395:9: error: unknown type name ‘blkid_probe’
  395 |         blkid_probe probe;
      |         ^~~~~~~~~~~
common/device-utils.c:402:17: warning: implicit declaration of function ‘blkid_new_probe_from_filename’ [-Wimplicit-function-declaration]
  402 |         probe = blkid_new_probe_from_filename(file);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/device-utils.c:407:17: warning: implicit declaration of function ‘blkid_probe_get_devno’; did you mean ‘blkid_probe_all_new’? [-Wimplicit-function-declaration]
  407 |         devno = blkid_probe_get_devno(probe);
      |                 ^~~~~~~~~~~~~~~~~~~~~
      |                 blkid_probe_all_new
common/device-utils.c:414:15: warning: implicit declaration of function ‘blkid_devno_to_wholedisk’ [-Wimplicit-function-declaration]
  414 |         ret = blkid_devno_to_wholedisk(devno, wholedisk, sizeof(wholedisk), NULL);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:479: common/device-utils.o] Error 1

I also tried doing a git clone and repeated the process, same outcome.....

:(

kdave commented 4 months ago

This is very odd. Can you please check that the file /usr/include/blkid/blkid.h exists and is not empty? Also that it looks like the upstream https://github.com/util-linux/util-linux/blob/master/libblkid/src/blkid.h.in?

russdan commented 4 months ago

Hi, it exists, but is very different to the upstream blkid.h.in ... I'm not sure now how I've picked up such an old version

/usr/include/blkid/blkid.h

#define BLKID_VERSION   "1.0.0"
#define BLKID_DATE      "12-Feb-2003"

so now need to work out how to remove and re-install something newer :)

russdan commented 4 months ago

OK, I did a clean install of util-linux and that sorted the problem - weird as I did what I always did for builds (must admit I didn't previously use util-linux however) so strange that failed this time..... @kdave thanks for your help and the pointer to the likely cause...