You are compiling code written for libgpiod v1 against libgpiod v2. The objects are now opaque so if you do that will see errors like:Several errors are seen - am I missing something?
as the gpiod.h header no longer defines those structs.src/jtag/drivers/linuxgpiod.c:348:16: error: variable 'config' has initializer but incomplete type
src/jtag/drivers/linuxgpiod.c:349:18: error: 'struct gpiod_line_request_config' has no member named 'consumer'
src/jtag/drivers/linuxgpiod.c:350:18: error: 'struct gpiod_line_request_config' has no member named 'request_type'
src/jtag/drivers/linuxgpiod.c:351:18: error: 'struct gpiod_line_request_config' has no member named 'flags'
src/jtag/drivers/linuxgpiod.c:348:42: error: storage size of 'config' isn't known
You need to ensure the build is finding the correct version of gpiod.h and libgpiod.so.
Note that the ABI versions of libgpiod are not in sync with the library version (long story that I'm not even sure of), so (recent) libgpiod v1 is linked as libgpiod.so.2, while libgpiod v2 will be linked as libgpiod.so.3. When building you need to ensure the linker finds the right one. You can have both installed and ld will find the correct one at runtime based on the ABI version found when linking the build. e.g. I have both installed on my Pi, v1 from apt and v2 from a manual build - installed into /usr/local:
Code:
pi@pi4:~/libgpiod-2.2 $ ldconfig -p | grep libgpiodlibgpiodcxx.so.1 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiodcxx.so.1libgpiod.so.3 (libc6,AArch64) => /usr/local/lib/libgpiod.so.3libgpiod.so.2 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiod.so.2libgpiod.so (libc6,AArch64) => /usr/local/lib/libgpiod.so
The version from the tools only tells you that that tool and runtime library version is available.
The other version may also be available:
Code:
pi@pi4:~/libgpiod-2.2 $ /usr/bin/gpioinfo -vgpioinfo (libgpiod) v1.6.3Copyright (C) 2017-2018 Bartosz GolaszewskiLicense: LGPLv2.1This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.pi@pi4:~/libgpiod-2.2 $ /usr/local/bin/gpioinfo -vgpioinfo (libgpiod) v2.2Copyright (C) 2017-2023 Bartosz GolaszewskiLicense: GPL-2.0-or-laterThis is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.
Those are generally provided via "-dev" packages, so libgpiod-dev, or manually installed from the source (since last I checked v2 still isn't available in an apt).
Statistics: Posted by warthog618 — Sun Nov 03, 2024 2:25 am