Compile rror (SDL): cannot find -lSDLmain

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

Moderators: cheriff, TyRaNiD

Post Reply
MadButch
Posts: 16
Joined: Sat Aug 20, 2005 7:11 pm

Compile rror (SDL): cannot find -lSDLmain

Post by MadButch »

Code I wrote for the PSP without SDL runs fine...
All the SDL samples build and run fine...

But when I try to compile my program with SDL, I get the following error:

Code: Select all

$ make
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I/usr/include/SDL
 -Dmain=SDL_main -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I/usr/in
clude/SDL -Dmain=SDL_main -fno-exceptions -fno-rtti   -c -o Main.o Main.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I/usr/include/SDL
 -Dmain=SDL_main -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I/usr/in
clude/SDL -Dmain=SDL_main -fno-exceptions -fno-rtti   -c -o SDLGraphics.o SDLGra
phics.cpp
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I/usr/include/SDL
 -Dmain=SDL_main  -L. -L/usr/local/pspdev/psp/sdk/lib   Main.o SDLGraphics.o -lS
DLmain -lSDL  -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspuser -
lpspkernel -o GPH_App2.elf
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/bin/ld: cannot find -lSDLmai
n
collect2: ld returned 1 exit status
make: *** [GPH_App2.elf] Error 1
Here is the makefile for my app:

Code: Select all

TARGET          = GPH_App2
OBJS            = Main.o SDLGraphics.o

CFLAGS          = -O2 -G0 -Wall -I/usr/include/SDL -Dmain=SDL_main
CXXFLAGS        = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS         = $(CFLAGS)

LIBS            = -lSDLmain -lSDL 

EXTRA_TARGETS   = EBOOT.PBP
PSP_EBOOT_ICON  = Data/Graphics/Icon0.png
PSP_EBOOT_PIC1  = Data/Graphics/Pic1.png
PSP_EBOOT_TITLE = GamePlayHeaven PSP App. 2

PSPSDK          =$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Does anyone have a clue what I'm doing wrong?
rinco
Posts: 255
Joined: Fri Jan 21, 2005 2:12 pm
Location: Canberra, Australia

Post by rinco »

You do not have the -L for SDL.
This is done with the sdl-config command:
matthewh$ /usr/local/pspdev/psp/bin/sdl-config --libs
-L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspaudio -lc -lpspuser -lpspkernel
You will see sdl-config used in all SDL app Makefiles.
MadButch
Posts: 16
Joined: Sat Aug 20, 2005 7:11 pm

Post by MadButch »

I don't have a sdl-config in that dir.
I had to manually install SDL (128), because I can't seem to get it from the pspsdk.

Do I have to move the config file into that dir, or was I supposed to extract the SDL files from the pspsdk (toolchain) somehow?


EDIT:
I see the sdl-config file is in my bin dir in the root. But I looked for the .lib files, and I don't have those. So that must be whats wrong.
So I went back to the SDL site, and downloaded SDL-1.2.8-1.i386.rpm. But altho they got whole walkthroughs on how to run a setup.exe under windows, there is nothing on installing an rpm package.

No clue what I'm doing wrong... but this stuff is all made just a little bit too complicated for any normal person. It's like it's designed to be weird :)

Ah well.. someday I will have it set up and I can actually start coding =/
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

You can't use i386 SDL for the PSP as they are binary incompatible. You need to check out SDL for PSP from the pspdev Subversion repository. Once you do, follow the instructions in README.PSP to build and install SDL for PSP.

The same goes for other PSP-specific ports of libraries such as zlib and libpng.
MadButch
Posts: 16
Joined: Sat Aug 20, 2005 7:11 pm

Post by MadButch »

I've searched thru these forums, but I can't find any info on how to use that SVN site. I managed to find the SDL files in there, but I can't believe that I have to right click and Save As every single file in there....

There must be an easier way...

I already used the toolchain -p command to download and build the latest version, but that doesn't included any SDL files for me...

Would there be someplace/link where you could direct me to, that would explain how to use the SVN site?

EDIT:
Seems there is indeed, I found this works:

Code: Select all

SVN checkout svn://svn.pspdev.org/psp/trunk/SDL
Post Reply