FAQ.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>uClibc FAQ-- a C library for embedded systems</TITLE>
  5. </HEAD>
  6. <body text="#000000" alink="#660000" link="#660000" bgcolor="#dee2de" vlink="#660000">
  7. <basefont face="lucida, helvetica, arial" size="3">
  8. <CENTER>
  9. <p>
  10. <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2>
  11. <TR>
  12. <td bgcolor="#000000">
  13. <FONT FACE="lucida, helvetica" COLOR="#ccccc0">
  14. <B>µ&nbsp;C&nbsp;l&nbsp;i&nbsp;b&nbsp;c</B>
  15. </FONT>
  16. </TD>
  17. </TR>
  18. </TABLE>
  19. <p>
  20. <!-- Begin NOT Working List -->
  21. <TABLE WIDTH=95% CELLSPACING=1 CELLPADDING=4 BORDER=1>
  22. <TR><TD BGCOLOR="#ccccc0" ALIGN=center>
  23. <A NAME="notworking"> <BIG><B>
  24. uClibc Frequently Asked Questions (FAQ)
  25. </font>
  26. </A></B></BIG>
  27. </TD></TR>
  28. <TR><TD BGCOLOR="#eeeee0">
  29. <p>
  30. This is a collection of some of the frequently asked questions
  31. about uClibc. Some of the questions even have answers. If you
  32. have additions to this FAQ document, we would love to add them,
  33. <br>
  34. When you are done, <a href="http://uclibc.org/">you can click here to return
  35. to the uClibc home page.</a>
  36. <p>
  37. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  38. <B>
  39. What platforms does uClibc run on?
  40. </B>
  41. </TD></TR>
  42. <TR><TD BGCOLOR="#eeeee0">
  43. Currently uClibc runs on alpha, ARM, cris, h8300, i386, i960, m68k,
  44. mips/mipsel, PowerPC, SH, SPARC, and v850 processors.
  45. <p>
  46. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  47. <B>
  48. Why is it called uClibc?
  49. </B>
  50. </TD></TR>
  51. <TR><TD BGCOLOR="#eeeee0">
  52. The letter 'u' is short for µ (the greek letter "mu"). µ is commonly used
  53. as the abbreviation for the word "micro". The capital "C" is short for
  54. "controller". So the name uClibc is sortof an abbreviation for "the
  55. microcontroller C library". For simplicity, uClibc is pronounced
  56. "yew-see-lib-see".
  57. <p>
  58. The name is partly historical, since uClibc was originally
  59. created to support <a href="http://www.uclinux.org">µClinux</a>, a port of
  60. Linux for MMU-less microcontrollers such as the Dragonball, Coldfire, and
  61. ARM7TDMI. These days, uClibc also works just fine on normal Linux systems
  62. (such as i386, ARM, and PowerPC), but we couldn't think of a better name.
  63. <p>
  64. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  65. <B>
  66. Why are you doing this? What's wrong with glibc?
  67. </B>
  68. </TD></TR>
  69. <TR><TD BGCOLOR="#eeeee0">
  70. Initially, the project began since the GNU C library lacked support for
  71. MMU-less systems, and because glibc is very large. The GNU C library is
  72. designed with a very different set of goals then uClibc. The GNU C library
  73. is a great piece of software, make no mistake. It is compliant with just
  74. about every standard ever created, and runs on just about every operating
  75. system and architecture -- no small task! But there is a price to be paid
  76. for that. It is quite a large library, and keeps getting larger with each
  77. release. It does not even pretend to target embedded systems. To quote
  78. from Ulrich Drepper, the maintainer of GNU libc: "...glibc is not the right
  79. thing for [an embedded OS]. It is designed as a native library (as opposed
  80. to embedded). Many functions (e.g., printf) contain functionality which is
  81. not wanted in embedded systems." 24 May 1999
  82. <p>
  83. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  84. <B>
  85. So uClibc is smaller then glibc? Doesn't that mean it completely sucks?
  86. How could it be smaller and not suck?
  87. </B>
  88. </TD></TR>
  89. <TR><TD BGCOLOR="#eeeee0">
  90. uClibc and glibc have different goals. glibc strives for features
  91. and performance, and is targeted for desktops and servers with
  92. (these days) lots of resources. It also strives for ABI stability.
  93. <p>
  94. On the other hand, the goal of uClibc is to provide as much functionality
  95. as possible in a small amount of space, and it is intended primarily for
  96. embedded use. It is also highly configurable in supported features, at the
  97. cost of ABI differences for different configurations. uClibc has been
  98. designed from the ground up to be a C library for embedded Linux. We don't
  99. need to worry about things like MS-DOS support, or BeOS, or AmigaOs any
  100. other system. This lets us cut out a lot of complexity and very carefully
  101. optimize for Linux.
  102. <p>
  103. In other cases, uClibc
  104. leaves certain features (such as full C99 Math library support, wordexp,
  105. IPV6, and RPC support) disabled by default. Those features can be enabled
  106. for people that need them, but are otherwise disabled to save space.
  107. <p>
  108. Some of the space savings in uClibc is obtained at the cost of performance,
  109. and some is due to sacrificing features. Much of it comes from aggressive
  110. refactoring of code to eliminate redundancy. In regards to locale data,
  111. elimination of redundant data storage resulted in substantial space
  112. savings. The result is a libc that currently includes the features needed
  113. by nearly all applications and yet is considerably smaller than glibc. To
  114. compare "apples to apples", if you take uClibc and compile in locale data
  115. for about 170 UTF-8 locales, then uClibc will take up about 570k. If you
  116. take glibc and add in locale data for the same 170 UTF-8 locales, you will
  117. need over 30MB!!!
  118. <p>
  119. The end result is a C library that will compile just about everything you
  120. throw at it, that looks like glibc to application programs when you
  121. compile, and is many times smaller.
  122. <p>
  123. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  124. <B>
  125. Why should I use uClibc?
  126. </B>
  127. </TD></TR>
  128. <TR><TD BGCOLOR="#eeeee0">
  129. I don't know if you should use uClibc or not. It depends on your needs.
  130. If you are building an embedded Linux system and you are tight on space, then
  131. using uClibc instead if glibc may be a very good idea.
  132. <p>
  133. If you are building an embedded Linux system and you find that
  134. glibc is eating up too much space, you should consider using
  135. uClibc. If you are building a huge fileserver with 12 Terabytes
  136. of storage, then using glibc may make more sense. Unless, for
  137. example, that 12 Terabytes will be Network Attached Storage and
  138. you plan to burn Linux into the system's firmware...
  139. <p>
  140. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  141. <B>
  142. If I use uClibc, do I have to release all my source code to the world for
  143. free? I want to create a closed source commercial application and I want
  144. to protect my intellectual property.
  145. </B>
  146. </TD></TR>
  147. <TR><TD BGCOLOR="#eeeee0">
  148. No, you do not need to give away your application source code just because
  149. you use uClibc and/or run on Linux. uClibc is licensed under the <a
  150. href="http://www.gnu.org/copyleft/lesser.html">Lesser GPL</a> licence, just
  151. like the GNU C library (glibc). Please read this licence, or have a lawyer
  152. read this licence if you have any questions. Here is my brief summary...
  153. Using shared libraries makes complying with the license easy. You can
  154. distribute a closed source application which is linked with an unmodified
  155. uClibc shared library. In this case, you do not need to give away any
  156. source code for your application or for the uClibc library. Please
  157. consider sharing some of the money you make with us! :-)
  158. <p>
  159. If you make any changes to uClibc, and distribute uClibc or distribute any
  160. applications using your modified version, you must also distribute the
  161. source code for uClibc containing all of your changes.
  162. <p>
  163. If you distribute an application which has uClibc statically linked, you
  164. must also make your application available as an object file which can later
  165. be re-linked against updated versions of uClibc. This will (in theory)
  166. allow your customers to apply uClibc bug fixes to your application. You do
  167. not need to make the application object file available to everyone, just to
  168. those you gave the fully linked application.
  169. <p>
  170. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  171. <B>
  172. Can I use it on my x86 development system?
  173. </B>
  174. </TD></TR>
  175. <TR><TD BGCOLOR="#eeeee0">
  176. Sure! In fact, this can be very nice during development. By
  177. installing uClibc on your development system, you can be sure that
  178. the code you are working on will actually run when you deploy it
  179. your target system.
  180. <p>
  181. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  182. <B>
  183. Does uClibc support shared libraries?
  184. </B>
  185. </TD></TR>
  186. <TR><TD BGCOLOR="#eeeee0">
  187. Yes. uClibc has native shared library support on i386, ARM, mips/mipsel,
  188. SH, CRIS, and PowerPC processors. Other architectures can use shared libraries
  189. but will need to use the GNU libc shared library loader.
  190. <p>
  191. Shared Libraries are not currently supported by uClibc on MMU-less systems.
  192. <a href="http://www.snapgear.com/">SnapGear</a> has implemented
  193. shared library support for MMU-less systems, however, so if you need MMU-less
  194. shared library support they may be able to help.
  195. <p>
  196. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  197. <B>
  198. How do I compile programs with uClibc?
  199. </B>
  200. </TD></TR>
  201. <TR><TD BGCOLOR="#eeeee0">
  202. The easiest way is to use the compiler wrapper built by uClibc. Instead of
  203. using your usual compiler or cross compiler, you can use i386-uclibc-gcc,
  204. (or whatever is appropriate for your target architecture) and your
  205. applications will auto-magically link against uClibc. You can also
  206. build your own native uClibc toolchain. Just download the uClibc toolchain
  207. builder from
  208. <a href="/cgi-bin/cvsweb/toolchain/">uClibc toolchain builder</a>,
  209. or the uClibc buildroot system from
  210. <a href="/cgi-bin/cvsweb/buildroot/">uClibc buildroot system</a>,
  211. adjust the Makefile settings to match your target system, and then run 'make'.
  212. <p>
  213. If you want to be <em>really</em> lazy and start using uClibc right
  214. away without needing to compile your own toolchain or anything, you can
  215. grab a copy of the uClibc development systems, currently available for
  216. <a href="http://www.kernel.org/pub/linux/libs/uclibc/root_fs_i386.bz2">i386</a>,
  217. <a href="http://www.kernel.org/pub/linux/libs/uclibc/root_fs_powerpc.bz2">powerpc</a>,
  218. <a href="http://www.kernel.org/pub/linux/libs/uclibc/root_fs_mipsel.bz2">mipsel</a>,
  219. and
  220. <a href="http://www.kernel.org/pub/linux/libs/uclibc/root_fs_arm.bz2">arm</a>.
  221. These are pre-built uClibc only development systems (created using
  222. <a href="/cgi-bin/cvsweb/buildroot/">buildroot</a>), and provide a
  223. really really easy way to get started. These are about 20 MB bzip2
  224. compressed ext2 filesystems containing all the development software you
  225. need to build your own uClibc applications. With bash, awk, make, gcc, g++,
  226. autoconf, automake, ncurses, zlib, openssl, openssh, gdb, strace, busybox,
  227. GNU coreutils, GNU tar, GNU grep, etc, these should have pretty much everything
  228. you need to get started building your own applications linked against
  229. uClibc. You can boot into them, loop mount them, dd them to a spare drive
  230. and use resize2fs to make them fill a partition... Whatever works best
  231. for you.
  232. <p>
  233. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  234. <B>
  235. Why do I keep getting "sh: can't access tty; job control turned off" errors?
  236. Why doesn't Control-C work within my shell?
  237. </B>
  238. </TD></TR>
  239. <TR><TD BGCOLOR="#eeeee0">
  240. This isn't really a uClibc question, but I'll answer it here anyways. Job
  241. control will be turned off since your shell can not obtain a controlling
  242. terminal. This typically happens when you run your shell on /dev/console.
  243. The kernel will not provide a controlling terminal on the /dev/console
  244. device. Your should run your shell on a normal tty such as tty1 or ttyS0
  245. and everything will work perfectly. If you <em>REALLY</em> want your shell
  246. to run on /dev/console, then you can hack your kernel (if you are into that
  247. sortof thing) by changing drivers/char/tty_io.c to change the lines where
  248. it sets "noctty = 1;" to instead set it to "0". I recommend you instead
  249. run your shell on a real console...
  250. <p>
  251. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  252. <B>
  253. How do I make autoconf and automake behave?
  254. </B>
  255. </TD></TR>
  256. <TR><TD BGCOLOR="#eeeee0">
  257. First run
  258. <pre>export PATH=/usr/i386-linux-uclibc/bin:$PATH</pre>
  259. (or similar adjusted for your target architecture) then run you can simply
  260. run autoconf/automake and it should _just work_. Unfortunately, a large
  261. number of configure scripts (such as the one from openssh) try to execute
  262. test applications using your target C library, even if you are cross-
  263. compiling. This is bad, since it will prevent these programs from compiling.
  264. You need to complain to the authors of these programs and ask them to fix
  265. their broken configure scripts.
  266. <p>
  267. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  268. <B>
  269. When I run 'ldd' to get a list of the library dependencies for a uClibc
  270. binary, ldd segfaults! What should I do?
  271. </B>
  272. </TD></TR>
  273. <TR><TD BGCOLOR="#eeeee0">
  274. Use the ldd that is built by uClibc, not your system's one. When your
  275. system's ldd looks for library dependencies, it actually _runs_ that
  276. program. This works fine -- usually. It generally will not work at all
  277. when you have been cross compiling (which is why ldd segfaults). The ldd
  278. program created by uClibc is cross platform and doesn't even try to run
  279. the target program (like your system one does). So use the uClibc one
  280. and it will do the right thing, and it won't segfault even when you are
  281. cross compiling.
  282. <p>
  283. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  284. <B>
  285. Why does localtime() return times in UTC even when I have my timezone set?
  286. </B>
  287. </TD></TR>
  288. <TR><TD BGCOLOR="#eeeee0">
  289. The uClibc time functions get timezone information from the TZ environment
  290. variable, as described in the Single Unix Specification Version 3. See
  291. <a href="http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html">
  292. http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html</a>
  293. for details on valid settings of TZ. For some additional examples, read
  294. <a href="http://www.uclibc.org/lists/uclibc/2002-August/006261.html">
  295. http://www.uclibc.org/lists/uclibc/2002-August/006261.html</a> in the uClibc
  296. mailing list archive.
  297. You can store the value of TZ in the file '/etc/TZ' and uClibc will then
  298. automagically use the specified setting.
  299. <p>
  300. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  301. <B>
  302. What is the history of uClibc? Where did it come from?
  303. </B>
  304. </TD></TR>
  305. <TR><TD BGCOLOR="#eeeee0">
  306. The history and origin of uClibc is long and twisty.
  307. In the beginning, there was <a href="http://www.gnu.org/software/libc/libc.html">GNU libc</a>. Then, libc4
  308. (which later became linux libc 5) forked from GNU libc version 1.07.4, with
  309. additions from 4.4BSD, in order to support Linux. Later, the <a
  310. href="http://www.cix.co.uk/~mayday/">Linux-8086 C library</a>, which is part of
  311. the <a href="http://www.elks.ecs.soton.ac.uk/">elks project</a>, was created,
  312. which was, apparently, largely written from scratch but also borrowed code from
  313. libc4, glibc, some Atari library code, with bits and pieces from about 20 other
  314. places. Then uClibc forked off from the Linux-8086 C library in order to run
  315. on <a href="http://www.uclinux.org">µClinux</a>.
  316. <p>
  317. I had for some time been despairing over the state of C libraries in Linux.
  318. GNU libc, the standard, is very poorly suited to embedded systems and
  319. has been getting bigger with every release. I spent quite a bit of time looking over the
  320. available Open Source C libraries that I knew of (listed below), and none of them really
  321. impressed me. I felt there was a real vacancy in the embedded Linux ecology.
  322. The closest library to what I imagined an embedded C library should be was
  323. uClibc. But it had a lot of problems too -- not the least of which was that,
  324. traditionally, uClibc had a complete source tree fork in order to support each
  325. and every new platform. This resulted in a big mess of twisty versions, all
  326. different. I decided to fix it and the result is what you see here.
  327. My source tree has now become the official uClibc source tree and it now lives
  328. on cvs.uclinux.org and www.uclibc.org.
  329. <p>
  330. To start with, (with some initial help from <a
  331. href="http://www.uclinux.org/developers/">D. Jeff Dionne</a>), I
  332. ported it to run on i386. I then grafted in the header files from glibc 2.1.3
  333. and cleaned up the resulting breakage. This (plus some additional work) has
  334. made it almost completely independent of kernel headers, a large departure from
  335. its traditional tightly-coupled-to-the-kernel origins. I have written and/or
  336. rewritten a number of things that were missing or broken, and sometimes grafted
  337. in bits of code from the current glibc and libc5. I have also built a proper
  338. platform abstraction layer, so now you can simply edit the file "Config" and
  339. use that to decide which architecture you will be compiling for, and whether or
  340. not your target has an MMU, and FPU, etc. I have also added a test suite,
  341. which, though incomplete, is a good start. Several people have helped by
  342. contributing ports to new architectures, and a lot of work has been done on
  343. adding support for missing features.
  344. <p>
  345. In particular, around the end of 2000, Manuel Novoa III got involved with
  346. uClibc. One of his first contributions was the original gcc wrapper.
  347. Since then, he has written virtually all of the current uClibc stdio, time,
  348. string, ctype, locale, and wchar-related code, as well as much of stdlib
  349. and various other bits throught the library.
  350. <p>
  351. These days, uClibc is being developed and enhanced by Erik Andersen
  352. and Manuel Novoa III of
  353. <a href="http://codepoet-consulting.com/">CodePoet Consulting</a>
  354. along with the rest of the embedded Linux community.
  355. <p>
  356. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  357. <B>
  358. I demand that you to add &lt;favorite feature&gt; right now! How come
  359. you don't answer all my questions on the mailing list instantly? I demand
  360. that you help me with all of my problems <em>Right Now</em>!
  361. </B>
  362. </TD></TR>
  363. <TR><TD BGCOLOR="#eeeee0">
  364. You have not paid us a single cent and yet you still have the
  365. product of nearly two years of work from Erik and Manuel and
  366. many other people. We are not your slaves! We work on uClibc
  367. because we find it interesting. If you go off flaming us, we will
  368. ignore you.
  369. <p>
  370. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  371. <B>
  372. I need you to add &lt;favorite feature&gt;! Are the uClibc developers willing to
  373. be paid in order to fix bugs or add in &lt;favorite feature&gt;? Are you willing to provide
  374. support contracts?
  375. </B>
  376. </TD></TR>
  377. <TR><TD BGCOLOR="#eeeee0">
  378. Sure! Now you have our attention! What you should do is contact <a
  379. href="mailto:andersen@codepoet.org">Erik Andersen</a> of <a
  380. href="http://codepoet-consulting.com/">CodePoet Consulting</a> to bid
  381. on your project. If Erik is too busy to personally add your feature, there
  382. are several other active uClibc contributors who will almost certainly be able
  383. to help you out. Erik can contact them and ask them about their availability.
  384. <p>
  385. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  386. <B>
  387. I think you guys are great and I want to help support your work!
  388. </B>
  389. </TD></TR>
  390. <TR><TD BGCOLOR="#eeeee0">
  391. Wow, that would be great! You can click here to help support uClibc and/or request features.
  392. <!-- Begin PayPal Logo -->
  393. <center>
  394. <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  395. <input type="hidden" name="cmd" value="_xclick">
  396. <input type="hidden" name="business" value="andersen@codepoet.org">
  397. <input type="hidden" name="item_name" value="Support uClibc and/or request features">
  398. <input type="hidden" name="image_url" value="https://codepoet-consulting.com/images/codepoet.png">
  399. <input type="hidden" name="no_shipping" value="1">
  400. <input type="image" src="images/donate.png" border="0" name="submit" alt="Make donation using PayPal">
  401. </form>
  402. </center>
  403. <!-- End PayPal Logo -->
  404. If you prefer to contact us directly for payments, hardware donations,
  405. support requests, etc., you can contact
  406. <a href="http://codepoet-consulting.com/">CodePoet Consulting</a> here.
  407. <p>
  408. <TR><TD BGCOLOR="#ccccc0" ALIGN=left>
  409. <B>
  410. Ok, I'm done reading all these questions.
  411. </B>
  412. </TD></TR>
  413. <TR><TD BGCOLOR="#eeeee0">
  414. <a href="http://uclibc.org/">Well then, click here to return to the uClibc home page.</a>
  415. <!-- End things -->
  416. </TD></TR>
  417. </TABLE>
  418. </P>
  419. <!-- Footer -->
  420. <HR>
  421. <TABLE WIDTH="100%">
  422. <TR>
  423. <TD>
  424. <font size="-1" face="arial, helvetica, sans-serif">
  425. Mail all comments, insults, suggestions and bribes to
  426. <a href="mailto:andersen@codepoet.org">Erik Andersen</a><BR>
  427. </font>
  428. </TD>
  429. <TD>
  430. <a href="http://www.vim.org"><img border=0 width=90 height=36
  431. src="images/written.in.vi.png"
  432. alt="This site created with the vi editor"></a>
  433. </TD>
  434. <TD>
  435. <a href="http://www.gimp.org/"><img border=0 width=90 height=36
  436. src="images/gfx_by_gimp.png" alt="Graphics by GIMP"></a>
  437. </TD>
  438. <TD>
  439. <a href="http://www.linuxtoday.com"><img width=90 height=36
  440. src="images/ltbutton2.png" alt="Linux Today"></a>
  441. </TD>
  442. <TD>
  443. <p><a href="http://slashdot.org"><img width=90 height=36
  444. src="images/sdsmall.png" alt="Slashdot"></a>
  445. </TD>
  446. <TD>
  447. <a href="http://freshmeat.net"><img width=90 height=36
  448. src="images/fm.mini.png" alt="Freshmeat"></a>
  449. </TD>
  450. </TR>
  451. </TABLE>
  452. </CENTER>
  453. </BODY>
  454. </HTML>