forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with USE_PSPSDK_LIBC = 1 and libpng

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Tsukasa



Joined: 04 Jul 2005
Posts: 12

PostPosted: Tue Jan 17, 2006 3:48 am    Post subject: Problem with USE_PSPSDK_LIBC = 1 and libpng Reply with quote

Hi Guys :(

I've a difficult problem with my program.
I have to use the "USE_PSPSDK_LIBC = 1" tag in the makefile, but then, my libpng won't work :/

Here is the error message:
Code:
$ make
psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o -lpng -lz -
lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpsplibc -lpspnet -lpspne
t_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o sc
reenshot.elf
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): In
 function `png_warning':
pngerror.c:(.text+0x14c): undefined reference to `_impure_ptr'
pngerror.c:(.text+0x14c): relocation truncated to fit: R_MIPS_GPREL16 against `_
impure_ptr'
pngerror.c:(.text+0x1a8): undefined reference to `_impure_ptr'
pngerror.c:(.text+0x1a8): relocation truncated to fit: R_MIPS_GPREL16 against `_
impure_ptr'
pngerror.c:(.text+0x1ac): undefined reference to `_impure_ptr'
pngerror.c:(.text+0x1ac): relocation truncated to fit: R_MIPS_GPREL16 against `_
impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): In
 function `png_error':
pngerror.c:(.text+0x2a8): undefined reference to `_impure_ptr'
pngerror.c:(.text+0x2a8): relocation truncated to fit: R_MIPS_GPREL16 against `_
impure_ptr'
pngerror.c:(.text+0x310): undefined reference to `_impure_ptr'
pngerror.c:(.text+0x310): relocation truncated to fit: R_MIPS_GPREL16 against `_
impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o):png
error.c:(.text+0x314): more undefined references to `_impure_ptr' follow
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): In
 function `png_error':
pngerror.c:(.text+0x314): relocation truncated to fit: R_MIPS_GPREL16 against `_
impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrutil.o): In
 function `png_handle_gAMA':
pngrutil.c:(.text+0xd08): relocation truncated to fit: R_MIPS_GPREL16 against `_
impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrutil.o): In
 function `png_handle_cHRM':
pngrutil.c:(.text+0x1470): relocation truncated to fit: R_MIPS_GPREL16 against `
_impure_ptr'
pngrutil.c:(.text+0x14e0): relocation truncated to fit: R_MIPS_GPREL16 against `
_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrutil.o): In
 function `png_handle_sRGB':
pngrutil.c:(.text+0x1790): relocation truncated to fit: R_MIPS_GPREL16 against `
_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngwrite.o): In
 function `png_convert_from_time_t':
pngwrite.c:(.text+0xac4): undefined reference to `gmtime'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngwutil.o): In
 function `png_write_cHRM':
pngwutil.c:(.text+0x1120): undefined reference to `_impure_ptr'
pngwutil.c:(.text+0x1120): additional relocation overflows omitted from the outp
ut
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngwutil.o): In
 function `png_write_cHRM_fixed':
pngwutil.c:(.text+0x16dc): undefined reference to `_impure_ptr'
collect2: ld returned 1 exit status
make: *** [screenshot.elf] Error 1


Can anyone help me :'(?
Back to top
View user's profile Send private message
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Tue Jan 17, 2006 5:33 am    Post subject: Re: Problem with USE_PSPSDK_LIBC = 1 and libpng Reply with quote

relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'

Libpng was not built with -G0.

undefined reference to `_impure_ptr'

It was built against newlib.
Back to top
View user's profile Send private message
R2k



Joined: 17 Mar 2006
Posts: 16
Location: México

PostPosted: Tue Mar 21, 2006 7:26 am    Post subject: i've the same problem Reply with quote

i'm compiling a program but when psp-gcc is linking displays this:

Code:

$ make
psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall -fno-strict-aliasing   -c -o main.o main.c
psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall -fno-strict-aliasing   -c -o console.o console.c
psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall -fno-strict-aliasing   -c -o common.o common.c
psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall -fno-strict-aliasing   -c -o libs/framebuffer.o libs/fram
ebuffer.c
psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall -fno-strict-aliasing   -c -o libs/graphics.o libs/graphic
s.c
psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall -fno-strict-aliasing  -L. -L/usr/local/pspdev/psp/sdk/lib
   main.o console.o common.o libs/framebuffer.o libs/graphics.o -lpspgu -lpng -l
z -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpsplibc -lpspnet -lps
pnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o
 WArena+.elf
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): En
 la función `png_warning':
