SkayaWiki

UcLibC

JeromePetazzoni :: DerniersChangements :: DerniersCommentaires? :: ParametresUtilisateur :: http://www.enix.org/ :: Vous êtes ec2-3-149-24-192.us-east-2.compute.amazonaws.com

uclibc (or libuclibc, or µclibc ; pronounce you-see-lib-see, or maybe micro-lib-c) is a small GNU libc replacement for embedded systems. For more details about features etc., check their site ; I will just explain here how to use it in a cross-compilation ToolChain.

I will use Debian packages here, but the proposed solution runs on any platform. I will assume that you want to cross-compile for mips architecture (just replace mips with your target arch in the following text).

All the following indications can be run as a regular user, and preferably in a separate, empty directory.


Now, to use uclibc when compiling, do the following : mips-linux-gcc -Iinclude foobar.c -nostdlib lib/crt[0in].o -Llib -lc -o foobar. Explanations :

You might want to add -static to compile statically (to remove dependancy to uclibc on the target platform), and -s to automatically strip symbols (for a slightly smaller footprint).

Some useful notes : it seems that some very simple and trivial functions, like atoi, weight in fact quite a lot in uclibc ; actually using atoi in a small program bumped it size from 10k to 200k (when linked statically, of course ; dynamically there is no difference, but you need uclibc on your target, then).
Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]