Setting up a cross-compile
Dave Williss
dwilliss@microimages.com
Tue Jun 5 22:04:00 GMT 2007
I'm still having trouble building a cross compiler. Part way through
the build, it gets this error:
/usr/local/bin/sparc-sun-solaris2.9-ld:libgcc/./libgcc.map: file format
not recognized; treating as linker script
/usr/local/bin/sparc-sun-solaris2.9-ld:libgcc/./libgcc.map:1: syntax error
collect2: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[2]: *** [stmp-multilib] Error 2
make[1]: *** [all-gcc] Error 2
I'm building on Mac OS 10.4 and targeting sparc-sun-solaris2.9
I built and configured binutils 2.17 with --target=sparc-sun-solaris2.9
--with-sysroot=/usr/local/xcompile/sun
/usr/local/xcompile/sun contains a copy of the Sun's /usr/lib,
/usr/include and some /usr/local things.
I configured gcc with the following configure options
--target=sparc-sun-solaris2.9
--with-sysroot=/usr/local/xcompile/sun
--prefix=/usr/local/xcompile
--enable-languages=c,c++
--x-includes=/usr/local/xcompile/sun/usr/openwin/include
--x-libraries=/usr/local/xcompile/sun/usr/openwin/lib
--disable-libmudflap
--disable-libgfortran
--disable-libjobj
--disable-libada
Are there instructions on how to do this somewhere?
David Daney wrote:
> Dave Williss wrote:
>> I'm sure there must be documentation somewhere on how to do this, but
>> I can't find it.
>>
>> I want to setup a Linux or Mac OS machine to compile and link
>> programs for a Sun SPARC target.
>> I know that gcc can be built to cross-compile for another platform,
>> but apart from specifying the target architecture, I don't know what
>> all I need to do.
>>
>> One thing that I'm sure of is that when this gcc is called, I need it
>> to ignore /usr/include and /usr/lib and pull things from some other
>> directory where I will have to have copied the SPARC versions. Is
>> there a configuration option to tell it where those will be, or do I
>> have to somehow override them at runtime?
>>
> You put all you headers and libraries in some directory that will be
> called the 'sysroot', then you tell GCC's configure script where they
> are. For my mipsel-linux cross compiler I configure like this:
>
> $ ../gcc-4_2-branch/configure --target=mipsel-linux
> --with-sysroot=/usr/local/mipsel-linux-test
> --prefix=/usr/local/mipsel-linux-test --with-arch=mips32
> --with-float=soft --disable-libmudflap --disable-tls
> --enable-languages=c,c++
>
> If you also need to create a suitable libc and header files I suggest
> you look at the crosstool project.
>
> David Daney
>
>
>
>
More information about the Gcc-help
mailing list