pngerror.c:(.text+0x14c): referencia a `_impure_ptr' sin definir
pngerror.c:(.text+0x14c): reubicación truncada para ajustar: R_MIPS_GPREL16 cont
ra `_impure_ptr'
pngerror.c:(.text+0x1a8): referencia a `_impure_ptr' sin definir
pngerror.c:(.text+0x1a8): reubicación truncada para ajustar: R_MIPS_GPREL16 cont
ra `_impure_ptr'
pngerror.c:(.text+0x1ac): referencia a `_impure_ptr' sin definir
pngerror.c:(.text+0x1ac): reubicación truncada para ajustar: R_MIPS_GPREL16 cont
ra `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): En
 la función `png_error':
pngerror.c:(.text+0x2a8): referencia a `_impure_ptr' sin definir
pngerror.c:(.text+0x2a8): reubicación truncada para ajustar: R_MIPS_GPREL16 cont
ra `_impure_ptr'
pngerror.c:(.text+0x310): referencia a `_impure_ptr' sin definir
pngerror.c:(.text+0x310): reubicación truncada para ajustar: R_MIPS_GPREL16 cont
ra `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o):png
error.c:(.text+0x314): más referencias a `_impure_ptr' sin definir a continuació
n
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngerror.o): En
 la función `png_error':
pngerror.c:(.text+0x314): reubicación truncada para ajustar: R_MIPS_GPREL16 cont
ra `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrutil.o): En
 la función `png_handle_gAMA':
pngrutil.c:(.text+0xd08): reubicación truncada para ajustar: R_MIPS_GPREL16 cont
ra `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrutil.o): En
 la función `png_handle_cHRM':
pngrutil.c:(.text+0x1470): reubicación truncada para ajustar: R_MIPS_GPREL16 con
tra `_impure_ptr'
pngrutil.c:(.text+0x14e0): reubicación truncada para ajustar: R_MIPS_GPREL16 con
tra `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrutil.o): En
 la función `png_handle_sRGB':
pngrutil.c:(.text+0x1790): reubicación truncada para ajustar: R_MIPS_GPREL16 con
tra `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngwrite.o): En
 la función `png_convert_from_time_t':
pngwrite.c:(.text+0xac4): referencia a `gmtime' sin definir
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngwutil.o): En
 la función `png_write_cHRM':
pngwutil.c:(.text+0x1120): referencia a `_impure_ptr' sin definir
pngwutil.c:(.text+0x1120): se omitieron desbordamientos de reubicación adicional
es de la salida
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngwutil.o): En
 la función `png_write_cHRM_fixed':
