This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


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

Re: newlib or glibc ?


   Date: Fri, 10 Jul 1998 17:00:49 +0000
   From: Brendan Simon <brendan@dgs.monash.edu.au>

   I wish to cross compile gcc to m68k and ppc embbedded systems.  I wish
   to be able to cross compile on Linux and Win32 platforms and generate
   exactly the same output files.  ie.  I prefer to use Linux while other
   coworkers prefer to use Win95.  To use the cross-compiler I need (not
   needed but prefer to have) a standard C and C++ library.

   Do newlib and glibc do the same/similar thing ?
   >From my understanding they are both standard C libraries.
   If they are interchangeable then I would think that glibc would be
   better as it is used in naitive GCC ports to OSs such as Linux and
   Win95.   This would make simulating things more consistant as the same C
   libraries would be used on the hosts and the embedded systems.

   Any ideas which would be the best way to go ?
   Has anyone tried both on embedded systems ?  If so what were the results
   ?  eg. performance, code size, etc.

There is a section on this in the crossgcc FAQ
(ftp://ftp.cygnus.com/pub/embedded/crossgcc/FAQ-0.8.1).

If anyone has anything else they'd like to add to this please do.
[For example, it may be that some of the comments here are now outdated.]

And yes, there is an updated FAQ in the works.

---

5.3 Why would I choose glibc over newlib (or vice versa)?

There are currently two sources for a C library: Glibc and Newlib.
Both have their pluses and minuses.

Glibc is the GNU libc maintained by the FSF.  It is intended to be a complete
replacement library for native systems.  It includes the routines required
by the C Standard as well as Posix routines.
Newlib is a collection of software from several sources, and was put
together by Cygnus for embedded systems.  It contains the routines required
by the C Standard as well as a math library and misc. other routines.
It is not intended to be a complete replacement library for Unix systems.

Glibc is covered by the LGPL (the GNU Library General Public License).
Newlib is a collection of software from several sources, each with their
own copyrights, but basically it's a Berkeley style copyright.

Glibc, being intended for native Unix environments, does not need to worry
about memory usage as much.
Newlib, being intended for embedded systems, does worry about memory usage
(and is more memory-efficient than glibc).