[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

2. Libc


2.1 Building

Patch GNU libc sources with the following patch libc.diff.gz. Do not forget to regenerate configure.

Configure GNU libc as follows:

 
configure --prefix=/ --host=i386-netbsd-gnu --enable-hacker-mode \
          --disable-profile

and build and install:

 
gmake && gmake install install_root=/usr/velco/netbsd-gnu

Note that the toolchain and the library are installed in different places - the toolchain host it NetBSD, while the library host is GNU/NetBSD. You'll need to make some links, in order for the compiler to be able to fund the headers and the library.

 
cd /usr/velco/toolchain/i386-netbsd-gnu
ln -s /usr/velco/netbsd-gnu/include include
mv lib/ldscripts .
rm -rf lib
ln -s /usr/velco/netbsd-gnu/lib lib
mv ldscripts lib

You'll want to run the GNU/NetBSD binaries under NetBSD. Set LD_LIBRARY_PATH

 
export LD_LIBRARY_PATH=/usr/velco/netbsd-gnu/lib

The dynamic linker is set to /lib/ld.so.1 so you need to make this link:

 
ln -s /usr/velco/netbsd-gnu/lib/ld.so.1 /lib/ld.so.1

Fix /usr/velco/netbsd-gnu/lib/libc.so by leaving only the basename of the libraries.

Link /usr/include to /include.

 
ln -s /include /usr/include

And now for the ultimate test:

 
$ cat > hello.c
#include <stdio.h>

int
main ()
{
  printf ("Hello, World!\n");
  return 0;
}
$ i386-netbsd-gnu-gcc hello.c
% ./a.out
Hello, World!
$

Good, cross-compiling works !


2.2 Changes


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated on November, 25 2002 using texi2html 1