[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] build: Fix shared build with gcc-7.
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] build: Fix shared build with gcc-7. |
Date: |
Thu, 19 Mar 2020 12:24:04 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Jan Nieuwenhuizen, le jeu. 19 mars 2020 12:13:13 +0100, a ecrit:
> Samuel Thibault writes:
> > Jan Nieuwenhuizen, le sam. 14 mars 2020 11:35:18 +0100, a ecrit:
> --8<---------------cut here---------------start------------->8---
> $ i586-pc-gnu-gcc -L. -L../libihash/ -L../libports/ -L../libiohelp/
> -L../libhurdbugaddr/ -L../libshouldbeinlibc/ -L../libfshelp/ -std=gnu99
> -fgnu89-inline -Wall -g -O3 -fno-strict-aliasing -g -O2
> -uargp_program_bug_address -o test-fcntl \
> test-fcntl.o \
> '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so ../libfshelp/libfshelp.so \
> -lpthread \
> '-Wl,-)'
> i586-pc-gnu-ld: warning: libshouldbeinlibc.so.0.3, needed by
> ../libfshelp/libfshelp.so, not found (try using -rpath or -rpath-link)
Ok, so we do have -L../libshouldbeinlibc/, and I guess
-L../libshouldbeinlibc/libshouldbeinlibc.so.0.3 does exist?
> Note how it says: (try using -rpath ...?).
Yes, but like many warnings, they can be misleading. In general we do
not want rpath.
> i586-pc-gnu-gcc -L. -Wl,-rpath=../libihash/ -Wl,-rpath=../libports/
> -Wl,-rpath=../libiohelp/ -Wl,-rpath=../libhurdbugaddr/
> -Wl,-rpath=../libshouldbeinlibc/ -L../libfshelp/ -std=gnu99 -fgnu89-inline
> -Wall -g -O3 -fno-strict-aliasing -g -O2 -uargp_program_bug_address -o
> test-fcntl \
> test-fcntl.o \
> '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so ../libfshelp/libfshelp.so \
> -lpthread \
> '-Wl,-)'
>
> it succeeds.
But then if you run objdump -x test-fcntl you will see
RUNPATH ../libports/
which we definitely do not want to keep for the installed binary :)
Using -rpath-link would apparently avoid recording it, and only use it
for the link, which does make sense. I'd say try to use that instead in
your patch, and we can commit that.
> the succeeding native collect2, apparentlty finding some libraries in
> /usr
Actually we do not want to succeed just because it finds libs from /lib
or /usr/lib
Samuel