Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] question: used wrong librarys to build packages
@ 2024-05-03  7:42 Stefan Müller via buildroot
  2024-05-03 15:32 ` Yann E. MORIN
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Müller via buildroot @ 2024-05-03  7:42 UTC (permalink / raw)
  To: buildroot@buildroot.org


[-- Attachment #1.1: Type: text/plain, Size: 2502 bytes --]

Hi guys

how is it possible that buildroot builds packages and links them against libraries that do not exist in buildroot (only on the host system, not below the buildroot directory)? - i am a bit confused now.
i downloaded buildroot 2024.02.01 and just copied my configs into it.

many of the built packages are now linked against libssl.so.1.1 (but buidroot uses openssl 3):
example:
build@build:~/buildroot/output/target/usr/sbin$ ldd NetworkManager
./NetworkManager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./NetworkManager)
./NetworkManager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./NetworkManager)
./NetworkManager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./NetworkManager)
./NetworkManager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by ./NetworkManager)
        linux-vdso.so.1 (0x00007ffe9f755000)
        libgio-2.0.so.0 => /lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f2b90e93000)
<snip>
...
<snip>
        libssh.so.4 => /lib/x86_64-linux-gnu/libssh.so.4 (0x00007f2b9040d000)
        libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007f2b903fa000)
        libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f2b90367000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f2b90090000)

but:
build@build:~/buildroot/output/target/usr/sbin$ find ../../../host/ -name libssl*
../../../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/pkgconfig/libssl.pc
../../../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libssl.so.3
../../../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libssl.so
../../../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libssl.a
../../../host/lib/pkgconfig/libssl.pc
../../../host/lib/libssl.so.3
../../../host/lib/libssl.so
../../../host/lib/libssl.a
build@build:~/buildroot/output/target/usr/sbin$

and (host system that runs buildroot):
build@build:~/buildroot/output/target/usr/sbin$ find /usr -name libssl*
/usr/lib/x86_64-linux-gnu/pkgconfig/libssl.pc
/usr/lib/x86_64-linux-gnu/libssl.so
/usr/lib/x86_64-linux-gnu/libssl.so.1.1
/usr/lib/x86_64-linux-gnu/libssl.a
/usr/lib/x86_64-linux-gnu/libssl3.so
/usr/share/doc/libssl1.1
/usr/share/doc/libssl-dev
build@build:~/buildroot/output/target/usr/sbin$

shouldn't buildroot use the libraries that are inside the buildroot directory?
Can anyone help me find out what is wrong?
thanks

[-- Attachment #1.2: Type: text/html, Size: 7152 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] question: used wrong librarys to build packages
  2024-05-03  7:42 [Buildroot] question: used wrong librarys to build packages Stefan Müller via buildroot
@ 2024-05-03 15:32 ` Yann E. MORIN
  2024-05-06 11:32   ` Stefan Müller via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2024-05-03 15:32 UTC (permalink / raw)
  To: Stefan Müller; +Cc: buildroot@buildroot.org

Stefan, All,

On 2024-05-03 07:42 +0000, Stefan Müller via buildroot spake thusly:
> how is it possible that buildroot builds packages and links them against
> libraries that do not exist in buildroot (only on the host system, not below
> the buildroot directory)? - i am a bit confused now.
> 
> i downloaded buildroot 2024.02.01 and just copied my configs into it.
> 
> many of the built packages are now linked against libssl.so.1.1 (but buidroot
> uses openssl 3):
> 
> example:
> 
> build@build:~/buildroot/output/target/usr/sbin$ ldd NetworkManager

Using the host 'ldd' does not work on target binaries, becasue it does
not know that they are not meant for the current machine.

In fact, 'ldd' is just a glorified wrapper that basically is equivlanet
to actually running the file with LD_TRACE_LOADED_OBJECTS=1 in the
environment:

    $ ldd /usr/bin/ls
        linux-vdso.so.1 (0x00007fff02d31000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f5f9564b000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f5f95641000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f5f9545f000)
        libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f5f953c4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5f956b6000)

    $ LD_TRACE_LOADED_OBJECTS=1 /usr/bin/ls
        linux-vdso.so.1 (0x00007fff0c345000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f7dc1b2c000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f7dc1b22000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f7dc1940000)
        libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f7dc18a5000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f7dc1b71000)

So you can't use ldd on target executables: it won't work.

Also, using ldd is really a bad idea, as it is basically equivalent to
actually running the program you're inspecting; don't do it. Instead use
readelf to inspect a program:

    $ readelf -d /usr/bin/ls
    Dynamic section at offset 0x229d8 contains 29 entries:
      Tag        Type                         Name/Value
     0x0000000000000001 (NEEDED)             Shared library: [libselinux.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libcap.so.2]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
    [...]

    $ readelf -p .interp /usr/bin/ls
    String dump of section '.interp':
      [     0]  /lib64/ld-linux-x86-64.so.2

> ./NetworkManager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not
> found (required by ./NetworkManager)

As you can see:

 1. it uses your host system interpreter, /lib/x86_64-linux-gnu/libc.so.6
 2. it reports unknown versioned symbols, presumably because your system
    uses an older glibc than your target system.

> shouldn't buildroot use the libraries that are inside the buildroot directory?

It does, but you are using the wrong tools to check.

> Can anyone help me find out what is wrong?

I hope the above is providing enough hints at how to look.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] question: used wrong librarys to build packages
  2024-05-03 15:32 ` Yann E. MORIN
