public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Ilya Trukhanov <lahvuun@gmail.com>
To: libc-help@sourceware.org
Subject: Dynamic loader path on x86_64
Date: Sun, 2 Jan 2022 19:29:10 +0200	[thread overview]
Message-ID: <20220102172910.au2emqbo5ntutxkk@lahvuun.lan> (raw)

Hello!

I'm building glibc-2.34 on x86_64 for a no-multilib prefix like so:

$ mkdir build && cd build
$ ../configure --prefix=/pfx
$ make -j16
$ make install

After looking at sysdeps/unix/sysv/linux/x86_64/ldconfig.h:

#define SYSDEP_KNOWN_INTERPRETER_NAMES \
  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
  { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
  { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },

I'd expect the loader to be installed to
/pfx/lib64/ld-linux-x86-64.so.2, but it is instead installed to
/pfx/lib/ld-linux-x86-64.so.2, breaking (at least) /pfx/bin/ldd, which
gives me "not a dynamic executable" for all files. Strace hints at the
problem:

...
faccessat2(AT_FDCWD, "/pfx/lib/ld-linux.so.2", X_OK, AT_EACCESS) = -1 ENOENT (No such file or directory)
faccessat2(AT_FDCWD, "/pfx/lib64/ld-linux-x86-64.so.2", X_OK, AT_EACCESS) = -1 ENOENT (No such file or directory)
faccessat2(AT_FDCWD, "/pfx/libx32/ld-linux-x32.so.2", X_OK, AT_EACCESS) = -1 ENOENT (No such file or directory)
...

Indeed, symlinking /pfx/lib64 to /pfx/lib makes it work.

Is this some sort of multilib quirk? Aarch64 and riscv ldconfig.h seem
to have theirs at /lib just fine.

Is the lib64->lib symlink the intended way to solve this?

Would things break if I simply patch ldconfig.h to add
{ "/lib/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }?

Is there better way to do this that I'm not aware of, maybe?

Best,
Ilya Trukhanov.

             reply	other threads:[~2022-01-02 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-02 17:29 Ilya Trukhanov [this message]
2022-01-03 17:31 ` Adhemerval Zanella

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=20220102172910.au2emqbo5ntutxkk@lahvuun.lan \
    --to=lahvuun@gmail.com \
    --cc=libc-help@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).