Glibc_vs_uClibc_Differences.txt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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). We therefore, also do not provide any of the
  31. headers files provided by glibc under /usr/include/rpcsvc.
  32. 9) uClibc's locale support is not 100% complete yet. We are working on it.
  33. 10) uClibc's math library only supports long double as inlines, and even
  34. then the long double support is quite limited.
  35. 11) uClibc's libcrypt does not support the reentrant crypt_r, setkey_r and
  36. encrypt_r, since these are not required by SuSv3.
  37. 12) uClibc does not implement wordexp()
  38. 13) uClibc directly uses the kernel types to define most opaque data types.
  39. 14) uClibc directly uses the linux kernel's arch specific 'stuct stat'.
  40. 15) Add other things here as they come up......
  41. ****************************** Manuel's Notes ******************************
  42. Some general comments...
  43. The intended target for all my uClibc code is ANSI/ISO C99 and SUSv3
  44. compliance. While some glibc extensions are present, many will eventually
  45. be configurable. Also, even when present, the glibc-like extensions may
  46. differ slightly or be more restrictive than the native glibc counterparts.
  47. They are primarily meant to be porting _aides_ and not necessarily
  48. drop-in replacements.
  49. Now for some details...
  50. time functions
  51. --------------
  52. 1) Leap seconds are not supported.
  53. 2) /etc/timezone and the whole zoneinfo directory tree are not supported.
  54. To set the timezone, set the TZ environment variable as specified in
  55. http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html
  56. or you may also create an /etc/TZ file of a single line, ending with a
  57. newline, containing the TZ setting. For example
  58. echo CST6CDT > /etc/TZ
  59. 3) Currently, locale specific eras and alternate digits are not supported.
  60. They are on my TODO list.
  61. wide char support
  62. -----------------
  63. 1) The only multibyte encoding to be supported will be UTF-8. The various
  64. ISO-8859-* encodings will be (optionally) supported. The internal
  65. representation of wchar's is assumed to be 31 bit unicode values in
  66. native endian representation. Also, the underlying char encoding is
  67. assumed to match ASCII in the range 0-0x7f.
  68. 2) In the C locale, uClibc's mb<->wc conversion functions map 0x80-CHAR_MAX
  69. onto their wide/narrow equivalents. glibc's conversion functions treat
  70. them as illegal.
  71. locale support
  72. --------------
  73. 1) The target for support is SUSv3 locale functionality. While nl_langinfo
  74. has been extended, similar to glibc, it only returns values for related
  75. locale entries.
  76. 2) The locale code is not cross-compiler friendly. This should be fixed soon.
  77. 3) Currently, collation support is being implemented.
  78. stdio
  79. -----
  80. 1) For printf, %a, %A, and floating point locale-specific grouping are not
  81. yet implemented. Also, conversion of large magnitude floating-point values
  82. suffers a loss of precision due to the algorithm used. The conversion
  83. function was written before uClibc had proper semi-numerical macros/functions.
  84. This code is slated to be rewritten after the i10n/i18n work is completed.
  85. 2) uClibc's printf is much stricter than glibcs, especially regarding positional
  86. args. The entire format string is parsed first and an error is returned if
  87. a problem is detected. Also, currently at most 10 positional args are allowed
  88. although this is configurable.
  89. 3) BUFSIZ is currently 256. No attempt is made at automatic tuning of internal
  90. buffer sizes for stdio streams. In fact, the stdio code in general sacrifices
  91. sophistication/performace for minimal size.
  92. 4) uClibc allows glibc-like custom printf functions. However, while not
  93. currently checked, the specifier must be <= 0x7f.
  94. 5) uClibc allows glibc-like custom streams. However, no in-buffer seeking is
  95. done.
  96. 6) uClibc's scanf still needs work.
  97. 7) The functions fcloseall() and __fpending() can behave differently than their
  98. glibc counterparts.
  99. More to follow as I think of it...