Cross-compile libgpiod library and use it in my program
1
vote
2
answers
3392
views
I am trying to cross-compile a program with the "gpiod" library.
My host pc has Ubuntu 18.04 and the target platform I am cross-compiling for is a Board with IMX8X SOM.
I found source code at https://variwiki.com/index.php?title=MX8_GPIO&release=RELEASE_DUNFELL_V1.3_VAR-SOM-MX8X and I wanted to compile it, following the paragraph "2.2 libgpiod C Application".
The OS used in my board is the "dunfell" distro compiled with Yocto. The cross-compiler I am using is also created as sdk withing the Yocto environments (aarch64-fslc-linux-gcc).
When I compiled, I firstly obtained
"fatal error: gpiod.h: No such file or directory"
So, this library is not included by default in the provided toolchain.
So I tried to install the (cross)library in my pc, following the instructions at https://www.beyondlogic.org/an-introduction-to-chardev-gpio-and-libgpiod-on-the-raspberry-pi/ , but it did not work. The second error I get is
/opt/fslc-wayland/3.1/sysroots/x86_64-fslcsdk-linux/usr/libexec/aarch64-fslc-linux/gcc/aarch64-fslc-linux/9.3.0/real-ld: cannot find -lgpiod
collect2: error: ld returned 1 exit status
These are my compilation flags:
CFLAGS = -Wall -I$(INCLUDE) --sysroot=${SDKTARGETSYSROOT} -Og -lgpiod
I am new to this kind of issues and I hope I am making trivial mistakes.
Thanks in advance if someone is able to help!
Asked by powermignolo
(11 rep)
Dec 29, 2021, 11:56 AM
Last activity: Jul 15, 2025, 08:07 AM
Last activity: Jul 15, 2025, 08:07 AM