1 |
1325 |
phoenix |
|
2 |
|
|
uClibc - a Small C Library for Linux
|
3 |
|
|
Erik Andersen
|
4 |
|
|
|
5 |
|
|
uClibc (aka µClibc/pronounced yew-see-lib-see) is a C library for
|
6 |
|
|
developing embedded Linux systems. It is much smaller than the
|
7 |
|
|
GNU C Library, but nearly all applications supported by glibc
|
8 |
|
|
also work perfectly with uClibc. Porting applications from glibc
|
9 |
|
|
to uClibc typically involves just recompiling the source code.
|
10 |
|
|
uClibc even supports shared libraries and threading. It currently
|
11 |
|
|
runs on standard Linux and MMU-less (also known as µClinux)
|
12 |
|
|
systems with support for alpha, ARM, cris, e1, h8300, i386, i960,
|
13 |
|
|
m68k, microblaze, mips/mipsel, PowerPC, SH, SPARC, and v850
|
14 |
|
|
processors.
|
15 |
|
|
|
16 |
|
|
If you are building an embedded Linux system and you find that
|
17 |
|
|
glibc is eating up too much space, you should consider using
|
18 |
|
|
uClibc. If you are building a huge fileserver with 12 Terabytes
|
19 |
|
|
of storage, then using glibc may make more sense. Unless, for
|
20 |
|
|
example, that 12 Terabytes will be Network Attached Storage and
|
21 |
|
|
you plan to burn Linux into the system's firmware...
|
22 |
|
|
|
23 |
|
|
uClibc is maintained by Erik Andersen and is licensed under the
|
24 |
|
|
GNU LIBRARY GENERAL PUBLIC LICENSE . This license allows you to
|
25 |
|
|
make closed source commercial applications using an unmodified
|
26 |
|
|
version of uClibc (Please consider sharing some of the money you
|
27 |
|
|
make ;-). You do not need to give away all your source code just
|
28 |
|
|
because you use uClibc and/or run on Linux. You should, however,
|
29 |
|
|
carefuly review the license and make certain you understand and
|
30 |
|
|
abide by it strictly.
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
For installation instructions, see the file INSTALL.
|
34 |
|
|
|
35 |
|
|
uClibc strives to be standards compliant, which means that most
|
36 |
|
|
documentation written for SuSv3, or for glibc also applies to
|
37 |
|
|
uClibc functions. However, many GNU extensions are not supported
|
38 |
|
|
because they have not been ported, or more importantly, would
|
39 |
|
|
increase the size of uClibc disproportional to the added
|
40 |
|
|
functionality. There is some discussion of these differences
|
41 |
|
|
in the "docs" directory.
|
42 |
|
|
|
43 |
|
|
Additional information (recent releases, FAQ, mailing list, bugs,
|
44 |
|
|
etc.) can be found at http://www.uclibc.org/.
|
45 |
|
|
|
46 |
|
|
uClibc may be freely modified and distributed under the terms of
|
47 |
|
|
the GNU Library General Public License, which can be found in the
|
48 |
|
|
file COPYING.LIB.
|
49 |
|
|
|
50 |
|
|
Please Note:
|
51 |
|
|
|
52 |
|
|
There is an unwholesomely huge amount of code out there
|
53 |
|
|
that depends on the presence of GNU libc header files.
|
54 |
|
|
We have GNU libc compatible header files. So we have
|
55 |
|
|
committed a horrible sin in uClibc. We _lie_ and claim
|
56 |
|
|
to be GNU libc in order to force these applications to
|
57 |
|
|
work as their developers intended. This is IMHO,
|
58 |
|
|
pardonable, since these defines are not really intended
|
59 |
|
|
to check for the presence of a particular library, but
|
60 |
|
|
rather are used to define an _interface_. Some programs
|
61 |
|
|
are especially chummy with glibc, and may need this
|
62 |
|
|
behavior disabled by adding CFLAGS+=-D__FORCE_NOGLIBC
|
63 |
|
|
|
64 |
|
|
If you want to make special exceptions in your code which are
|
65 |
|
|
specifically for uClibc, you can make certain to include features.h,
|
66 |
|
|
and then have your code check for uClibc as follows:
|
67 |
|
|
|
68 |
|
|
#ifdef __UCLIBC__
|
69 |
|
|
do_something_special();
|
70 |
|
|
#endif
|
71 |
|
|
|
72 |
|
|
And most of all, but sure to have some fun!
|
73 |
|
|
-Erik
|