building GCC/newlib for MIPS targets

Jeff Johnston
Mon Nov 28 22:03:00 GMT 2005

Dhaval Oza wrote:
> Hello:
> I'm trying to build GCC 3.4.2 with newlib 1.12 (using MinGW) for the 
> MIPS targets. I need to build the big-endian and little-endian C++ 
> libraries for the MIPS-elf targets. I was successful in building the 
> big-endian C++ libraries (this what the options defaulted to). I am 
> unsure on how to build the C++ libraries for the little-endian targets. 
> When building newlib I suppiled the -EL compile target option, and then 
> used GCC to build and install the little-endian libaries. It seemed like 
> the little-endian libraries were built however, I get linking errors 
> when I build my test programs. Is this the correct option when building 
> newlib for little-endian targets?
> I looked online for help and came across using the multilib options. I 
> tried using multilib and only the big-endian libraries get built. When I 
> invoke the -print multilib  compiler option I get blank.
> 1. How to build the tools chain for various target endianess
> combinations ?

This should all be handled by your compiler (i.e. not newlib).  If you 
read the section on multilib in the FAQ, you will see that once the 
compiler does the right thing, everything works automatically from there 
on.  I'm kind of surprised that the MIPS compiler isn't already doing 
this for you so I suggest you take this problem to the gcc list and 
someone there should be able to help you.

> 2. Is it possible to just build one compiler (instead
> of mipsel-xx, mipseb-xxx etc) and a set of libraries to
> do the job ? If yes, do I need to use multilib option
> ? If so, how to use it ?

Yes, it is possible to have one compiler build multiple libraries. 
That's the point of multilib options.  When the user specifies one or 
more of the multilib'd options, the compiler automatically knows which 
subdirectories in newlib/libgloss to find the appropriate libraries to 
link with.  Those libraries have already been built with the same 
options that the user specified.  Note that multilib doesn't work if the 
user manually links via ld.  If a manual link is performed, the user is 
responsible for specifying the sub-directories to use (not recommended). 
  The link should be performed via the compiler (e.g. gcc -o my.out my.o).

-- Jeff J.

More information about the Newlib mailing list