Re: [RFC]possible improvements to --with-sysroot
On 3/6/07, Daniel Jacobowitz <drow@false.org> wrote:
> On Tue, Mar 06, 2007 at 02:05:06AM +0800, Zhang Le wrote:
> > I have used "strace -f" to check where linker looked for -lqt-mt. From
> > what I have observed, it seems that ld didn't use
> > $SYSROOT/etc/ld.so.conf.
>
> Well, it's supposed to, so I suggest you check what's happened in ld.
I found a clue which may lead to a neat solution to this problem. And
this has something to do with gcc, so I still posted it here.
First of all, $SYSROOT/etc/ld.so.conf solution maybe an overkill, so I
think we can ignore it for now.
The finding is if ld is invoked with --sysroot option and if the dir
specified by -L has a leading "=", for example:
--sysroot=/usr/mipsel-unknown-linux-gnu -L=/usr/qt/3/lib -L/usr/lib -lqt-mt
Then when ld will looking for libqt-mt.so in
/usr/mipsel-unknown-linux-gnu/usr/qt/3/lib, instead of /usr/qt/3/lib.
Thus problem solved.
So I am wondering if there is a way to detect whether gcc is doing cross
compile. If so, when cross compiling is detected, collect2 search for
-L option in COLLECT_GCC_OPTIONS, and insert a "=" between -L and the
actual path.
I think this way is better than the $SYSROOT/etc/ld.so.conf way.
> On Tue, Mar 06, 2007 at 02:05:06AM +0800, Zhang Le wrote:
> > I have used "strace -f" to check where linker looked for -lqt-mt. From
> > what I have observed, it seems that ld didn't use
> > $SYSROOT/etc/ld.so.conf.
>
> Well, it's supposed to, so I suggest you check what's happened in ld.
I found a clue which may lead to a neat solution to this problem. And
this has something to do with gcc, so I still posted it here.
First of all, $SYSROOT/etc/ld.so.conf solution maybe an overkill, so I
think we can ignore it for now.
The finding is if ld is invoked with --sysroot option and if the dir
specified by -L has a leading "=", for example:
--sysroot=/usr/mipsel-unknown-linux-gnu -L=/usr/qt/3/lib -L/usr/lib -lqt-mt
Then when ld will looking for libqt-mt.so in
/usr/mipsel-unknown-linux-gnu/usr/qt/3/lib, instead of /usr/qt/3/lib.
Thus problem solved.
So I am wondering if there is a way to detect whether gcc is doing cross
compile. If so, when cross compiling is detected, collect2 search for
-L option in COLLECT_GCC_OPTIONS, and insert a "=" between -L and the
actual path.
I think this way is better than the $SYSROOT/etc/ld.so.conf way.
--
Zhang Le, Robert
Linux Engineer/Trainer
http://zhllg.blogspot.com
http://zh.gentoo-wiki.com
http://savannah.nongnu.org/projects/pgubook
http://groups.google.com/group/gentoo-china
http://groups.google.com/group/szlug
Comments