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

See the CrossGCC FAQ for lots more infromation.


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

Re: Linux x86 to Solaris Sparc Cross Compiler


Alex Smith wrote:
 
> Ok, I've got a solaris-sparc2.5.1 cross compiler, but I have these last
> remaining errors when I link a complex program.
> 
> tdir.o(.text+0xec4): undefined reference to `dlerror'netdir.o(.text+0xf34): undefined reference to `dgettext'
> netdir.o(.text+0xf58): undefined reference to `dgettext'
> /usr/local/2.95.2/sparc-sun-solaris2.5.1/lib/libnsl.a(netdir.o)(.text+0x1014): more undefined references to `dgettext' follow
> /usr/local/2.95.2/sparc-sun-solaris2.5.1/lib/libc.a(nss_deffinder.o): In function `SO_per_src_lookup':
> nss_deffinder.o(.text+0x74): undefined reference to `dlopen'
> nss_deffinder.o(.text+0xa4): undefined reference to `dlsym'
> nss_deffinder.o(.text+0xb8): undefined reference to `dlclose'
> /usr/local/2.95.2/sparc-sun-solaris2.5.1/lib/libc.a(nss_deffinder.o): In function `SO_per_src_delete':
> nss_deffinder.o(.text+0xf4): undefined reference to `dlclose'
> 
> I found a thread a while back telling me about libdl.so*.  So I grabed it and
> put it in my source libs directory.

 I have only Solaris2.7 libs, but the 'dgettext' is in 'libc.so' :

E:\usr\local\sparc-solaris2.7\lib>..\bin\nm libc.so | grep dgettext
00076ddc T _dgettext
00076ddc W dgettext

 and the dynamic-linking routines in 'libdl.so' :

E:\usr\local\sparc-solaris2.7\lib>..\bin\nm libdl.so | grep dl
00000894 T _dladdr
00000884 T _dlclose
0000089c T _dldump
0000088c T _dlerror
0000085c T _dlinfo
00000864 t _dlmap
0000086c T _dlmopen
00000874 T _dlopen
0000087c T _dlsym
00000894 W dladdr
00000884 W dlclose
0000089c W dldump
0000088c W dlerror
0000085c W dlinfo
00000864 t dlmap
0000086c W dlmopen
00000874 W dlopen
0000087c W dlsym

 The 'libc.so' is linked to 'libdl.so.1' (ie. it needs symbols from it)
:

E:\usr\local\sparc-solaris2.7\lib>..\bin\objdump -p libc.so

libc.so:     file format elf32-sparc

Program Header:
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**16
         filesz 0x000a2110 memsz 0x000a2110 flags r-x
    LOAD off    0x000a2110 vaddr 0x000b2110 paddr 0x00000000 align 2**16
         filesz 0x000062b4 memsz 0x00007c08 flags rwx
 DYNAMIC off    0x000a452c vaddr 0x000b452c paddr 0x00000000 align 2**0
         filesz 0x000000c0 memsz 0x00000000 flags rwx

Dynamic Section:
  NEEDED      libdl.so.1	<--------------- !!
  INIT        0x969f0
  FINI        0x96a30
  SONAME      libc.so.1

 A native linker finds the 'libdl.so.1' automatically, but a
cross-compiler
needs the '-rpath-link' to point to the library directory. Or you can
link
always against 'libdl.so' (if not producing statically linked
executables).
So please add a '-ldl' after the '-lc' in 'specs', so that the end of
the
'*lib:' spec would be something like :

        ... %{!pthreads: %{threads: -lthread}} -lc %{!static: -ldl}}}

 Or add the '-rpath-link <your_solaris2.5_libdir>' into the '*link:'
spec.

> Any ideas?

 Using the '-v -Wl,-verbose' in the GCC command line with some compile &
link
experiments would show the given options to the linker and all the tries
and
errors while linking.

Cheers, Kai



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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