This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cross Compiler and Linker for Linux



Dave Jarvis wrote:
> 
> Hi,
> 
> After the 19th compile, inching closer and closer to the a development
> environment on Linux for Solaris 2.8, I've come to a kicker.  While
> trying to make this, I've been documenting everything I've done.  This
> includes: full commands, order of commands, initial directory setup,
> software packages, etc.  Section 4.0 contains the resulting error message.
> 
> If someone can shed some light on what's going wrong -- better would be
> the commands I need to type and where they fit as far as order is
> concerned -- I'd really appreciate it.  I'm guessing I need newlib, but
> I was under the impression it would work with the core C/C++ libraries
> that come with gcc 3.3.  I'm also guessing that I need to configure GCC,
> then configure and install newlib, then come back and install GCC.

I have built Linux -> Solaris and Linux -> Cygwin cross-toolsets.
The trick is that you need to grab the native libraries and .h files
for the target OS.  For Solaris, I recall having tar'ed up the
contents of /usr/lib and /usr/include.  The contents of /usr/include 
need to be placed at ${prefix}/sys-include. The contents of /usr/lib 
need to be at ${prefix}/sparc-solaris.  (I used sparc-solaris) as my
target name.

RTEMS source distributions include RPM specs for these toolsets.  At
least
some RTEMS developers use Linux to Canadian cross RTEMS toolsets for
Cygwin and Solaris developers.  Email me if you want the spec files.
 
> Thanks in advance for any assitance,
> Dave
> 
> -----------------------------------------------------------
> 1.0 Goal
> -----------------------------------------------------------
> To build a series of cross-compilers and linkers on an i686 Mandrake
> Linux box.  Targets include: SunOS 5.8 (sparc), HP-UX 11i (PA-Risc 1 and
> 2), and AIX 5.2 (RS/6K).
> 
> -----------------------------------------------------------
> 2.0 Attempt Details
> -----------------------------------------------------------
> Target: Solaris 2.8 sparc
> Host  : Linux Mandrake i686
> 
> -----------------------------------------------------------
> 2.1 Definitions
> -----------------------------------------------------------
> HOST = Machine on which you want to use for compiling programs.
> Defaults to the current machine.
> TARGET = Machine architecture (OS + CPU) on which the compiled programs
> should execute.
> 
> -----------------------------------------------------------
> 2.2 Libraries and Header Files
> -----------------------------------------------------------
> 1) mkdir /usr/local/cc/sparc-sun-sunos5.8
> 2) Copy /usr/lib from TARGET machine to HOST machine at:
>           /usr/local/cc/sparc-sun-sunos5.8
> 3) Copy /usr/include from TARGET machine to HOST machine at:
>           /usr/local/cc/sparc-sun-sunos5.8
> 
> -----------------------------------------------------------
> 2.3 Software Packages
> -----------------------------------------------------------
> 1) binutils v2.13.2.1
> 2) gcc v3.3
> 
> -----------------------------------------------------------
> 3.0 Software Preparation
> -----------------------------------------------------------
> 1) mkdir /usr/local/cc
> 2) cd /usr/local/cc
> 3) Download binutils from GNU mirror
> 4) Download gcc from GNU mirror (includes libraries)
> 5) tar jxf binutils-2.13.2.1.tar.bz2
> 6) tar jxf gcc-3.3.tar.bz2
> 7) mkdir build-binutils
> 8) mkdir build-gcc
> 
> -----------------------------------------------------------
> 3.1 Compilation and Installation
> -----------------------------------------------------------
> 1) cd build-binutils
> 2) ../binutils-2.13.2.1/configure \
>    --prefix=/usr/local/cc/sparc-sun-sunos5.8 \
>    --target=sparc-sun-solaris2 --with-libs=../sparc-sun-sunos5.8/lib \
>    --with-headers=../sparc-sun-sunos5.8/include
> 3) make && make install
> 
> 4) cd ../build-gcc
> 5) export PATH=/usr/local/cc/sparc-sun-sunos5.8/bin:$PATH
> 6) ../gcc-3.3/configure --prefix=/usr/local/cc/sparc-sun-sunos5.8 \
>    --target=sparc-sun-solaris2 \
>    --with-headers=../sparc-sun-sunos5.8/include \
>    --with-libs=../sparc-sun-sunos5.8/lib --with-gnu-as --with-gnu-ld
> 7) make && make install
> 
> (Note: Some documentation says to change the path AFTER configuring gcc,
> but that won't work because the configuration script won't find the
> binaries to complete the compile.  This is an easy mistake to make.)
> 
> -----------------------------------------------------------
> 4.0 Result
> -----------------------------------------------------------
> The compilation fails because it cannot find some header files.  The
> error follows.
> 
> In file included from
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/in
> clude/bits/locale_facets.tcc:41, from
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/in
> clude/locale:47, from
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/in
> clude/bits/ostream.tcc:37, from
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/in
> clude/ostream:535, from
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/in
> clude/bitset:58, from ../../../../gcc-3.3/libstdc++-v3/src/bitset.cc:43:
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/include/cmath:107:
> error: `acosf' not declared
> ... snip ...
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/include/cmath:556:
> error: `tanf' undeclared in namespace `__gnu_cxx::__c99_binding'
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/include/cmath:
> In function `float std::tanh(float)':
> /usr/local/cc/build-gcc/sparc-sun-solaris2/libstdc++-v3/include/cmath:574:
> error: `tanhf' undeclared in namespace `__gnu_cxx::__c99_binding'

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


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