FAQ.html 21 KB

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