public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* problems building cross-compiler for sparc-sun-solaris on x86
@ 2002-04-08 11:34 Per Fransson
  0 siblings, 0 replies; 6+ messages in thread
From: Per Fransson @ 2002-04-08 11:34 UTC (permalink / raw)
  To: gcc

Hi,

I posted this on the gcc-help list a couple of days ago but got no 
response, thought maybe I'd have better luck here:

I'm trying to build a cross compiler for sparc-sun-solaris2.8 on an x86 
running linux.

I've managed to build binutils for sparc and put it into foo/myGCC/

(I've also put symbolic links to the files in /foo/myGCC/  in the same 
directory without the 'sparc-sun-solaris'-prefix,
i e there is a link ' foo/myGCC/bin/as -> 
foo/myGCC/bin/sparc-sun-solaris2.8-as' and the same for addr2line, ar, 
c++filt, gasp, ld, nm, objcopy, objdump, ranlib, readelf and size. I've 
no idea if this helps anything, but it shouldn't hurt, right?)


I've tried building gcc-3.0.4 like this:
% cd foo
% tar xvfz gcc-3.0.4.tar.gz
% mkdir build-gcc
% cd build-gcc
% ../gcc-3.0.4/configure --prefix=foo/myGCC/ 
--target=sparc-sun-solaris2.8 -v
...
...
...
[no problems]
% make all install
...
...
...
...

foo/build-gcc/gcc/xgcc -Bfoo/build-gcc/gcc/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/bin/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/lib/ -isystem 
foo/myGCC//sparc-sun-solaris2.8/include  -c -o crt1.o -x 
assembler-with-cpp ../../gcc-3.0.4/gcc/config/sparc/sol2-c1.asm
foo/build-gcc/gcc/xgcc -Bfoo/build-gcc/gcc/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/bin/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/lib/ -isystem 
foo/myGCC//sparc-sun-solaris2.8/include  -c -o crti.o -x 
assembler-with-cpp ../../gcc-3.0.4/gcc/config/sparc/sol2-ci.asm
foo/build-gcc/gcc/xgcc -Bfoo/build-gcc/gcc/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/bin/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/lib/ -isystem 
foo/myGCC//sparc-sun-solaris2.8/include  -c -o crtn.o -x 
assembler-with-cpp ../../gcc-3.0.4/gcc/config/sparc/sol2-cn.asm
foo/build-gcc/gcc/xgcc -Bfoo/build-gcc/gcc/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/bin/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/lib/ -isystem 
foo/myGCC//sparc-sun-solaris2.8/include  -c -DGCRT1 -o gcrt1.o -x 
assembler-with-cpp ../../gcc-3.0.4/gcc/config/sparc/sol2-c1.asm
foo/build-gcc/gcc/xgcc -Bfoo/build-gcc/gcc/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/bin/ 
-Bfoo/myGCC//sparc-sun-solaris2.8/lib/ -isystem 
foo/myGCC//sparc-sun-solaris2.8/include -DCROSS_COMPILE -DIN_GCC    -W 
-Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem 
./include  -I. -I. -I../../gcc-3.0.4/gcc -I../../gcc-3.0.4/gcc/. 
-I../../gcc-3.0.4/gcc/config -I../../gcc-3.0.4/gcc/../include  \
    -c ../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c -o gmon.o
In file included from ../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:36:
../../gcc-3.0.4/gcc/system.h:50:19: stdio.h: No such file or directory
In file included from ../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:36:
../../gcc-3.0.4/gcc/system.h:92:23: sys/types.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:94:19: errno.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:101:21: string.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:102:22: strings.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:114:21: stdlib.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:123:21: unistd.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:127:24: sys/param.h: No such file or directory
In file included from ../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:36:
../../gcc-3.0.4/gcc/system.h:179:23: sys/time.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:180:19: time.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:192:20: fcntl.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:230:22: sys/wait.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:301:20: malloc.h: No such file or directory
../../gcc-3.0.4/gcc/system.h:385:23: sys/stat.h: No such file or directory
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c: In function `monstartup':
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:112: warning: implicit 
declaration of function `sbrk'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:112: warning: assignment 
makes pointer from integer without a cast
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:114: warning: implicit 
declaration of function `write'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:136: warning: assignment 
makes pointer from integer without a cast
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c: In function `_mcleanup':
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:181: `PATH_MAX' undeclared 
(first use in this function)
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:181: (Each undeclared 
identifier is reported only once
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:181: for each function it 
appears in.)
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:186: warning: implicit 
declaration of function `getenv'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:186: warning: assignment 
makes pointer from integer without a cast
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:192: warning: implicit 
declaration of function `strrchr'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:198: warning: implicit 
declaration of function `sprintf'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:198: warning: implicit 
declaration of function `getpid'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:204: warning: implicit 
declaration of function `creat'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:206: warning: implicit 
declaration of function `perror'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:231: warning: implicit 
declaration of function `close'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:181: warning: unused 
variable `buf'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c: In function 
`internal_mcount':
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:299: warning: implicit 
declaration of function `atexit'
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c: In function `moncontrol':
../../gcc-3.0.4/gcc/config/sparc/gmon-sol2.c:413: warning: implicit 
declaration of function `profil'
make[1]: *** [gmon.o] Error 1
make[1]: Leaving directory `foo/build-gcc/gcc'
make: *** [all-gcc] Error 2

%

Any ideas?

Thanks in advance.

/Per



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: problems building cross-compiler for sparc-sun-solaris on x86
  2002-04-08 14:17       ` Joel Sherrill
@ 2002-04-08 15:09         ` H . J . Lu
  0 siblings, 0 replies; 6+ messages in thread
From: H . J . Lu @ 2002-04-08 15:09 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: Rupert Wood, 'Per Fransson', gcc

On Mon, Apr 08, 2002 at 04:11:00PM -0500, Joel Sherrill wrote:
> "H . J . Lu" wrote:
> > 
> > On Mon, Apr 08, 2002 at 02:11:35PM -0500, Joel Sherrill wrote:
> > > In the past I have managed to get a cross binutils and gcc built
> > > like this but some of the programs I have tried to build end
> > > up not linking because they can't find some of the dynamic loading
> > > symbols.  Has anyone extensively used a GNU/Linux->Solaris Sparc
> > > cross compiler?
> > 
> > How extensive is "extensively?" I built a cross compiler hosted
> > on Solaris Sparc to Linux/PPC on Linux/x86. 
> 
> I mean that it can be used to canadian cross compile binutils,
> gcc, and gdb.  I managed to cross build binutils but gcc couldn't
> link some of the programs because they wanted to be dynamically
> linked.

I did binutils and gcc. I didn't build gdb. That was for Solaris 2.5
or 2.6.


H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: problems building cross-compiler for sparc-sun-solaris on x86
  2002-04-08 12:30     ` H . J . Lu
@ 2002-04-08 14:17       ` Joel Sherrill
  2002-04-08 15:09         ` H . J . Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Sherrill @ 2002-04-08 14:17 UTC (permalink / raw)
  To: H . J . Lu; +Cc: Rupert Wood, 'Per Fransson', gcc

"H . J . Lu" wrote:
> 
> On Mon, Apr 08, 2002 at 02:11:35PM -0500, Joel Sherrill wrote:
> > In the past I have managed to get a cross binutils and gcc built
> > like this but some of the programs I have tried to build end
> > up not linking because they can't find some of the dynamic loading
> > symbols.  Has anyone extensively used a GNU/Linux->Solaris Sparc
> > cross compiler?
> 
> How extensive is "extensively?" I built a cross compiler hosted
> on Solaris Sparc to Linux/PPC on Linux/x86. 

I mean that it can be used to canadian cross compile binutils,
gcc, and gdb.  I managed to cross build binutils but gcc couldn't
link some of the programs because they wanted to be dynamically
linked.

> BTW, I don't think
> you can build a cross compiler to Solaris without some changes
> since gcc has /usr/xxx/xxx hardcoded for Solaris. I posted a patch
> a long time ago. You may find it in the gcc mailing list archive.

If this is still a problem, I didn't run into it.  I used
--with-gnu-as and --with-gnu-ld which might explain the 
dynamic linking missing symbols.  Does binutils properly
support dynamic linking on Solaris?  I recall problems in the past.
 
> H.J.

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: problems building cross-compiler for sparc-sun-solaris on x86
  2002-04-08 12:22   ` Joel Sherrill
@ 2002-04-08 12:30     ` H . J . Lu
  2002-04-08 14:17       ` Joel Sherrill
  0 siblings, 1 reply; 6+ messages in thread
From: H . J . Lu @ 2002-04-08 12:30 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: Rupert Wood, 'Per Fransson', gcc

On Mon, Apr 08, 2002 at 02:11:35PM -0500, Joel Sherrill wrote:
> In the past I have managed to get a cross binutils and gcc built
> like this but some of the programs I have tried to build end
> up not linking because they can't find some of the dynamic loading
> symbols.  Has anyone extensively used a GNU/Linux->Solaris Sparc 
> cross compiler?

How extensive is "extensively?" I built a cross compiler hosted
on Solaris Sparc to Linux/PPC on Linux/x86. BTW, I don't think
you can build a cross compiler to Solaris without some changes
since gcc has /usr/xxx/xxx hardcoded for Solaris. I posted a patch
a long time ago. You may find it in the gcc mailing list archive.


H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: problems building cross-compiler for sparc-sun-solaris on x86
  2002-04-08 12:10 ` Rupert Wood
@ 2002-04-08 12:22   ` Joel Sherrill
  2002-04-08 12:30     ` H . J . Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Sherrill @ 2002-04-08 12:22 UTC (permalink / raw)
  To: Rupert Wood; +Cc: 'Per Fransson', gcc



Rupert Wood wrote:
> 
> Per Fransson wrote:
> 
> > I'm trying to build a cross compiler for sparc-sun-solaris2.8
> > on an x86 running linux.
> 
> To build a cross compiler, you also need include files and the C library
> from your target system in addition to GCC and binutils.
> 
> Create directories under your GCC install prefix
> 
>     sparc-sun-solaris2.8/sys-include
>     sparc-sun-solaris2.8/lib
> 
> and copy the entire /usr/include tree from a solaris 2.8 machine to the
> first, and the contents of /lib (but you don't need the subdirectories)
> to the second. Then retry the cross compile, adding '--without-newlib'
> to your configure line.
> 
> Alternatively, you can put the headers and libraries somewhere else and
> ask GCC to install them as part of the configure
> 
>     --with-headers=<wherever>
>     --with-libs=<wherever>
> 
> and, in this case, --without-newlib is assumed.

In the past I have managed to get a cross binutils and gcc built
like this but some of the programs I have tried to build end
up not linking because they can't find some of the dynamic loading
symbols.  Has anyone extensively used a GNU/Linux->Solaris Sparc 
cross compiler?

FWIW my goal is canadian cross builds of other cross toolsets. For
example, I want to build on GNU/Linux x86 a cross toolset for 
m68k-elf that executes on Solaris/Sparc.

> There's also a 'CrossGCC FAQ' at http://crossgcc.billgatliff.com/ in
> case that helps.
> 
> Rup.

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: problems building cross-compiler for sparc-sun-solaris on x86
       [not found] <616BE6A276E3714788D2AC35C40CD18D5917C3@whale.softwire.co.uk>
@ 2002-04-08 12:10 ` Rupert Wood
  2002-04-08 12:22   ` Joel Sherrill
  0 siblings, 1 reply; 6+ messages in thread
From: Rupert Wood @ 2002-04-08 12:10 UTC (permalink / raw)
  To: 'Per Fransson'; +Cc: gcc

Per Fransson wrote:

> I'm trying to build a cross compiler for sparc-sun-solaris2.8 
> on an x86 running linux.

To build a cross compiler, you also need include files and the C library
from your target system in addition to GCC and binutils.

Create directories under your GCC install prefix

    sparc-sun-solaris2.8/sys-include
    sparc-sun-solaris2.8/lib

and copy the entire /usr/include tree from a solaris 2.8 machine to the
first, and the contents of /lib (but you don't need the subdirectories)
to the second. Then retry the cross compile, adding '--without-newlib'
to your configure line.

Alternatively, you can put the headers and libraries somewhere else and
ask GCC to install them as part of the configure

    --with-headers=<wherever>
    --with-libs=<wherever>

and, in this case, --without-newlib is assumed.

There's also a 'CrossGCC FAQ' at http://crossgcc.billgatliff.com/ in
case that helps.

Rup.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-04-08 21:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-08 11:34 problems building cross-compiler for sparc-sun-solaris on x86 Per Fransson
     [not found] <616BE6A276E3714788D2AC35C40CD18D5917C3@whale.softwire.co.uk>
2002-04-08 12:10 ` Rupert Wood
2002-04-08 12:22   ` Joel Sherrill
2002-04-08 12:30     ` H . J . Lu
2002-04-08 14:17       ` Joel Sherrill
2002-04-08 15:09         ` H . J . Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).