pngwutil.c:(.text+0x16dc): referencia a `_impure_ptr' sin definir
collect2: ld devolvi'o el estado de salida 1
make: *** [WArena+.elf] Error 1


my Makefile looks like this:
Code:

TARGET = WArena+
OBJS = main.o console.o common.o libs/framebuffer.o libs/graphics.o

USE_PSPSDK_LIBC = 1

INCDIR = 
CFLAGS = -O2 -G0 -Wall -fno-strict-aliasing
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =

LIBS = -lpspgu -lpng -lz -lm

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = WArena+ 0.01 UMF

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


what could be happening

NOTE: the output is in spanish but all output is similar to the posted by Tsukasa
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Wed Mar 22, 2006 9:01 am    Post subject: Reply with quote

R2k: tienes el mismo problemo que esta passando
con Tsukasa ...el problema es que cuando tu make
libpng, la libreria no se construo come debe que ser

usted debe abrir el file Makefile en la directoria libpng
y cheqea que esta linia es exacto como debajo

CFLAGS = -O2 -G0

y guantar el file Makefile y vaz pa' tu cmd shell y
make y make install outra vez
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
R2k



Joined: 17 Mar 2006
Posts: 16
Location: México

PostPosted: Wed Mar 22, 2006 9:08 am    Post subject: Reply with quote

i checked the libpng's makefile and has the -O2 -G0
see:

Code:

PSPSDK=$(shell psp-config --pspsdk-path)
PSPDIR=$(shell psp-config --psp-prefix)
TARGET_LIB = libpng.a
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
   pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
   pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o

CFLAGS = -O2 -G0

include $(PSPSDK)/lib/build.mak

install: $(TARGET_LIB)
   @echo "Installing libpng into $(PSPDIR)"
   @mkdir -p $(PSPDIR)/include $(PSPDIR)/lib
   @cp png.h pngconf.h $(PSPDIR)/include
   @cp libpng.a  $(PSPDIR)/lib
   @echo "Done"


but i did again the make , make install thing and the result is the same
Back to top
View user's profile Send private message
R2k



Joined: 17 Mar 2006
Posts: 16
Location: México

PostPosted: Wed Mar 22, 2006 4:52 pm    Post subject: Reply with quote

please someone help me this error is really pissing me off ...
_________________
PSP FW v2.6 owner
Back to top
View user's profile Send private message
BlackDiamond



Joined: 02 Jul 2005
Posts: 16
Location: Paris, FRANCE

PostPosted: Wed Mar 22, 2006 10:40 pm    Post subject: Reply with quote

add "USE_PSPSDK_LIBC = 1" to libpng's makefile or type "make USE_PSPSDK_LIBC=1 install" (after running "make clean" of course)
Back to top
View user's profile Send private message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Wed Mar 22, 2006 10:43 pm    Post subject: Reply with quote

I'm going to say that libpng is compiled against newlib (as has been said) when you need to compile it against pspsdk-libc.

Try add:
USE_PSPSDK_LIBC = 1
To the makefile for libpng and compile+install it again.
(Don't know if this is enough)

Why do you need to use the pspsdk libc in the first place?

edit: just beaten ;)
Back to top
View user's profile Send private message
R2k



Joined: 17 Mar 2006
Posts: 16
Location: México

PostPosted: Thu Mar 23, 2006 10:07 am    Post subject: Reply with quote

[POST DELETED BY MYSELF DUE A WEIRD THING HAPPENED WITH THE FORUM]
_________________
PSP FW v2.6 owner


Last edited by R2k on Thu Mar 23, 2006 10:17 am; edited 1 time in total
Back to top
View user's profile Send private message
R2k



Joined: 17 Mar 2006
Posts: 16
Location: México

PostPosted: Thu Mar 23, 2006 10:15 am    Post subject: Reply with quote

i added USE_PSPSDK_LIBC = 1 and the linking looks better but i'm still have a error in linking something about ... time.h and gmtime(...)

this is the output:
Code:

psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk
/include -O2 -G0 -Wall  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o console.o c
ommon.o libs/framebuffer.o libs/graphics.o -lpng -lz -lm -lpspgu -lpspdebug -lps
pdisplay -lpspge -lpspctrl -lpspsdk -lpsplibc -lpspnet -lpspnet_inet -lpspnet_ap
ctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o WArena.elf
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngwrite.o): En
 la función `png_convert_from_time_t':
pngwrite.c:(.text+0xac4): referencia a `gmtime' sin definir
collect2: ld devolvi'o el estado de salida 1
make: *** [WArena.elf] Error 1


Translation : "In function `png_convert_from_time_t':
pngwrite.c:(.text+0xac4): undefined reference to `gmtime'
collect2: ld returns exit status 1
make: *** [WArena.elf] Error 1 "

i'm using only to see the performance of old libs ... but i'm thinking in forgive this crazy stuff !!!
_________________
PSP FW v2.6 owner
Back to top
View user's profile Send private message
0xAVGP



Joined: 05 Feb 2006
Posts: 11
Location: Burgwedel

PostPosted: Sun Jun 24, 2007 9:23 pm    Post subject: Reply with quote

Anyone solved the problem?
I got this prob too...
the thing is: I got the Win32-Toolchain here, therefor: Has anyone a properly linked libpng for me :)
Thx in advance
_________________
Theory is, when nothing works and everybody knows that it should...

Pactic is, when everything works and nobody knows why...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Thu Jun 28, 2007 8:26 am    Post subject: Reply with quote

I'd be tempted to just add a stub for gmtime().

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
mcPhooey



Joined: 31 Jul 2008
Posts: 1
Location: UK

PostPosted: Fri Aug 01, 2008 12:05 am    Post subject: Reply with quote

It worked for me.

Using the current libpng version 1.2.8 and zlib 1.2.2

Inserted the line "USE_PSPSDK_LIBC = 1" into the makefiles of both libpng and zlib.

First in the zlib folder:
make clean
make
make install

Then in the libpng:
make clean
make
make install

Then make own project and all errors gone.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group