This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: i386-pc-solaris2.7 to sparc-pc-solaris2.7 cross compiler


> > > A quick 'hello world' will build and statically link fine. Anything a bit
> > > more complicated just doesn't link and complains about dlopen() and
> > > dlclose() being missing.
> > Copy the sparc solaris libdl.so.* library to your host's
> > $prefix/TARGET/lib library. ld should pick them up automatically and
> > link them in. It does on my i686-pc-gnu-linux hosted sparc-solaris
> > cross-compiler.
> I have .a and .so files in $prefix/TARGET/lib and egcs only seems to want
> to link in .a files. 

 Here is some 'recycled' info to the solaris2 and linux-gnu target makers:

----------- clip ----------------------
On Tue, 01 Dec 1998 14:43:14 -0500, "Sheldon E. Newhouse" <sen@math.msu.edu>
wrote:

> Following Kai's suggestions, I got to the point of being able to generate
> object files which can be linked on my sparc.
>
>But, I am having link step problems on the linux box.
>
>Here is what happens with various versions of the gcc code on hello.c
>
>[sen@pokie Sparc]$ sparc-solaris25-gcc hello.c
>/usr/local/sparc-solaris25/bin/ld: warning: libdl.so.1, needed by
>/usr/local/sparc-solaris25/lib/libc.so.1, not found (try using --rpath)
>/usr/local/sparc-solaris25/lib/libc.so.1: undefined reference to `_dlclose'
>/usr/local/sparc-solaris25/lib/libc.so.1: undefined reference to `_dlsym'
<clip>
>[sen@pokie Sparc]$ /usr/local/sparc-solaris25/bin/ld --rpath
>/usr/local/sparc-solaris25/lib hello.o /usr/local/sparc-solaris25/bin/ld:
>warning: cannot find entry symbol _start; defaulting to 00010074 hello.o: In
>function `main': hello.o(.text+0xc): undefined reference to `printf'
>
>Any further ideas?

 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...

 BTW, using the '-verbose' option for linker ('-Wl,-verbose' in GCC command)
may solve some problems...

Regards, 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]