uclibc toolchains


Forum: water cooler
Topic: uclibc toolchains
started by: stupid_idiot

Posted by stupid_idiot on Sep. 07 2007,20:41
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!

Posted by stupid_idiot on Sep. 07 2007,20:52
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"

Posted by curaga on Sep. 08 2007,11:45
So you're back at it?
Posted by stupid_idiot on Sep. 08 2007,12:36
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.
Posted by curaga on Sep. 23 2007,07:57
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.

Posted by stupid_idiot on Sep. 26 2007,16:49
Thanks a lot for the warning.
But, ATM, I am too busy with school to do this, so, bleh.
I am spending my time with gtk2 now (see gtk2 board).

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.