unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41038: gcc creates binaries that don't find their shared libraries
@ 2020-05-02 23:55 Bruno Haible
  2020-05-03 21:07 ` Ludovic Courtès
  2020-05-03 22:12 ` bug#41038: gcc creates binaries that don't find their shared libraries Danny Milosavljevic
  0 siblings, 2 replies; 16+ messages in thread
From: Bruno Haible @ 2020-05-02 23:55 UTC (permalink / raw)
  To: 41038

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





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

end of thread, other threads:[~2020-05-16 15:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02 23:55 bug#41038: gcc creates binaries that don't find their shared libraries Bruno Haible
2020-05-03 21:07 ` 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

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