Mips cross compiler for cygwin

Bill Gatliff bgat@billgatliff.com
Wed Mar 17 19:52:00 GMT 2004


Steve:


In the --prefix directory, the installation process creates a directory 
called sys-include.  You want to nuke that directory after installation, 
because sometimes I have observed that gcc will get (erroneous) headers 
from _that_ directory instead of the usual place.  Haven't tracked down 
the root problem.

All GNU toolchains should nuke sys-include during the build process, as 
far as I can tell.


b.g.


Steve Sanders wrote:

>Bill,
>
>Could you elaborate about nuking sys-include after building the bootstrap
>loader? I have been trying to build a cross tool for arm7tdmi with some
>success using your article as a starting point. Is this an appropriate thing
>to do for building the arm tool chain?
>
>Steve
>
>
>-----Original Message-----
>From: crossgcc-owner@sources.redhat.com
>[mailto:crossgcc-owner@sources.redhat.com]On Behalf Of Bill Gatliff
>Sent: Tuesday, March 16, 2004 1:53 PM
>To: Harry Kaes
>Cc: crossgcc@sources.redhat.com
>Subject: Re: Mips cross compiler for cygwin
>
>
>Harry:
>
>
>[Just happened to catch me at my desk!]
>
>Make sure you nuke sys-include at the end of the bootstrap build, before
>you build newlib or the "complete" gcc.
>
>
>See if that helps,
>
>
>b.g.
>
>Harry Kaes wrote:
>
>  
>
>>Kaes Harry wrote
>>
>>
>>    
>>
>>>In the meantime I continued my attempts to build the cross compiler
>>>following the instructions by Bill Gatliff. For this build I'm using gcc
>>>sources 3.3.3, binutils 2.14 and newlib 1.12.0. I'm able to compile the
>>>binutils (well, I don't get any errors anyway), as well as the newlib
>>>library and the bootstrap cross compiler. I created a directory gcc on the
>>>
>>>
>>>      
>>>
>>c
>>
>>
>>    
>>
>>>drive and put the gcc sources in a subdirectory gcc-sources, the binutils
>>>sources in binutils-2.14 and the newlib sources in newlib-1.12.0. I made
>>>four directories (again as subdirectories of c:\gcc) to perform the builds
>>>in : build-gcc (for the bootstrap compiler), build-newlib, build-binutils
>>>and build-gcc-final (for the actual cross compiler). I compiled the
>>>different sources in this order :
>>>
>>>      
>>>
>>>from the directory build-binutils :
>>    
>>
>>>
>>>      
>>>
>>../binutils-2.14/configure --target=mipsel-elf --host=i686-pc-cygwin --buil
>>    
>>
>d
>  
>
>>    
>>
>>>=i686-pc-cygwin --prefix=/gcc-mips --with-gnu-as --with-gnu-ld
>>>make all install
>>>      
>>>
>>>from the directory build-gcc :
>>    
>>
>>>
>>>      
>>>
>>../gcc-sources/configure --target=mipsel-elf --host=i686-pc-cygwin --build=
>>    
>>
>i
>  
>
>>686-pc-cygwin --prefix=/gcc-mips --with-gnu-as --with-gnu-ld --without-head
>>    
>>
>e
>  
>
>>    
>>
>>>rs --with-newlib -v
>>>make all-gcc install-gcc
>>>      
>>>
>>>from the directory build-newlib :
>>    
>>
>>>
>>>      
>>>
>>../newlib-1.12.0/configure --target=mipsel-elf --host=i686-pc-cygwin --buil
>>    
>>
>d
>  
>
>>    
>>
>>>=i686-pc-cygwin --prefix=/gcc-mips --with-gnu-as --with-gnu-ld
>>>make all install
>>>      
>>>
>>>from the directory build-gcc-final :
>>    
>>
>>>
>>>      
>>>
>>../gcc-sources/configure --target=mipsel-elf --host=i686-pc-cygwin --build=
>>    
>>
>i
>  
>
>>    
>>
>>>686-pc-cygwin --prefix=/gcc-mips --with-gnu-as --with-gnu-ld -v
>>>make all install
>>>
>>>Running this final make to build the actual cross compiler results in an
>>>error while executing the following command :
>>>
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/gcc/xgcc -shared-libgcc -B/cygdrive/c/gcc/b
>>    
>>
>u
>  
>
>>ild-gcc-final/gcc/ -nostdinc++ -L/cygdrive/c/gcc/build-gcc-final/mipsel-elf
>>    
>>
>/
>  
>
>>soft-float/libstdc++-v3/src -L/cygdrive/c/gcc/build-gcc-final/mipsel-elf/so
>>    
>>
>f
>  
>
>>t-float/libstdc++-v3/src/.libs -B/gcc-mips/mipsel-elf/bin/ -B/gcc-mips/mips
>>    
>>
>e
>  
>
>>    
>>
>>>l-elf/lib/ -isystem
>>>
>>>
>>>
>>>      
>>>
>>/gcc-mips/mipsel-elf/include -msoft-float -I../../../../../gcc-sources/libs
>>    
>>
>t
>  
>
>>dc++-v3/../gcc -I../../../../../gcc-sources/libstdc++-v3/../include -I/cygd
>>    
>>
>r
>  
>
>>ive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/mipsel
>>    
>>
>-
>  
>
>>elf -I/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/in
>>    
>>
>c
>  
>
>>lude -I../../../../../gcc-sources/libstdc++-v3/libsupc++ -g -O2 -msoft-floa
>>    
>>
>t
>  
>
>>    
>>
>>>-fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -fdiagnostic
>>>
>>>
>>>      
>>>
>>s-
>>
>>
>>    
>>
>>>show-location=once -c
>>>../../../../../gcc-sources/libstdc++-v3/libsupc++/eh_alloc.cc -o
>>>
>>>
>>>      
>>>
>>eh_alloc.o
>>
>>
>>    
>>
>>>The resulting error is :
>>>
>>>In file included from
>>>../../../../../gcc-sources/libstdc++-v3/libsupc++/eh_alloc
>>>.cc:33:
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:86: error: `
>>>  div_t' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:87: error: `
>>>  ldiv_t' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:97: error: `
>>>  div' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:102: error: `
>>>  ldiv' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:104: error: `
>>>  mblen' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:105: error: `
>>>  mbstowcs' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:106: error: `
>>>  mbtowc' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:115: error: `
>>>  wcstombs' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:116: error: `
>>>  wctomb' not declared
>>>
>>>
>>>
>>>      
>>>
>>/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-float/libstdc++-v3/include/
>>    
>>
>c
>  
>
>>    
>>
>>>stdl
>>>ib:122: error: syntax
>>>  error before `(' token
>>>make[6]: *** [eh_alloc.lo] Error 1
>>>make[6]: Leaving directory
>>>`/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-floa
>>>t/libstdc++-v3/libsupc++'
>>>make[5]: *** [all-recursive] Error 1
>>>make[5]: Leaving directory
>>>`/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-floa
>>>t/libstdc++-v3'
>>>make[4]: *** [all-recursive-am] Error 2
>>>make[4]: Leaving directory
>>>`/cygdrive/c/gcc/build-gcc-final/mipsel-elf/soft-floa
>>>t/libstdc++-v3'
>>>make[3]: *** [multi-do] Error 1
>>>make[3]: Leaving directory
>>>`/cygdrive/c/gcc/build-gcc-final/mipsel-elf/libstdc++
>>>-v3'
>>>make[2]: *** [all-multi] Error 2
>>>make[2]: Leaving directory
>>>`/cygdrive/c/gcc/build-gcc-final/mipsel-elf/libstdc++
>>>-v3'
>>>make[1]: *** [all-recursive-am] Error 2
>>>make[1]: Leaving directory
>>>`/cygdrive/c/gcc/build-gcc-final/mipsel-elf/libstdc++
>>>-v3'
>>>make: *** [all-target-libstdc++-v3] Error 2
>>>
>>>To attempt a little debugging I concentrated on the first error : 'div_t'
>>>not declared. I found some stdlib.h files scattered over the different
>>>directories in which this define could be found. The stdlib.h file used by
>>>this last command however, was the stdlib.h file in the directory
>>>c:\gcc\build-gcc-final\gcc\include which of course did not contain a
>>>declaration of div_t.
>>>
>>>Does anyone have an idea of what goes wrong?
>>>
>>>Harry Kaes.
>>>
>>>
>>>
>>>      
>>>
>>I tried to find a solution for the problem in the archives of the mailing
>>list and luckily I found a few mails concerning this problem. In most of
>>    
>>
>the
>  
>
>>cases, the solution is to delete the invalid stdlib.h file, so that gcc
>>automatically takes the correct one (of the newlib sources) in a 'standard'
>>directory. I found the descriptions of the solutions somewhat unclear
>>however and I found myself unable to apply them to my situtation. The
>>biggest problem is of course my lack of knowledge about the whole cross
>>compiling system.
>>If I follow the guidelines as described in
>>http://sources.redhat.com/ml/crossgcc/2003-09/msg00104.html, I arrive at
>>    
>>
>the
>  
>
>>point where I should delete de stdlib.h file, but I am unable to find it in
>>the directory as described in that message.
>>
>>Can anyone give a clearer view on the solution for this problem?
>>
>>Harry Kaes
>>
>>
>>------
>>Want more information?  See the CrossGCC FAQ,
>>    
>>
>http://www.objsw.com/CrossGCC/
>  
>
>>Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
>>
>>
>>
>>    
>>
>
>--
>Bill Gatliff
>GNU-based embedded development, training and consulting services.
>bgat@billgatliff.com
>
>
>
>
>------
>Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
>Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
>
>
>------
>Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
>Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
>
>  
>

-- 
Bill Gatliff
Embedded GNU *is* user friendly, it just chooses its friends carefully.
bgat@billgatliff.com



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



More information about the crossgcc mailing list