Re: libgpiod 2.2 installation on RaspberryPi 4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 30, 2024 at 09:59:05PM +0100, Le Chaudron Nautique wrote:
> Hello,
>
> I have some trouble installing the release 2.2 of libgpiod (or rather in
> linking it).
>

You mean "linking to it at runtime".

> I want to use it on a RaspberryPi 4 (kernel 6.6.56-RT and 6.12-RT) which are
> not provided by Raspberry but taken from https://git.kernel.org, thus the
> problem might come from there.
>

No, as you can link a binary, your problem seems to be with your ld path or
library installation.
The default path should include /usr/local/lib, so that probably isn;t
the issue.
On my Pi4, the relevant config file for that is:

pi@pi4:~/libgpiod $ cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib


> I have taken the 2.2 tarball on
> https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
>
> when I compile my file it seems ok (just trying with one of the examples
> from git : chip-info.c), but when I run the program obtained I have this
> error :
>

I assume you mean get_chip_info.c.

>
> ./prog: error while loading shared libraries: libgpiod.so.3: cannot open
> shared object file: No such file or directory
>
>
> The path for ./autogen was /usr/local
>
> gpiod.h  is in /usr/local/include
>

Not relevant at runtime.

> libgpiod.so.3  is in /usr/local/lib
>

And is it usually a symlink to the actual library.
What does "ls -l /usr/local/lib" show?

> My programs are in ~/prog/userspace and the makefile uses -lgpiod.
>

Shouldn't matter.  Try using ldd on your binary to see what libraries it
is linked against.

> Am I missing and option or a path to be declared somewhere ?
>

It is difficult to determine the root cause of your problem without more
detail.

Here is what I get using that tarball and:

./autogen.sh --prefix=/usr/local --enable-examples
make
sudo make install

pi@pi4:~/libgpiod-2.2 $ ls -l /usr/local/lib
total 372
-rw-r--r-- 1 root root 239480 Oct 31 09:40 libgpiod.a
-rwxr-xr-x 1 root root    946 Oct 31 09:40 libgpiod.la
lrwxrwxrwx 1 root root     17 Oct 31 09:40 libgpiod.so -> libgpiod.so.3.1.1
lrwxrwxrwx 1 root root     17 Oct 31 09:40 libgpiod.so.3 -> libgpiod.so.3.1.1
-rwxr-xr-x 1 root root 155480 Oct 31 09:40 libgpiod.so.3.1.1
drwxr-xr-x 2 root root   4096 Oct 31 09:40 pkgconfig
drwxr-xr-x 4 root root   4096 Jan 13  2024 python3.11

pi@pi4:~/libgpiod-2.2 $ ldd examples/.libs/get_chip_info
	linux-vdso.so.1 (0x0000007f9e276000)
	libgpiod.so.3 => /usr/local/lib/libgpiod.so.3 (0x0000007f9e1e0000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f9e030000)
	/lib/ld-linux-aarch64.so.1 (0x0000007f9e239000)

pi@pi4:~/libgpiod-2.2 $ examples/get_chip_info
gpiochip0 [pinctrl-bcm2711] (58 lines)

What do you get?

Cheers,
Kent.




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux