[uClibc]How I compiled xfree against uClibc

Dwayne Fontenot dwayne at activebuddy.com
Wed Dec 12 00:46:18 MST 2001


How I build tinyX against uClibc for TuxScreen

by Dwayne (jacques) Fontenot

==============================================================================
==============================================================================
1) obtain and install a cross-compile toolchain
	ftp://ftp.arm.linux.org.uk/pub/armlinux/toolchain/
	http://intimate.handhelds.org/jacques/xchain6-i386.tar.bz2

   remember to add the path to arm-linux-gcc to your PATH

   Why? we are going to cross-compile: i386 host, ARM target

==============================================================================
==============================================================================
2) obtain buildroot-tux
	cvs -d:pserver:anonymous at cvs.tuxscreen.sourceforge.net:/cvsroot/tuxscreen login
	# press enter at pasword prompt
	cvs -z3 -d:pserver:anonymous at cvs.tuxscreen.sourceforge.net:/cvsroot/tuxscreen co buildroot-tux

	cd buildroot-tux ; make

   Why? this will build uClibc which we are going to link Xfree
        against as well as the gcc wrappers

==============================================================================
==============================================================================
3) modify buildroot-tux to build the full math library (libm)
==============================================================================
@@ -70,7 +70,7 @@

 # Set to `true' if you want the math library to contain the full set
 # of C99 math library features.  Costs an extra 35k or so on x86.
-DO_C99_MATH = false
+DO_C99_MATH = true

 # Set this to `false' if you don't have/need "(unsigned) long long int" suppor\
t.
 # Set it to `true' otherwise.
==============================================================================

   Why? the small version of the uClibc libm does not include cbrt nor hypot.
        Xfree can use its own cbrt but not hypot. It's possible to build a
        "small" version of uClibc libm with only hypot added, but I didn't
        bother since it's 21kB vs. 55kB.


cp /usr/local/arm/arm-linux/include/linux/h3600_ts.h buildroot-tux/staging/include/linux

   Why? the tinX touchscreen driver required this file even when not building
        an ipaq-specific server.

==============================================================================
==============================================================================
4) obtain the xfree source (note ts broke in CVS on 10-11-2001)
	http://intimate.handhelds.org/jacques/xc-011010.tar.bz2
	or
==============================================================================
#!/bin/sh

export CVSROOT=:pserver:anoncvs at anoncvs2.xfree86.org:/cvs

# password is 'anoncvs'
cvs login

cvs -z 3 co -D "October 10, 2001" xc/config
cvs -z 3 co -D "October 10, 2001" xc/util
cvs -z 3 co -D "October 10, 2001" xc/extras
cvs -z 3 co -D "October 10, 2001" xc/include
cvs -z 3 co -D "October 10, 2001" xc/lib
cvs -z 3 co -D "October 10, 2001" xc/programs
cvs -z 3 co -D "October 10, 2001" xc/nls
cvs -z 3 co -D "October 10, 2001" xc/Imakefile
cvs -z 3 co -D "October 10, 2001" xc/Makefile
==============================================================================

   Why? the cvs xfree ts driver was broken on October 11th, 2001. For a long
        time it would not even compile. It has recently been patched to
        compile but does not work AFAICT.
        So we use source from before the change.

==============================================================================
==============================================================================
5) patch xfree source

lib/X11/Xlib.h

#if 1
#define wctomb(a,b)     _Xwctomb(a,b)
#define mblen(a,b)      _Xmblen(a,b)
#define mbtowc(a,b,c)   _Xmbtowc(a,b,c)
#define mbstowcs(a,b,c) _Xmbstowcs(a,b,c)
#endif

staging/include/stdlib.h

comment out the prototypes for the above functions

Why? uClibc has protos for these functions but no actual code
     and uClibc's protos clash with Xfree's when using Xfree's internal
     versions

the library in xc/lib/Xext may refuse to build if you don't have the latest
X headers installed on your system because it uses an absolute path instead
of relative. this is a bug in xfree source which can be fixed by changing
the #include <X11/extensions/XLbx.h> in xc/include/extensions/lbxstr.h to be
#include "XLbx.h"

also, somewhere you may need to add #include <sys/types.h> to fbdev.h

Why? standard xfree cvs breakage I guess

==============================================================================
==============================================================================
6) configure xfree

copy these files into xc/config/cf

http://intimate.handhelds.org/jacques/xcompile/tuxscreen/cross.def
http://intimate.handhelds.org/jacques/xcompile/tuxscreen/host.def
http://intimate.handhelds.org/jacques/xcompile/tuxscreen/iPAQH3600.cf

==============================================================================
==============================================================================
7) build xfree

cd xc ; make World

==============================================================================
==============================================================================
8) manually link Xfbdev

a) the quick and dirty way:
   cd xc/programs/Xserver, add dix/main.o to the link line

b) the more elegant way
   cd to xc/programs/Xserve/dix, rm libdix.a, make -n to see what would
   normally be done, do the same but removing main.o from the lib,
   then do the above manual link in xc/progams/Xserver.

Why? not exactly sure but the link returns "undefined function main()"
     unless the link is done like this.

==============================================================================
==============================================================================
9) strip to taste
   /foo/buildroot-tux/staging_dir/usr/bin/arm-uclibc-strip -x --strip-unneeded --remove-section=.note --remove-section=.comment Xfbdev

==============================================================================
==============================================================================
The End
==============================================================================






More information about the uClibc mailing list