* libgpiod 2.2 installation on RaspberryPi 4
@ 2024-10-30 20:59 Le Chaudron Nautique
2024-10-31 2:08 ` Kent Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Le Chaudron Nautique @ 2024-10-30 20:59 UTC (permalink / raw)
To: linux-gpio
Hello,
I have some trouble installing the release 2.2 of libgpiod (or rather in
linking it).
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.
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 :
./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
libgpiod.so.3 is in /usr/local/lib
My programs are in ~/prog/userspace and the makefile uses -lgpiod.
Am I missing and option or a path to be declared somewhere ?
Thanks,
Mathieu
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libgpiod 2.2 installation on RaspberryPi 4
2024-10-30 20:59 libgpiod 2.2 installation on RaspberryPi 4 Le Chaudron Nautique
@ 2024-10-31 2:08 ` Kent Gibson
2024-10-31 14:17 ` Le Chaudron Nautique
0 siblings, 1 reply; 5+ messages in thread
From: Kent Gibson @ 2024-10-31 2:08 UTC (permalink / raw)
To: Le Chaudron Nautique; +Cc: linux-gpio
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libgpiod 2.2 installation on RaspberryPi 4
2024-10-31 2:08 ` Kent Gibson
@ 2024-10-31 14:17 ` Le Chaudron Nautique
2024-11-01 5:24 ` Kent Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Le Chaudron Nautique @ 2024-10-31 14:17 UTC (permalink / raw)
Cc: linux-gpio
Le 31/10/2024 à 03:08, Kent Gibson a écrit :
> 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".
Right.
>
>> 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
Ok on my side.
>
>> 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.
You're right, I spent to much time running through the different files...
>> ./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?
The same as yours (except for the exact sizes).
>> 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?
I didn't add the --enable-examples, I took the code from git and put it
in my test file/directory.
vanvan@lcntest-stable:~/prog/userspace $ ldd prog
linux-vdso.so.1 (0x0000007fa851e000)
libgpiod.so.3 => not found
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fa8300000)
/lib/ld-linux-aarch64.so.1 (0x0000007fa84e1000)
Should I look at/capture the autogen logs to see if something is amiss ?
Thanks,
Mathieu
>
> Cheers,
> Kent.
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libgpiod 2.2 installation on RaspberryPi 4
2024-10-31 14:17 ` Le Chaudron Nautique
@ 2024-11-01 5:24 ` Kent Gibson
[not found] ` <df44ef64-0534-4a18-8024-ba0d56fa16fb@chaudron-nautique.fr>
0 siblings, 1 reply; 5+ messages in thread
From: Kent Gibson @ 2024-11-01 5:24 UTC (permalink / raw)
To: Le Chaudron Nautique; +Cc: linux-gpio
On Thu, Oct 31, 2024 at 03:17:32PM +0100, Le Chaudron Nautique wrote:
>
> Le 31/10/2024 à 03:08, Kent Gibson a écrit :
> > On Wed, Oct 30, 2024 at 09:59:05PM +0100, Le Chaudron Nautique wrote:
> > > Hello,
> > >
> > 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?
> I didn't add the --enable-examples, I took the code from git and put it in
> my test file/directory.
Adding the --enable-examples is just a convenient way to get the
examples built. Building it manually is fine too.
>
> vanvan@lcntest-stable:~/prog/userspace $ ldd prog
> linux-vdso.so.1 (0x0000007fa851e000)
> libgpiod.so.3 => not found
> libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fa8300000)
> /lib/ld-linux-aarch64.so.1 (0x0000007fa84e1000)
>
> Should I look at/capture the autogen logs to see if something is amiss ?
>
No, the issue is ld not locating the library in /usr/local/lib for some reason.
What does
$ ldconfig -p | grep libgpiod
show?
I get:
pi@pi4:~/libgpiod-2.2 $ ldconfig -p | grep libgpiod
libgpiodcxx.so.1 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiodcxx.so.1
libgpiod.so.3 (libc6,AArch64) => /usr/local/lib/libgpiod.so.3
libgpiod.so.2 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiod.so.2
libgpiod.so (libc6,AArch64) => /usr/local/lib/libgpiod.so
If that doesn't provide a libgpiod.so.3 location for you then try
$ sudo ldconfig
to update the ld cache, and then repeating the above and the ldd.
If that doesn't work, try setting
$ export LD_LIBRARY_PATH=/usr/local/lib
and repeating the ldd.
Cheers,
Kent.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libgpiod 2.2 installation on RaspberryPi 4
[not found] ` <df44ef64-0534-4a18-8024-ba0d56fa16fb@chaudron-nautique.fr>
@ 2024-11-05 1:07 ` Kent Gibson
0 siblings, 0 replies; 5+ messages in thread
From: Kent Gibson @ 2024-11-05 1:07 UTC (permalink / raw)
To: brgl; +Cc: linux-gpio, Le Chaudron Nautique
On Fri, Nov 01, 2024 at 03:24:42PM +0100, Le Chaudron Nautique wrote:
>
> Le 01/11/2024 à 06:24, Kent Gibson a écrit :
> > On Thu, Oct 31, 2024 at 03:17:32PM +0100, Le Chaudron Nautique wrote:
> > > Le 31/10/2024 à 03:08, Kent Gibson a écrit :
> > > > On Wed, Oct 30, 2024 at 09:59:05PM +0100, Le Chaudron Nautique wrote:
> > > > > Hello,
> > > > >
> > > > 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?
> > > I didn't add the --enable-examples, I took the code from git and put it in
> > > my test file/directory.
> > Adding the --enable-examples is just a convenient way to get the
> > examples built. Building it manually is fine too.
> >
> > > vanvan@lcntest-stable:~/prog/userspace $ ldd prog
> > > linux-vdso.so.1 (0x0000007fa851e000)
> > > libgpiod.so.3 => not found
> > > libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fa8300000)
> > > /lib/ld-linux-aarch64.so.1 (0x0000007fa84e1000)
> > >
> > > Should I look at/capture the autogen logs to see if something is amiss ?
> > >
> > No, the issue is ld not locating the library in /usr/local/lib for some reason.
> >
> > What does
> >
> > $ ldconfig -p | grep libgpiod
> >
> > show?
> >
> > I get:
> >
> > pi@pi4:~/libgpiod-2.2 $ ldconfig -p | grep libgpiod
> > libgpiodcxx.so.1 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiodcxx.so.1
> > libgpiod.so.3 (libc6,AArch64) => /usr/local/lib/libgpiod.so.3
> > libgpiod.so.2 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiod.so.2
> > libgpiod.so (libc6,AArch64) => /usr/local/lib/libgpiod.so
>
> I get only :
>
> $ ldconfig -p | grep libgpiod
> libgpiodcxx.so.1 (libc6,AArch64) =>
> /lib/aarch64-linux-gnu/libgpiodcxx.so.1
> libgpiod.so.2 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiod.so.2
>
> But after running
>
> $sudo ldconfig
>
> I can see libgpiod.so.3 and the program runs without problem anymore.
>
>
> $ ldconfig -p | grep libgpiod
> libgpiodcxx.so.1 (libc6,AArch64) =>
> /lib/aarch64-linux-gnu/libgpiodcxx.so.1
> libgpiod.so.3 (libc6,AArch64) => /usr/local/lib/libgpiod.so.3
> libgpiod.so.2 (libc6,AArch64) => /lib/aarch64-linux-gnu/libgpiod.so.2
> libgpiod.so (libc6,AArch64) => /usr/local/lib/libgpiod.so
>
> $ ldd prog
> linux-vdso.so.1 (0x0000007f957eb000)
> libgpiod.so.3 => /usr/local/lib/libgpiod.so.3 (0x0000007f95740000)
> libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f95590000)
> /lib/ld-linux-aarch64.so.1 (0x0000007f957a0000)
>
>
> Thanks.
>
>
As the reply didn't go to the list, just letting you know that the problem
was the ld.so.cache not being rebuilt when libgpiod is installed by
'sudo make install'.
Not sure of this is Pi specific, or v2.2 specific, but I suspect at
least one other Pi user has seen the same thing.
The last thing the install (installing into /usr/local) with libtool does is:
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib
which, IIUC, updates that directory in the cache and any symlinks it
contains, but it doesn't rebuild the cache. So it will work fine if you
are updating but not on the first install??
The workaround is to 'sudo ldconfig' after the install to rebuild the
cache. But I was expecting that autoconf/libtool would sort this out.
Cheers,
Kent.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-05 1:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 20:59 libgpiod 2.2 installation on RaspberryPi 4 Le Chaudron Nautique
2024-10-31 2:08 ` Kent Gibson
2024-10-31 14:17 ` Le Chaudron Nautique
2024-11-01 5:24 ` Kent Gibson
[not found] ` <df44ef64-0534-4a18-8024-ba0d56fa16fb@chaudron-nautique.fr>
2024-11-05 1:07 ` Kent Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).