Avnet Electronics Marketing - Community Forum
    |   
 
Home Design Services My Account About Avnet

Glibc vs. uClibc - how can you tell?

by Avnet Employee JohnW on ‎03-15-2012 01:27 PM

How can you tell if your embedded Linux system is running uClibc or glibc?  If you use Buildroot to build your embedded Linux system, this is the default choice.  You can choose other toolchains/libraries, but once chosen, how can you tell at runtime what library you are using?  Here are a couple of ways.


First, run glibc the command line.  It will report a bunch of information about itself:

# /lib/libc.so.6                                                                
GNU C Library (Sourcery G++ Lite 2011.03-41) stable release version 2.13, by Rol
and McGrath et al.                                                              
Copyright (C) 2011 Free Software Foundation, Inc.                               
This is free software; see the source for copying conditions.                   
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A             
PARTICULAR PURPOSE.                                                             
Compiled by GNU CC version 4.5.2.                                               
Compiled on a Linux 2.6.38 system on 2011-04-15.                                
Available extensions:                                                           
        crypt add-on version 2.1 by Michael Glad and others                     
        GNU Libidn by Simon Josefsson                                           
        Native POSIX Threads Library by Ulrich Drepper et al                    
        Support for some architectures added on, not maintained in glibc core.  
        BIND-8.2.3-T5B                                                          
libc ABIs: UNIQUE                                                               
For bug reporting instructions, please see:                                     
<https://support.codesourcery.com/GNUToolchain/>.  

In a uClibc system, attempting to run the /lib/libc.so.0 (uClibc library file) in the same way results in a segfault:
# ./libc.so.0
Segmentation fault   

Another way to tell would be to look in the files in /lib.  

uClibc is usually installed in /lib/libuClibc-<version number>.so  
and there is a link to it in  /lib/libc.so.0  

Glibc is in /lib/libc-<version number>.so
and there is a link to it in /lib/libc.so.6.

 

This work was done on an Atmel AT91SAM9x35 EK using their Buildroot-based implementation.

 

How to build Buildroot for the SAM9X35 EK:

http://www.at91.com/linux4sam/bin/view/Linux4SAM/BuildRoot_9x5

 

More information on uClibc:

http://www.uclibc.org/

 

 

 

About the Author
Announcements
Welcome to the Avnet Technical Community!

This is the place for customers to ask questions, exchange ideas, and share knowledge about Avnet's products and services.

Labels