I'm Really Stuck! Toolchain Issue


michu

Still Fresh
Joined
Mar 6, 2006
Messages
60
Website
www.neophob.com
OK i've a big problem... I use debian and oopo's toolchain..

i try to compile for example zlib:

config:
CC='gp2x-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib' CXX='gp2x-g++ -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib' CFLAGS='-O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2' LDFLAGS='-L/usr/local/gp2xdev/lib' ./configure --prefix=$PREFIX
-> runns fine

make:
CC='gp2x-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib' CXX='gp2x-g++ -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib' CFLAGS='-O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2' LDFLAGS='-L/usr/local/gp2xdev/lib' make
-> now i get this error:

gp2x-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -DNO_vsnprintf -DUSE_MMAP -o example example.o -L. libz.a
/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib/crt1.o: In function `_start':
../sysdeps/arm/elf/start.S:94: undefined reference to `__libc_csu_fini'
../sysdeps/arm/elf/start.S:94: undefined reference to `__libc_csu_init'

when i check /usr/local/gp2x.save/gp2x/lib/crt1.o i see this:
crt1.o: ELF 32-bit LSB relocatable, ARM, version 1 (ARM), not stripped
00000000 t $a
U abort
00000000 r $d
00000000 d $d
0000002c t $d
00000000 r $d
00000000 D __data_start
00000000 W data_start
00000000 R _IO_stdin_used
U __libc_csu_fini
U __libc_csu_init
U __libc_start_main
U main
00000000 T _start


somewhere i read that this could be if i use the wrong compiler...

I'm out of ideas! thanks in advance
michu
 

michu

Still Fresh
Joined
Mar 6, 2006
Messages
60
Website
www.neophob.com
Parkydr posted on Aug 17 2006 at 07:46 PM said:
They're defined in libc.a in my set up (oopo's too), maybe -lc would help, but I don't see you should have tp.

what do you mean with -lc?

i cannot even compile this dummy code:

Code:
// blah.c
#include <stdio.h>
int MyMain() {
printf("Hello\n");
return 0;
}

mideb:/gp2x/_BOB/zlib-1.2.3/AAA# gp2x-gcc -o blah -eMyMain blah.c
blah.c:9:2: warning: no newline at end of file
/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib/crt1.o: In function `_start':
../sysdeps/arm/elf/start.S:94: undefined reference to `main'
collect2: ld returned 1 exit status

why the hell does he use crt1.o from the host?
 
Last edited by a moderator:

Parkydr

Developing for the GP2X since 2006
Joined
Dec 3, 2005
Messages
1,357
Website
www.parkydr.ezeedsl.co.uk
michu posted on Aug 17 2006 at 09:34 PM said:
Parkydr posted on Aug 17 2006 at 07:46 PM said:
They're defined in libc.a in my set up (oopo's too), maybe -lc would help, but I don't see you should have tp.

what do you mean with -lc?

i cannot even compile this dummy code:

Code:
// blah.c
#include <stdio.h>
int MyMain() {
printf("Hello\n");
return 0;
}

mideb:/gp2x/_BOB/zlib-1.2.3/AAA# gp2x-gcc -o blah -eMyMain blah.c
blah.c:9:2: warning: no newline at end of file
/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/lib/crt1.o: In function `_start':
../sysdeps/arm/elf/start.S:94: undefined reference to `main'
collect2: ld returned 1 exit status

why the hell does he use crt1.o from the host?

I meant add -lc on the link line i.e.

gp2x-gcc -o blah blah.c -lc

but this is a different error

if you change MyMain to main and compile with

gp2x-gcc -o blah blah.c

does it work then?


Note: -e replaces the _start entry point, not main, that's why main is undefined
 
Last edited by a moderator:

michu

Still Fresh
Joined
Mar 6, 2006
Messages
60
Website
www.neophob.com
well I guess I fucked up my installation, perhaps I mixed up archidectures and or include files.. a fresh toolchain installation solved the problem...
 
Top