i386-linux to i386-netbsdelf5.0 cross compiler

Sad Clouds cryintothebluesky@googlemail.com
Wed Feb 3 16:45:00 GMT 2010

I have an issue with running a GCC cross compiler.

I'm trying to setup i386-netbsdelf5.0 native Ada compiler, however there
aren't any recent Ada packages for NetBSD. I found gcc-3.4.x ada
compiler for NetBSD, however I can't use it to build gcc-4.4.3 Ada
compiler, because gcc-3.4.x fails to build GNU MP library (which is
required for gcc-4.x).

So, now I'm trying to setup a NetBSD cross compiler on Linux, and to
cross compile a native i386-netbsd Ada compiler.

Below are the steps I take to build and install Linux to NetBSD cross
compiler first:



# Copy NetBSD library and include files into $SYSROOT
mkdir usr
cp -Rp /netbsd/usr/include usr
ln -s usr/include include
cp -Rp /netbsd/lib ./
cp -Rp /netbsd/usr/lib/crt* lib

Build and install binutils:

./configure --prefix=$PREFIX \
--build=$BUILD_ARCH --host=$HOST_ARCH --target=$TARGET_ARCH \
--with-sysroot=$SYSROOT --disable-nls

Build and install gcc cross compiler:

../gcc-4.4.3/configure --prefix=$PREFIX \
--build=$BUILD_ARCH --host=$HOST_ARCH --target=$TARGET_ARCH \
--with-sysroot=$SYSROOT --enable-languages=c,ada \
--enable-threads=posix \
--disable-shared --disable-nls --disable-bootstrap --disable-libssp \

After everything is installed I try to compile a test program:

cd /opt/cross/bin
cat > test.c
#include <stddef.h>
int main(void)
size_t n;

./i386-netbsdelf5.0-gc test.c
test.c: In function 'main':
test.c:5: error: 'size_t' undeclared (first use in this function)
test.c:5: error: (Each undeclared identifier is reported only once
test.c:5: error: for each function it appears in.)
test.c:5: error: expected ';' before 'n'

Any idea why GCC is not picking up size_t from its header files?

More information about the Gcc-help mailing list