Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: "Stefan Müller" <stefan.mueller@rey-technology.com>
Cc: "buildroot@buildroot.org" <buildroot@buildroot.org>
Subject: Re: [Buildroot] question: used wrong librarys to build packages
Date: Fri, 3 May 2024 17:32:14 +0200	[thread overview]
Message-ID: <ZjUDfla_cDBWzc-I@landeda> (raw)
In-Reply-To: <ZR0P278MB0201C028ACBF4BFB1CEE9FB0BF1F2@ZR0P278MB0201.CHEP278.PROD.OUTLOOK.COM>

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

  reply	other threads:[~2024-05-03 15:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-05-06 11:32   ` Stefan Müller via buildroot
2024-05-06 12:41     ` Stefan Müller via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjUDfla_cDBWzc-I@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=stefan.mueller@rey-technology.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox