water cooler :: uclibc toolchains



Last updated: 12 Sep 2007
uClibc is a small, glibc-compatible C library.
Buildroot is used to build toolchains and root filesystems with uClibc.
This is for people using older PCs who want to compile software under uclibc.
Code Sample
I'm revising everything. Actually, I'm trying to keep things as small as possible so I can post it on one of the one-click hosts instead of leaving my machine on all the time for a torrent. This will take a while. Sorry for the inconvenience!

Notes:
(1)
Code Sample
buildroot's 'make menuconfig' allows you to set compiler optimizations; for example, the default is '-Os -pipe'. This is saved in the variable $BR2_TARGET_OPTIMIZATION. This is then passed on to 'configure' as part of the $CC variable (in the form of 'gcc -Os -pipe')  when configuring packages. BR2_TARGET_OPTIMIZATION is supposed to replace CFLAGS/CXXFLAGS. When you run 'make', a script checks if CFLAGS/CXXFLAGS are clean. If not, the build is stopped and you are told to 'unset' the variable(s). This is probably to prevent you from running 'make' while unaware that CFLAGS is set to a bad value.
The problem is, most 'configure' scripts also check for CFLAGS; if $CFLAGS is empty, the default (usually '-g -O2') is used. Since 'configure' always puts $CFLAGS after $CC, you get this: 'gcc -Os -pipe -g -O2'.
In short, $BR2_TARGET_OPTIMIZATION always gets overridden by the default $CFLAGS stored in 'configure'.
To solve the problem:
1. In the main buildroot directory, edit 'Makefile' and add these 3 lines:
CFLAGS:=-Os
CXXFLAGS:=-Os
export CFLAGS CXXFLAGS
This sets CFLAGS and CXXFLAGS to '-Os' when you run 'make'.
2. cd 'toolchain/dependencies/' and edit 'dependencies.sh'. Delete these 2 sections:
if test -n "$CFLAGS"; then
echo "CFLAGS clean: FALSE"
/bin/echo -e "\n\nYou must run 'unset CFLAGS' so buildroot can run with";
/bin/echo -e "a clean environment on your build machine\n";
exit 1;
fi;
echo "CFLAGS clean: Ok"
if test -n "$CXXFLAGS"; then
echo "CXXFLAGS clean: FALSE"
/bin/echo -e "\n\nYou must run 'unset CXXFLAGS' so buildroot can run with";
/bin/echo -e "a clean environment on your build machine\n";
exit 1;
fi;
echo "CXXFLAGS clean: Ok"

So you're back at it?
No, I don't have the time to work on anything big; just thought this might be useful for compiling under uclibc on older hardware. I do want to try adding in xlibs and Xorg as well.
Just want to warn ya.

Seems the current uClibc, 0.9.29, is broken. They broke some things, that in turn broke others, and even with all the patches they've made for those, even their own buildroot cannot compile everything it lists.

Even gcc 4.2 has trouble, though the gcc devs included extra much uclibc support in that ver.
The last uclibc that worked for the HLFS guys was 0.9.28.3 with gcc 3.3.6, after the uclibc update lots has gone wrong. Stuff doesn't compile. Weird seg faults. Static linking not functional.

So, for reasons I think are justifiable, I am gonna wait for the next uclibc before I do anything. It just doesn't seem worth all the trouble right now.

Next Page...
original here.