This is the mail archive of the crossgcc@sources.redhat.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: Building cross GCC problem part2


Pierre-Yves Taczynski wrote:
> 
> Hi everyone,
> first of all I'd like to thank all the persons who replied to my last
> post. It was very hepful.

 Thanks from me too, for giving some sanity to this problem...
Unfortunately I too already had written a reply with hints to the
GCC manual and the importance of using only the target stuff, not
anything else someone else has found useful for some other target...
Perhaps it wasn't quite polite and not sending it was better...

 BTW, the PDF and PS versions of the RMS "Using and Porting..." are
available in many sites, the RedHat's EDK distribution being one :
  www.redhat.com/products/edk
It has also the HTML versions of the manuals (not only for GCC but
also for 'as', 'ld', 'gdb', 'binutils', Insight, SourceNavigator...)
Unfortunately the GNU manuals are a little old...

 And of course all the big bookstores have the manuals as printed
books (but in Finland I have seen them only in one bookstore in our
capital city...)

> So I did copy the headers and libs from solaris and use the following
> command:
> [root@wumpscut build-gcc]# ../gcc-2.95.2/configure --target=$target
> --prefix=$prefix --with-libs=/cross/sparc-sun-solaris2/lib
> --with-headers=/cross/sparc-sun-solaris2/include -v
> where target= sparc-sun-solaris2 and prefix=/ccompiler.

 The '--with-libs=...' and '--with-headers=...' were aimed for enabling
any third-party libs and headers to be found (at least I have this thought).
The standard headers and libs should be found without them under the
'tooldir', $prefix/$target, in your case '/ccompiler/sparc-sun-solaris2'. 

 Anyway when you copied the libs and headers, their symlinks were for the
native installation on a Solaris2-machine and you should fix them for the
cross-compiler.

> Unfortunately I get this error (Iwas down on my knees):
> 
> make[2]: Entering directory
> `/usr/srccross/build-gcc/sparc-sun-solaris2.6/libiberty'
> make[2]: *** No targets specified and no makefile found.  Stop.
>
> What's the matter with all this, is it really possible to build a
> croos-gcc?

 The default linking tries to produce executables which use the shared
libs. For Solaris2 the 'libc.so' isn't enough, but the dynamic linker
file or something, 'libdl.so.1', must be found too. If you look inside
the 'libc.so', you will see the NEEDED shared libs which it needs :

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

 The native compiler finds this automatically from the '/usr/lib', but
you must tell the cross-linker where it is. This happens in the 'specs'
file using the linker option '-rpath-link' :

----------------------- clip -------------------------------------------
*endfile:
crtend.o%s crtn.o%s

*link:
-m elf32_sparc %{h*} %{v:-V} %{b} %{Wl,*:%*} %{static:-dn -Bstatic}
 %{!static:-rpath-link e:/usr/local/sparc-solaris2.7/lib}  <-----------
 %{shared:-G -dy %{!mimpure-text:-z text}} %{symbolic:-Bsymbolic -G -dy -z text}
 %{G:-G} %{YP,*} %{R*}
 %{compat-bsd:
  %{!YP,*:%{p:-Y P,/usr/local/sparc-solaris2.7/ucblib}
   %{pg:-Y P,/usr/local/sparc-solaris2.7/ucblib}
   %{!p:%{!pg:-Y P,/usr/local/sparc-solaris2.7/ucblib}}}
 -R /usr/local/sparc-solaris2.7/ucblib} %{Qy:} %{!Qn:-Qy}

*lib:

----------------------- clip -------------------------------------------

 The whole 'link_spec' is just in one line (here wrapped). As you can
see, there are other issues too, like those 'compat-bsd' search paths.
The 'specs' is in the 'gcc' subdir when you build and you must edit it.

 The reason for the error is that the compiler couldn't 'create executables',
ie. linking didn't work. The build procedure checks this before trying
to build 'libiberty'.

 If you look at the 'sparc-sun-solaris2/libiberty', you'll find the
'config.log' and there something about the missing 'libdl.so.1'...
So it couldn't configure and build in 'libiberty'.

 It is quite possible to make Solaris2 target cross-tools, even for the
Windows host (just see the 'e:/...' in my examples... Of course building
everything under Linux is recommended (with Linux-to-Win32 cross-tools).

> May I also configure binutils with the following options:
> --with-libs=/cross/sparc-sun-solaris2/lib
> --with-headers=/cross/sparc-sun-solaris2/include  ?

 No

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]