Problem "relocation truncated to fit",please help,

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
patpsp
Posts: 31
Joined: Tue Oct 25, 2005 5:24 pm

Problem "relocation truncated to fit",please help,

Post by patpsp »

Hello, i have a problem with libpng.
when i compile my program, it says :

/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): da
ns la fonction « png_warning »:
pngerror.c:(.text+0x14c): référence indéfinie vers « _impure_ptr »
pngerror.c:(.text+0x14c): relocalisation tronquée pour concorder: R_MIPS_GPREL16
avec _impure_ptr

(relocation truncated to fit: R_MIPS_GPREL16 against '_impure_ptr' in english)

Can you explain me what i have to do ?

A search in the forum says that i have to compile the libpng with -G0
but it seems to be done :

1) i have downloaded the last libpng from svn
2) make
3) make install

I see "psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -c -o png.o png.c"

so the -G0 is passed



Any idea ?

I have no problem to compile test programs provided with pspsdk or pspGL

just the libpng i have installed causes problem.

Thanks for your help
Last edited by patpsp on Sat Nov 05, 2005 10:10 am, edited 2 times in total.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Try adding -G0 to your own program too.
patpsp
Posts: 31
Joined: Tue Oct 25, 2005 5:24 pm

Post by patpsp »

thanks for your answer jimparis

i've tried, but same error :

$ make
psp-gcc test.o -O2 -G0 -DMODULE_NAME="test" psp-setup.c -L.. -L/usr/local/pspdev/psp/sdk/lib -lglut -lGLU -lGL -lpng -lz -lm -lpspdebug -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpsplibc -lpspuser -lpspkernel -lpsprtc -o test.elf
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): dans la fonction « png_warning »:
pngerror.c:(.text+0x14c): référence indéfinie vers « _impure_ptr »
pngerror.c:(.text+0x14c): relocalisation tronquée pour concorder: R_MIPS_GPREL16 avec _impure_ptr
pngerror.c:(.text+0x1a8): référence indéfinie vers « _impure_ptr »
pngerror.c:(.text+0x1a8): relocalisation tronquée pour concorder: R_MIPS_GPREL16 avec _impure_ptr
pngerror.c:(.text+0x1ac): référence indéfinie vers « _impure_ptr »
pngerror.c:(.text+0x1ac): relocalisation tronquée pour concorder: R_MIPS_GPREL16 avec _impure_ptr
...


Any ideas ?
patpsp
Posts: 31
Joined: Tue Oct 25, 2005 5:24 pm

Post by patpsp »

well, i wrote my Makefile again, including the build.mak this time and it now compiles just fine. I don't have the old makefile, so i can't tell you my previous mistake.

So it is resolved.

If someone has the same problem, i advice him to test whether the screenshot program included in libpng compiles or not.
If it compiles, have a look at the Makefile for the screenshot and try to modify it for your app.
patpsp
Posts: 31
Joined: Tue Oct 25, 2005 5:24 pm

Post by patpsp »

Well, i'm sorry, but i've just tested my app, and my psp reboots...
So my new makefile, which allows me to compile fine, doesn't work as well as i thougt. All compile fine, but the execution failed...

So, i start again with the old makefile, which just compiles fine my app before the need of using libpng.

So, i ask you again with the "relocation truncated to fit: R_MIPS_GPREL16 against '_impure_ptr'"

Please help...
Post Reply