Cross Compiling dietlibc

ht-lab <[email protected]> Sat, 24 Nov 2012 10:51:42 +0000
Newsgroups gmane.linux.lib.dietlibc
Organization ht-lab
Message-ID <[email protected]>
Hi All,

I am trying to cross compile dietlibc for a PC104 486 SBC:

make ARCH=i386 CROSS=i486-elf- all

all seems to go OK until I hit:

i486-elf-gcc -D__dietlibc__ -I. -isystem include -pipe -nostdinc -Os 
-fomit-frame-pointer -falign-functions=1 -falign-ju
mps=1 -falign-loops=1 -mpreferred-stack-boundary=2 -W -Wall -Wextra 
-Wchar-subscripts -Wmissing-prototypes -Wmissing-dec
larations -Wno-switch -Wno-unused -Wredundant-decls -c 
librpc/getrpcent.c -o bin-i386/getrpcent.o -D__dietlibc__
librpc/getrpcent.c: In function 'getrpcbyname':
librpc/getrpcent.c:103:7: error: argument 'name' doesn't match prototype
include/rpc/netdb.h:55:23: error: prototype declaration

A quick checks shows that the netdb.h only has the __linux__ prototype, 
it looks like I am using the wrong header files,

struct rpcent *
#ifdef __linux__
getrpcbyname(const char *name)
#else
getrpcbyname(name)
char *name;
#endif

After a few corrections I gave up and commented out the rpc lib as I 
might not need it.

It then stops when it tries to run bin-i386/diet which is compiled by 
the cross compiler and hence will not run on my host (mingw/msys):

bin-i386/diet i486-elf-gcc -D__dietlibc__ -pipe -nostdinc -Os 
-fomit-frame-pointer -falign-functions=1 -falign-jumps=1 -
falign-loops=1 -mpreferred-stack-boundary=2 -W -Wall -Wextra 
-Wchar-subscripts -Wmissing-prototypes -Wmissing-declaratio
ns -Wno-switch -Wno-unused -Wredundant-decls -o bin-i386/elftrunc 
contrib/elftrunc.c
bin-i386/diet: bin-i386/diet: cannot execute binary file
make: *** [bin-i386/elftrunc] Error 126

Luckily dietlibc.a/libm.a seems to have been build correctly so at this 
point I should be able to link in dietlibc.a without using the diet 
wrapper, is this correct? Am I setting myself up for more issues down 
the line?

Thanks,
Hans.