Linker error problems with pspgl

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

Moderators: cheriff, TyRaNiD

Post Reply
JustChris
Posts: 21
Joined: Thu Nov 03, 2005 7:17 am

Linker error problems with pspgl

Post by JustChris »

I ran the demo sprite program that Jsgf wrote with pspgl, and think it's a good step forward to creating nicer-looking 2D homebrew games.

After downloading the pspgl source archive from goop.org, and putting it in the appropriate pspdev/psp/include directory, I tried compiling the source code for the demo program. I get a linker error

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/bin/ld: cannot find -glut
collect2: ld returned 1 exit status
make: *** [sprite-test.elf] Error 1
I probably didn't install the pspgl files correctly. When creating programs for PC, installation of OpenGL was smooth for me, but I'm not sure where to start fixing this problem. The makefile that came with the source for the program hasn't been altered.
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

Hm. Can you show the full output? It should say "-lglut" on the link line.
JustChris
Posts: 21
Joined: Thu Nov 03, 2005 7:17 am

Post by JustChris »

(Edit)
Full error message

Image

This is the makefile. Again, it's unaltered.

Code: Select all

TARGET = sprite-test
OBJS = test.o sprite.o psp-setup.o sprite-rgba.o sprite-mono.o

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

LIBDIR =
LDFLAGS =
LIBS = -lglut -lGL -lm -lpsprtc

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Sprite Test
PSP_EBOOT_ICON = rabbit.png

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

AS=psp-as



psp-setup.o: psp-setup.c Makefile
psp-setup.o: CFLAGS += -DMODULE_NAME="$(TARGET)"

sprite.o: sprite.c sprite.h
test.o: test.c sprite.h

%.o: %.raw
	(sym=`echo $* | tr '-' '_'`; \
	 echo -e ".data\n.global $$&#123;sym&#125;_start\n$$&#123;sym&#125;_start&#58;\n\t.incbin \"$<\"" | $&#40;AS&#41; -o $@&#41;

%-rgba.raw&#58; %-rgba.png
	convert $< rgba&#58;$@

%-mono.raw&#58; %-mono.png
	convert $< gray&#58;$@

%-sys.o&#58; %.c
	gcc -g -Wall -DSYS -c -o $@ $<

sys&#58; test-sys.o sprite-sys.o sprite-mono.o sprite-rgba.o
	gcc -o sys $^ -lglut
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

So you built a recent goop.org (or now, SVN) version and did "make install"? It looks like you don't have libglut.a in /usr/local/pspdev/psp/sdk/lib.
JustChris
Posts: 21
Joined: Thu Nov 03, 2005 7:17 am

Post by JustChris »

jsgf wrote:So you built a recent goop.org (or now, SVN) version and did "make install"? It looks like you don't have libglut.a in /usr/local/pspdev/psp/sdk/lib.
I think that's the problem. I didn't do "make install" because I didn't know from which directory I should be doing that in the shell. I assumed installing was as simple as placing the .h files in the psp/sdk/include directory. Where should I run the "make install" command after unzipping the pspgl source?
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

In the top directory (where the Makefile and all the gl*.c and other source files are). In addition to installing the .h files, you also need to install the *.a files which are the actual libraries themselves.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Wait .. pspgl should be installed in /psp/lib (and /psp/include), not /psp/sdk/lib. Only PSPSDK goes into /psp/sdk/lib.

I've checked in a change that installs it into the correct directory.
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

Ah, I was wondering about that. Good.
JustChris
Posts: 21
Joined: Thu Nov 03, 2005 7:17 am

Post by JustChris »

jsgf wrote:In the top directory (where the Makefile and all the gl*.c and other source files are). In addition to installing the .h files, you also need to install the *.a files which are the actual libraries themselves.
Okay, I'm gonna try that when I get back to my computer. I'll also get the latest version of pspgl while I'm at it. Sorry, I'm not too savvy with most Unix compiler commands yet.
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

And if I wasn't clear, "make install" is what you type to do everything; you don't need to copy anything manually.
JustChris
Posts: 21
Joined: Thu Nov 03, 2005 7:17 am

Post by JustChris »

I got it compiled and the examples working. Thanks!
Post Reply