This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: question about sysroot and Windows->Linux cross ld
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: binutils at sourceware dot org, Douglas Rupp <rupp at adacore dot com>, Erwan Le Guillou <leguillou at adacore dot com>
- Date: Wed, 17 Jan 2018 15:48:28 -0500 (EST)
- Subject: Re: question about sysroot and Windows->Linux cross ld
- Authentication-results: sourceware.org; auth=none
- References: <20180117175405.6elswkryoba5yq3d@adacore.com>
On Wed, 17 Jan 2018, Joel Brobecker wrote:
> Hello,
>
> We are working on a a Windows-to-Linux compiler, and we noticed
> something with respect to shared library linking which looks like
> it might be a bug, and we'd like to have your opinion before we go
> too deep into trying to solve this.
>
> We created a sysroot on the host by copying the various headers
> and libraries from our target. We then passed that sysroot to
> the compiler using --sysroot=/path/to/sysroot.
>
> A cross-compiler hosted on GNU/Linux is able to link a program fine,
> but the same cross-compiler hosted on Windows fails to link with
> the following error:
>
> | c:/[...]/gcc/install/bin/../libexec/gcc/powerpc-generic-linux-gnu/6.4.1/ld.exe: cannot find //lib/libc.so.6
> | c:/[...]/gcc/install/bin/../libexec/gcc/powerpc-generic-linux-gnu/6.4.1/ld.exe: cannot find //lib/libc_nonshared.a
> | c:/[...]/gcc/install/bin/../libexec/gcc/powerpc-generic-linux-gnu/6.4.1/ld.exe: cannot find //lib/ld.so.1
> | collect2.exe: error: ld returned 1 exit status
> | GROUP ( //lib/libc.so.6 //lib/libc_nonshared.a AS_NEEDED ( //lib/ld.so.1 ) )
> Any opinion on this? We'll investigate the problem, but it would
> help us if we knew that we're trying to achieve the correct result :).
I suggest having a look at the "#if defined (_WIN32) &&
!defined (__CYGWIN32__) *slash = ..." thing in ldfile.c.
Obviously, maybe also find out where the "//" comes from. I'm
guessing that's supposed to be "/" (maybe somewhere, a
"sysroot=/" vs. "sysroot=" foulup) and may be handled
differently in "Windows" compared to "Linux" when found at the
start or inside (prepended by the sysroot) a path.
brgds, H-P