Glibc_vs_uClibc_Differences.txt 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. uClibc and Glibc are not the same -- there are a number of differences which
  2. may or may not cause you problems. This document attempts to list these
  3. differences and, when completed, will contain a full list of all relevant
  4. differences.
  5. 1) uClibc is smaller than glibc. We attempt to maintain a glibc compatible
  6. interface, allowing applications that compile with glibc to easily compile with
  7. uClibc. However, we do not include _everything_ that glibc includes, and
  8. therefore some applications may not compile. If this happens to you, please
  9. report the failure to the uclibc mailing list, with detailed error messages.
  10. 2) uClibc is much more configurable then glibc. This means that a developer
  11. may have compiled uClibc in such a way that significant amounts of
  12. functionality have been omitted.
  13. 3) uClibc does not even attempt to ensure binary compatibility across releases.
  14. When a new version of uClibc is released, you may or may not need to recompile
  15. all your binaries.
  16. 4) malloc(0) in glibc returns a valid pointer to something(!?!?) while in
  17. uClibc calling malloc(0) returns a NULL. The behavior of malloc(0) is listed
  18. as implementation-defined by SuSv3, so both libraries are equally correct.
  19. This difference also applies to realloc(NULL, 0). I personally feel glibc's
  20. behavior is not particularly safe.
  21. 5) uClibc does not provide a database library (libdb).
  22. 6) uClibc does not support NSS (/lib/libnss_*), which allows glibc to easily
  23. support various methods of authentication and DNS resolution. uClibc only
  24. supports flat password files and shadow password files for storing
  25. authentication information.
  26. 7) uClibc's libresolv is only a stub. Some, but not all of the functionality
  27. provided by glibc's libresolv is provided internal to uClibc. Other functions
  28. are not at all implemented.
  29. 8) uClibc does not provide libnsl.so.1, and has no support for Network
  30. Information Service (NIS).
  31. 9) uClibc's locale support is not 100% complete yet. We are working on it.
  32. 10) uClibc's math library only supports long double as inlines, and even
  33. then the long double support is quite limited.
  34. 11) uClibc's libcrypt does not support the reentrant crypt_r, setkey_r and
  35. encrypt_r, since these are not required by SuSv3.
  36. 12) uClibc does not implement wordexp()
  37. 13) uClibc directly uses the kernel types to define most opaque data types.
  38. 14) uClibc directly uses the linux kernel's arch specific 'stuct stat'.
  39. 15) Add other things here as they come up......
  40. ****************************** Manuel's Notes ******************************
  41. Some general comments...
  42. The intended target for all my uClibc code is ANSI/ISO C99 and SUSv3
  43. compliance. While some glibc extensions are present, many will eventually
  44. be configurable. Also, even when present, the glibc-like extensions may
  45. differ slightly or be more restrictive than the native glibc counterparts.
  46. They are primarily meant to be porting _aides_ and not necessarily
  47. drop-in replacements.
  48. Now for some details...
  49. time functions
  50. --------------
  51. 1) Leap seconds are not supported.
  52. 2) /etc/timezone and the whole zoneinfo directory tree are not supported.
  53. To set the timezone, set the TZ environment variable as specified in
  54. http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html
  55. or you may also create an /etc/TZ file of a single line, ending with a
  56. newline, containing the TZ setting. For example
  57. echo CST6CDT > /etc/TZ
  58. 3) Currently, locale specific eras and alternate digits are not supported.
  59. They are on my TODO list.
  60. wide char support
  61. -----------------
  62. 1) The only multibyte encoding to be supported will be UTF-8. The various
  63. ISO-8859-* encodings will be (optionally) supported. The internal
  64. representation of wchar's is assumed to be 31 bit unicode values in
  65. native endian representation. Also, the underlying char encoding is
  66. assumed to match ASCII in the range 0-0x7f.
  67. 2) In the C locale, uClibc's mb<->wc conversion functions map 0x80-CHAR_MAX
  68. onto their wide/narrow equivalents. glibc's conversion functions treat
  69. them as illegal.
  70. locale support
  71. --------------
  72. 1) The target for support is SUSv3 locale functionality. While nl_langinfo
  73. has been extended, similar to glibc, it only returns values for related
  74. locale entries.
  75. 2) The locale code is not cross-compiler friendly. This should be fixed soon.
  76. 3) Currently, collation support is being implemented.
  77. stdio
  78. -----
  79. 1) For printf, %a, %A, and floating point locale-specific grouping are not
  80. yet implemented. Also, conversion of large magnitude floating-point values
  81. suffers a loss of precision due to the algorithm used. The conversion
  82. function was written before uClibc had proper semi-numerical macros/functions.
  83. This code is slated to be rewritten after the i10n/i18n work is completed.
  84. 2) uClibc's printf is much stricter than glibcs, especially regarding positional
  85. args. The entire format string is parsed first and an error is returned if
  86. a problem is detected. Also, currently at most 10 positional args are allowed
  87. although this is configurable.
  88. 3) BUFSIZ is currently 256. No attempt is made at automatic tuning of internal
  89. buffer sizes for stdio streams. In fact, the stdio code in general sacrifices
  90. sophistication/performace for minimal size.
  91. 4) uClibc allows glibc-like custom printf functions. However, while not
  92. currently checked, the specifier must be <= 0x7f.
  93. 5) uClibc allows glibc-like custom streams. However, no in-buffer seeking is
  94. done.
  95. 6) uClibc's scanf still needs work.
  96. 7) The functions fcloseall() and __fpending() can behave differently than their
  97. glibc counterparts.
  98. More to follow as I think of it...