unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: 41038@debbugs.gnu.org
Subject: bug#41038: gcc creates binaries that don't find their shared libraries
Date: Sun, 03 May 2020 01:55:00 +0200	[thread overview]
Message-ID: <1928431.D5bU72YO8c@omega> (raw)

Hi,

I'm using the recent guix-system-vm-image-1.1.0.x86_64-linux.

After installing a couple of package for development
$ guix install make gcc-toolchain binutils glibc gdb gettext m4 autoconf automake
I expected to be able to build GNU bison 3.5.91 from source. But I hit a build
failure, due to a program being linked against a shared library that cannot be
found.

How to reproduce (simple test case):
----------------
$ wget https://ftp.gnu.org/gnu/gettext/gettext-0.20.1.tar.gz
$ tar xfz gettext-0.20.1.tar.gz
$ cd gettext-0.20.1/libtextstyle/examples/color-hello
$ ./autogen.sh
$ ./configure
...
checking how to link with libtextstyle... -ltextstyle
...
$ make
...
gcc -g -O2 -o hello hello.o -ltextstyle
$ ./hello
./hello: error while loading shared libraries: libtextstyle.so.0: cannot open shared object file: No such file or directory
$ ldd hello
...
        libtextstyle.so.0 => not found
...


Discussion
----------

For packages *installed by the user*, the configure test has
code to add -Wl,-rpath,DIR options for appropriate directories.

However, here, the library has been installed by the system (through
'guix install gettext'). It appears that gcc, when searching for the
library, finds it. Whereas the dynamic loader (ld-linux-x86-64.so.2)
apparently does not find it.

It should be GCC's job to create binaries that work, when all
referenced libraries are system libraries. The ELF file format and
dynamic loader have enough facilities to make this possible (-Wl,-rpath
option, ld.so.conf, ld.so.cache).


Bruno





             reply	other threads:[~2020-05-02 23:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-02 23:55 Bruno Haible [this message]
2020-05-03 21:07 ` bug#41038: gcc creates binaries that don't find their shared libraries Ludovic Courtès
2020-05-03 23:09   ` Bruno Haible
2020-05-04  8:50     ` zimoun
2020-05-04  9:06     ` zimoun
2020-05-04  9:30     ` Ludovic Courtès
2020-05-04  9:59       ` zimoun
2020-05-04 19:52         ` Ludovic Courtès
2020-05-06 17:42           ` bug#41038: [PATCH] doc: Reword "The GCC toolchain" zimoun
2020-05-15 16:59             ` zimoun
2020-05-15 19:42             ` Nicolas Goaziou
2020-05-16 14:57               ` zimoun
2020-05-16 15:19                 ` Ludovic Courtès
2020-05-03 22:12 ` bug#41038: gcc creates binaries that don't find their shared libraries Danny Milosavljevic
2020-05-05  9:30   ` Ludovic Courtès
2020-05-05 11:17     ` Bruno Haible

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=1928431.D5bU72YO8c@omega \
    --to=bruno@clisp.org \
    --cc=41038@debbugs.gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).