uclibc和glibc的差别

uClibc和Glibc并不相同,两者有许多不同之处,而且以下不同有可能给你带来一些问题.
1.uClibc比Glibc小,虽然uClibc和Glibc在已有的接口上是兼容的,而且采用uClibc编译应用程序比采用Glibc编译应用程序要更方便,但是uClibc并没有包括Glibc中的所有接口实现,因此有些应用可能在uClibc中不能编译。
2.uClibc在可配置性上比Glibc要好。
3.uClibc并不能保证发布的库二进制兼容旧版本uClibc库。当一个新的版本uClibc库被发布,则可能需要也可能不需要重新编译应用程序。
4.在Glibc中调用malloc(0),将返回一个有效的指针,然而在uClibc中调用malloc(0),则返回NULL指针。根据在SuSv3中关于malloc(0)的行为的定义,两个库的实现都是正确的。对于调用relloc(NULL,0),两个库的实现也不同。个人感觉Glibc的如此实现不是特别安全。
Glibc中malloc的实现可以通过MALLOC_CHECK_ 环境变量调节。这个方法主要用于malloc调试。这些扩展的malloc调试特性在uClibc中是不可用的。在Linux上有许多有些的malloc调试功能的库(如:dmalloc,electric fence,valgrind等)比Glibc中的扩展的malloc调试功能更好用。因此uClibc中去掉这些功能特性并不会有多打损失。
5.uClibc没有提供用于数据接口的库(libdb)。
6.uClibc不支持NSS(/lib/libnss_*),在这方面Glibc更容易支持不同方式的认证和DNS解析。uClibc仅仅支持采用flat口令文件或者shadow口令文件存储授权信息。如果需要比这些更复杂的的授权,可以编译安装pam。
7.uClibc中的libresolv库仅仅是一个桩。Glibc的libresolv库中的部分并不是全部的功能uClibc都提供,许多函数都没有实现。
8.提供网络信息服务支持(NIS)libnsl库(最初被称为黄页YP),被SUN扩展为发明为RPC并用于网络共享Unix口令文件
。个人认为NIS是一个令人厌恶的东西并应该使用。因此,在实现相同的功能情况下采用ldap比NIS更有效。uClibc虽然提供一个桩libnsl,但并不支持NIS。我们因此也不提供在Glibc下提供的位于/usr/include/rpcsvc里的头文件。
9.uClibc的区域支持并不是100%的完全。正在这方面努力

10.uClibc的数据功能函数库内部仅仅支持long double,设置对于long double的支持也是非常有限。与此对应的只实现了较少的数学函数。如果应用程序采用double类型,则会程序会运行得较好。
11.uClibc的libcrpt库不支持可重入crypt_r,setkey_r和encrypt_r,因为这些也不是SuSv3所规定的。
12.uClibc直接采用内核的数据类型去定义大多数透明的数据类型。
13.uClibc支持采用linux内核结构特有的结构体”struct stat”。
14.uClibc的运行时库librt当前缺少aio接口、全部的时钟接口和共享内存接口(仅仅实现定时器接口和消息队列接口)

1) uClibc is smaller than glibc. We attempt to maintain a glibc compatible interface, allowing applications that compile with glibc to easily compile with uClibc. However, we do not include _everything_ that glibc includes, and therefore some applications may not compile. If this happens to you, please report the failure to the uclibc mailing list, with detailed error messages. //体积小 2) 2) uClibc is much more configurable then glibc. This means that a developer may have compiled uClibc in such a way that significant amounts of functionality have been omitted. 可以根据选择进行配置编译 3) 3) uClibc does not even attempt to ensure binary compatibility across releases. When a new version of uClibc is released, you may or may not need to recompile all your binaries. 4) malloc(0) in glibc returns a valid pointer to something(!?!?) while in uClibc calling malloc(0) returns a NULL. The behavior of malloc(0) is listed as implementation-defined by SuSv3, so both libraries are equally correct. This difference also applies to realloc(NULL, 0). I personally feel glibc's behavior is not particularly safe. To enable glibc behavior, one has to explicitly enable the MALLOC_GLIBC_COMPAT option. 我个人感觉的glibc的行为不是特别安全。启用glibc的行为,人们必须明确启用MALLOC_GLIBC_COMPAT选项。 4) 4.1) glibc's malloc() implementation has behavior that is tunable via the MALLOC_CHECK_ environment variable. This is primarily used to provide extra malloc debugging features. These extended malloc debugging features are not available within uClibc. There are many good malloc debugging libraries available for Linux (dmalloc, electric fence, valgrind, etc) that work much better than the glibc extended malloc debugging. So our omitting this functionality from uClibc is not a great loss. 的glibc的malloc()实现了行为是可调通过MALLOC_CHECK_环境变量。这主要是用来提供额外的malloc调试功能。这些扩展的malloc调试功能都没有可在uClibc的。有很多很好的malloc调试库可用于Linux(dmalloc,电围栏,Valgrind的,等等),其工作多比glibc的扩展malloc调试好。因此,我们忽略了此从uClibc的功能是不是一个巨大的损失。 5) uClibc does not provide a database library (libdb). 6) uClibc does not support NSS (/lib/libnss_*), which allows glibc to easily support various methods of authentication and DNS resolution. uClibc only supports flat password files and shadow password files for storing authentication information. If you need something more complex than this, you can compile and install pam. 7) uClibc's libresolv is only a stub. Some, but not all of the functionality provided by glibc's libresolv is provided internal to uClibc. Other functions are not at all implemented. 8) libnsl provides support for Network Information Service (NIS) which was originally called "Yellow Pages" or "YP", which is an extension of RPC invented by Sun to share Unix password files over the network. I personally think NIS is an evil abomination and should not be used. These days, using ldap is much more effective mechanism for doing the same thing. uClibc provides a stub libnsl, but has no actual support for Network Information Service (NIS). We therefore, also do not provide any of the headers files provided by glibc under /usr/include/rpcsvc. 9) uClibc's locale support is not 100% complete yet. We are working on it. 10) uClibc's math library only supports long double as inlines, and even then the long double support is quite limited. Also, very few of the float math functions are implemented. Stick with double and you should be just fine. 11) uClibc's libcrypt does not support the reentrant crypt_r, setkey_r and encrypt_r, since these are not required by SuSv3. 12) uClibc directly uses kernel types to define most opaque data types. 13) uClibc directly uses the linux kernel's arch specific 'stuct stat'. 14) uClibc's librt library currently lacks all aio routines, all clock routines, and all shm routines (only the timer routines and the mq routines are implemented).
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值