@ 2024-05-06 11:32   ` Stefan Müller via buildroot
  2024-05-06 12:41     ` Stefan Müller via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Müller via buildroot @ 2024-05-06 11:32 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot@buildroot.org

Hi Yann, all

Thank you for your explanation.
Lerned a new lesson.
I have started over (make distclean) to be sure that everything is clean.

but  the whole thing is getting more and more interesting.
when i boot the built image i effectively get the error message:
/usr/sbin/NetworkManager: error while loading shared libraries: libssl.so.1.1: cannot open shared object files: No surch file or directory

readelf says something else:

build@build:~/buildroot$ readelf -d output/target/usr/sbin/NetworkManager
Dynamic section at offset 0x2b9c70 contains 35 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgmodule-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libndp.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libudev.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libsystemd.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libcurl.so.4]
 0x0000000000000001 (NEEDED)             Shared library: [libgnutls.so.30]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000c (INIT)               0x419000
 0x000000000000000d (FINI)               0x5e826c
 0x0000000000000019 (INIT_ARRAY)         0x6a7910
...

the individual librarys also do not point to libssl.so.1.1 as far as i have seen. 

if i copy the libssl.so.1.1 from an older build into the overlay director, the next library libcrypto.so.1.1 is missing.. I can copy all the librarys, but that can't be the solution. 

the next strange thing is that openssh is missing in the image. but it seems to be built:

build@build:~/buildroot$ find . -name *sshd
./support/testing/tests/download/sshd
./package/openssh/S50sshd
./package/dropbear/etc-pam.d-sshd
./output/target/etc/pam.d/sshd
./output/build/openssh-9.7p1/contrib/hpux/sshd
./output/build/openssh-9.7p1/contrib/suse/rc.sshd
./output/build/openssh-9.7p1/contrib/suse/rc.config.sshd
./output/build/openssh-9.7p1/sshd
./board/gw1xx/overlay/etc/pam.d/sshd


build@build:~/buildroot$ make V=1 openssh-rebuild
rm -f /home/build/buildroot/output/build/openssh-9.7p1/.stamp_installed
rm -f /home/build/buildroot/output/build/openssh-9.7p1/.stamp_staging_installed
rm -f /home/build/buildroot/output/build/openssh-9.7p1/.stamp_target_installed
rm -f /home/build/buildroot/output/build/openssh-9.7p1/.stamp_images_installed
rm -f /home/build/buildroot/output/build/openssh-9.7p1/.stamp_host_installed
rm -f /home/build/buildroot/output/build/openssh-9.7p1/.stamp_built
>>> openssh 9.7p1 Building
GIT_DIR=. PATH="/home/build/buildroot/output/host/bin:/home/build/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"  /usr/bin/make -j17  -C /home/build/buildroot/output/build/openssh-9.7p1/
(cd openbsd-compat && /usr/bin/make)
make[3]: Nothing to be done for 'all'.
touch /home/build/buildroot/output/build/openssh-9.7p1/.stamp_built
>>> openssh 9.7p1 Installing to target
GIT_DIR=. PATH="/home/build/buildroot/output/host/bin:/home/build/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"  /usr/bin/make -j17 DESTDIR=/home/build/buildroot/output/target install-sysconf -C /home/build/buildroot/output/build/openssh-9.7p1/
/home/build/buildroot/output/host/bin/mkdir -p /home/build/buildroot/output/target/etc/ssh
/home/build/buildroot/output/target/etc/ssh/sshd_config already exists, install will not overwrite
/home/build/buildroot/output/target/etc/ssh/moduli already exists, install will not overwrite
/usr/bin/install -D -m 644 package/openssh/sshd.service /home/build/buildroot/output/target/usr/lib/systemd/system/sshd.service
/usr/bin/install -m 0644 -D package/openssh/sshd-sysusers.conf /home/build/buildroot/output/target/usr/lib/sysusers.d/sshd.conf
touch /home/build/buildroot/output/build/openssh-9.7p1/.stamp_target_installed
comm: /home/build/buildroot/output/build/openssh-9.7p1/.files-list.before: No such file or directory
comm: /home/build/buildroot/output/build/openssh-9.7p1/.files-list-staging.before: No such file or directory
comm: /home/build/buildroot/output/build/openssh-9.7p1/.files-list-images.before: No such file or directory
comm: /home/build/buildroot/output/build/openssh-9.7p1/.files-list-host.before: No such file or directory
touch /home/build/buildroot/output/build/openssh-9.7p1/.stamp_installed
build@build:~/buildroot$
build@build:~/buildroot$
build@build:~/buildroot$ find output/target/ -name *sshd
output/target/etc/pam.d/sshd
build@build:~/buildroot$ find output/target/ -name sshd
output/target/etc/pam.d/sshd
build@build:~/buildroot$ find output/target/ -name *ssh
output/target/usr/share/bash-completion/completions/autossh
output/target/usr/share/bash-completion/completions/ssh
output/target/usr/share/bash-completion/completions/mussh
output/target/etc/ssh
build@build:~/buildroot$

