i386-pc-solaris2.7 to sparc-pc-solaris2.7 cross compiler
Kai Ruottu
karuottu@freenet.hut.fi
Tue Jun 22 05:09:00 GMT 1999
My 'recycled text' and new message said:
> Ok, something was forgotten from the suggestions... You probably need to copy
> the 'libdl.so.1' to '/usr/local/sparc-solaris25/lib' and add the option
> --rpath /usr/local/sparc-solaris25/lib
> to your 'specs' file in:
> /usr/local/lib/gcc-lib/sparc-solaris25/egcs-2.91.57
>
> The LINK_SPEC is after the line '*link:'. Adding this to the start of the spec
> like:
> %{h*} %{v:-V} %{!static:--rpath /usr/local/sparc-solaris25/lib} ...
> will not mix the '-static' (perhaps it doesn't care...)
>
> I got quite the same kind of errors when trying my 'cygwin32-to-linux-libc6'
> cross-compiler the first time. But it was the 'ld-linux.so.2' which was not
> found automatically without the '--rpath ...'
>
> Cheers, Kai
> ------------------------- clip --------------------
>
> As Terry Smith wrote, the dynamic linker file (libdl.so.1, ld-linux.so.*,...)
> in all those SVR4, Linux, BSDI, FreeBSD etc. target systems with shared libs,
> must be included with the libraries. And if it doesn't find it automagically,
> using the '--rpath ....' may be necessary...
I built a Mingw32-hosted and Linux-libc6-targeted (i586-linux-gnu)
cross-toolset from the egcs-19990616 (19990615?) snapshot and found that the
'--dynamic-linker xxxx' and '-rpath yyyyy' (or as the following says
'-rpath-link yyyyy') weren't quite clear to me either... And the whether '-' or
'--' in the option were also wrong... So some clarification here:
Ok, my conclusions were (the Linux-libc6 case as the model) :
The '--dynamic-linker /lib/ld-linux.so.2' says what is needed during the
runtime. This info goes to the executable and the original in '*link:' spec
for a native compiler is right... (unless there is a '-dynamic-linker' instead
of '--dynamic-linker'...)
The '-rpath-link //D/usr/local/i586-linux-gnu/lib' ('D' is the disk name),
must be added to the '*link:' spec to tell where all those '.so's are during
link time. Cygwin probably recognises the mount of '/usr' and no disk name are
needed there, but Mingw32 needs the disk name in the pathname. Binutils-2.9.1
seems to understand the '//D' as the disk name, but using a newer linker (with
many target emulations) from a binutils-snapshots didn't recognise it...
Using '-rpath' will put the directory name to the search list (for '.so's)
at runtime and also at link time and the addition will be seen in the
executable with 'objdump -p'.
-rpath PATH Set runtime shared library search path
-rpath-link PATH Set link time shared library search path
So here is my final LINK_SPEC for my 'i586-linux-gnu' target GCC :
*link:
-m elf_i386 %{shared:-shared} %{!shared: %{!ibcs: %{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:--dynamic-linker /lib/ld-linux.so.2 \
-rpath-link //E/usr/local/i586-linux-gnu/lib}} %{static:-static}}}
The backslashes with line wraps are just for clarity, the whole '*link:' spec
is in a single line in 'specs'.
For the Linux-host / Solaris2 target, the '--dynamic-linker libdl.so.1' and
the equivalent '-rpath <something>' are needed. No struggling with disk names
either...
Cheers, Kai
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.
More information about the crossgcc
mailing list