[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/6753] In a prefixed install, -L order is not respected when sear
From: |
hjl dot tools at gmail dot com |
Subject: |
[Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it |
Date: |
24 Jul 2008 14:21:42 -0000 |
------- Additional Comments From hjl dot tools at gmail dot com 2008-07-24
14:21 -------
(In reply to comment #10)
> (In reply to comment #9)
> > (In reply to comment #8)
> > > >
> > > > You have a very strange setup. You better come up with a testcase
> > > > which doesn't require me to copy things into /usr/lib.
> > >
> > > so, don't copy. change the name libmylib.so to libcwait.so. Or pick
> > > another
> > > library name which is in /usr/lib and use that. Only condition is binutils
needs
> > > to be installed in a prefix and the same library needs to be present in
> > > $PREFIX/usr/lib/ and /usr/lib and with "-L$PREFIX/usr/lib -L/usr/lib", ld
> > > will
> > > just pick the one form /usr/lib.
> >
> > Please provide a testcase I can try.
> >
>
> The bug reproduces only in a prefixed environment. And if you have a prefixed
> binutils install, the steps mentioned by me should reproduce the problem:
>
> 1. run the script
> 2. cd /tmp/mydir
> 3 gcc -shared -o libcwait.so mysymbol.o
> 4 mv libcwait.so $PREFIX/usr/lib/libcwait.so
> 5. gcc -o mymain mymain.o -L$PREFIX/usr/lib -L/usr/lib -lcwait
>
> You can use any other name for library. It should be already present in
> /usr/lib.
>
> The link will fail with undefined symbol.
>
> This is the minimal I can do. The bug is pretty obvious in prefix env.
I can't reproduce it. I configured binutils with
--prefix=$HOME/bugs/binutils/6753/usr
bash-3.2$ make
gcc -m32 -B/export/home/hjl/bugs/binutils/6753/usr/bin/ -I. -fPIC -c -o
mysymbol.o mysymbol.c
gcc -m32 -B/export/home/hjl/bugs/binutils/6753/usr/bin/ -shared -o libcrypt.so
mysymbol.o
gcc -m32 -B/export/home/hjl/bugs/binutils/6753/usr/bin/ -I. -c -o mymain.o
mymain.c
gcc -m32 -B/export/home/hjl/bugs/binutils/6753/usr/bin/ -o foo mymain.o -lcrypt
-L/export/home/hjl/bugs/binutils/6753/usr/usr/lib
bash-3.2$ ls -l /export/home/hjl/bugs/binutils/6753/usr/usr/lib
total 4
-rwxr-xr-x 1 hjl hjl 4000 2008-07-24 07:14 libcrypt.so
bash-3.2$ gcc -m32 -B/export/home/hjl/bugs/binutils/6753/usr/bin/ -o foo
mymain.o -lcrypt -L/export/home/hjl/bugs/binutils/6753/usr/usr/lib
bash-3.2$ gcc -m32 -B/export/home/hjl/bugs/binutils/6753/usr/bin/ -o foo
mymain.o -lcrypt -L/export/home/hjl/bugs/binutils/6753/usr/lib
mymain.o: In function `main':
mymain.c:(.text+0x12): undefined reference to `mysymbol'
collect2: ld returned 1 exit status
bash-3.2$ mv usr/usr/lib/libcrypt.so usr/lib
bash-3.2$ gcc -m32 -B/export/home/hjl/bugs/binutils/6753/usr/bin/ -o foo
mymain.o -lcrypt -L/export/home/hjl/bugs/binutils/6753/usr/lib
bash-3.2$
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
http://sourceware.org/bugzilla/show_bug.cgi?id=6753
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug ld/6753] -L order is not respected when searching for -l<libname>, but -T fixes it, (continued)
- [Bug ld/6753] -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/23
- [Bug ld/6753] -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/23
- [Bug ld/6753] -L order is not respected when searching for -l<libname>, but -T fixes it, hjl dot tools at gmail dot com, 2008/07/23
- [Bug ld/6753] -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/23
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/23
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/23
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, hjl dot tools at gmail dot com, 2008/07/23
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/23
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, hjl dot tools at gmail dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it,
hjl dot tools at gmail dot com <=
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, hjl dot tools at gmail dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, hjl dot tools at gmail dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, hjl dot tools at gmail dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, funtoos at yahoo dot com, 2008/07/24
- [Bug ld/6753] In a prefixed install, -L order is not respected when searching for -l<libname>, but -T fixes it, hjl dot tools at gmail dot com, 2008/07/24