something must be wrong with my configuration, but i have no idea where to look.
thanks for ideas.


-----Ursprüngliche Nachricht-----
Von: Yann E. MORIN <yann.morin.1998@free.fr> 
Gesendet: Freitag, 3. Mai 2024 17:32
An: Stefan Müller <stefan.mueller@rey-technology.com>
Cc: buildroot@buildroot.org
Betreff: Re: [Buildroot] question: used wrong librarys to build packages

Stefan, All,

On 2024-05-03 07:42 +0000, Stefan Müller via buildroot spake thusly:
> how is it possible that buildroot builds packages and links them 
> against libraries that do not exist in buildroot (only on the host 
> system, not below the buildroot directory)? - i am a bit confused now.
> 
> i downloaded buildroot 2024.02.01 and just copied my configs into it.
> 
> many of the built packages are now linked against libssl.so.1.1 (but 
> buidroot uses openssl 3):
> 
> example:
> 
> build@build:~/buildroot/output/target/usr/sbin$ ldd NetworkManager

Using the host 'ldd' does not work on target binaries, becasue it does not know that they are not meant for the current machine.

In fact, 'ldd' is just a glorified wrapper that basically is equivlanet to actually running the file with LD_TRACE_LOADED_OBJECTS=1 in the
environment:

    $ ldd /usr/bin/ls
        linux-vdso.so.1 (0x00007fff02d31000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f5f9564b000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f5f95641000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f5f9545f000)
        libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f5f953c4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5f956b6000)

    $ LD_TRACE_LOADED_OBJECTS=1 /usr/bin/ls
        linux-vdso.so.1 (0x00007fff0c345000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f7dc1b2c000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f7dc1b22000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f7dc1940000)
        libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f7dc18a5000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f7dc1b71000)

So you can't use ldd on target executables: it won't work.

Also, using ldd is really a bad idea, as it is basically equivalent to actually running the program you're inspecting; don't do it. Instead use readelf to inspect a program:

    $ readelf -d /usr/bin/ls
    Dynamic section at offset 0x229d8 contains 29 entries:
      Tag        Type                         Name/Value
     0x0000000000000001 (NEEDED)             Shared library: [libselinux.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libcap.so.2]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
    [...]

    $ readelf -p .interp /usr/bin/ls
    String dump of section '.interp':
      [     0]  /lib64/ld-linux-x86-64.so.2

> ./NetworkManager: /lib/x86_64-linux-gnu/libc.so.6: version 
> `GLIBC_2.33' not found (required by ./NetworkManager)

As you can see:

 1. it uses your host system interpreter, /lib/x86_64-linux-gnu/libc.so.6  2. it reports unknown versioned symbols, presumably because your system
    uses an older glibc than your target system.

> shouldn't buildroot use the libraries that are inside the buildroot directory?

It does, but you are using the wrong tools to check.

> Can anyone help me find out what is wrong?

I hope the above is providing enough hints at how to look.

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' 
| conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] question: used wrong librarys to build packages
  2024-05-06 11:32   ` Stefan Müller via buildroot
@ 2024-05-06 12:41     ` Stefan Müller via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Müller via buildroot @ 2024-05-06 12:41 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot@buildroot.org

I have found the library problem.
during the boot process my system-reconfiguration-script has overwritten the libcurl.so.4 with a wrong version.


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-06 12:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03  7:42 [Buildroot] question: used wrong librarys to build packages Stefan Müller via buildroot
2024-05-03 15:32 ` Yann E. MORIN
2024-05-06 11:32   ` Stefan Müller via buildroot
2024-05-06 12:41     ` Stefan Müller via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox