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 

SDL Tutorial lesson 2

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



Joined: 13 Sep 2005
Posts: 15

PostPosted: Fri Sep 16, 2005 10:31 pm    Post subject: SDL Tutorial lesson 2 Reply with quote

After giving up on getting cygwin + psptoolchain to work, I spent a few hours getting SDL, PSPSDK + toolchain up on my Suse box. Worked like a charm.

My next step was to follow a tutorial on SDL, easy as pie. With a few minor modifications I got it working on my PSP.

The filestructure in this RAR file suxx, you'll need to put the "Makefile" and "lesson2.cpp" somewhere else! But it's there for you to study :)

http://rapidshare.de/files/5161304/lesson2.rar

The tutorial I follow can be found here:
http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut2

And I stole some PSP doublebuffering adjustments from here:
http://svn.ps2dev.org/filedetails.php?repname=pspware&path=%2Ftrunk%2FSMC%2Fsrc%2Fvideo.cpp&rev=0&sc=0

    What I should have done differently:
  • A better joystick code, my Java training should have made me understand events better!!! :)
  • A better file layout, There is code on this forum for "releative filepaths"!
  • Better SDL_main code, quick and dirt fix to make it work :)


    What I will do in the future
  • Make a 1.2.3 guide to get libSDL into your environment for other n00bs like me
  • Convert the rest of the SDL tutorials
  • Make my own game! :)


    What I wish for in the future(that others make)
  • A port of the SDL_net to PSP
  • 2.0 homebrew
  • PSIX Shell
  • Peace on earth and prosperity to all of man kind
Back to top
View user's profile Send private message
rinco



Joined: 21 Jan 2005
Posts: 255
Location: Canberra, Australia

PostPosted: Sat Sep 17, 2005 1:33 am    Post subject: Reply with quote

Quote:
Make a 1.2.3 guide to get libSDL into your environment for other n00bs like me


The big hurdle for most seems to be using svn and following the build instructions for each package.
But in any case, here's a little script that can install all of SDL:

Code:
#!/bin/sh

SRCDIR="`pwd`"
TMPDIR="/tmp/pspsdl"
SVN="svn"

mkdir -p $TMPDIR
cd $TMPDIR

SDL_PKGS="SDL SDL_gfx SDL_image jpeg libpng zlib SDL_mixer SDL_ttf freetype"
for pkg in $SDL_PKGS ; do
        rm -Rf $pkg
        $SVN checkout svn://svn.pspdev.org/psp/trunk/$pkg
done

cd SDL
./autogen.sh
LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" \
        ./configure --host psp --prefix=`psp-config --psp-prefix`
make
make install
cd $TMPDIR

cd zlib
make
make install
cd $TMPDIR

cd libpng
make
make install
cd $TMPDIR

cd jpeg
make
make install
cd $TMPDIR

cd SDL_image
./autogen.sh
LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" \
        ./configure --host psp --with-sdl-prefix=`psp-config --psp-prefix` \
        --prefix=`psp-config --psp-prefix`
make
make install
cd $TMPDIR

cd SDL_gfx
./autogen.sh
AR=psp-ar LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" \
        ./configure --host psp --with-sdl-prefix=`psp-config --psp-prefix` \
        --prefix=`psp-config --psp-prefix` --disable-mmx --disable-shared
make
make install
cd $TMPDIR

cd freetype
./autogen.sh
LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" \
        ./configure --host psp --prefix=`psp-config --psp-prefix`
make
make install
cd $TMPDIR

cd SDL_ttf
./autogen.sh
LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" \
        ./configure --host psp --with-sdl-prefix=`psp-config --psp-prefix` \
        --with-freetype-prefix=`psp-config --psp-prefix` \
        --without-x --prefix=`psp-config --psp-prefix`
make
make install
cd $TMPDIR

cd SDL_mixer
./autogen.sh
LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" \
        ./configure --host psp --with-sdl-prefix=`psp-config --psp-prefix` \
        --disable-music-mp3 --prefix=`psp-config --psp-prefix`
make
make install
cd $TMPDIR

cd $SRCDIR
#for pkg in $SDL_PKGS ; do
#        rm -Rf $pkg
#done
#
#rmdir $TMPDIR


And there's a few ports in the svn pspware repository that can be used to test the installation:
abrick - for testing SDL_mixer
vecteroids - depends upon SDL_image and SDL_mixer
SMC - requires SDL_ttf, SDL_mixer, SDL_image and SDL_gfx

Also, it is interesting to note that these source packages can be reused on your host platform; just build the packages downloaded from pspsvn by running ./configure (ie: without all the psp specifics). Running 'make clean' first would be a wise move.
Back to top
View user's profile Send private message
daveyc



Joined: 24 Sep 2005
Posts: 5

PostPosted: Sun Sep 25, 2005 3:17 am    Post subject: Reply with quote

I've tried using your script, and most of the packages install correctly, but it fails when trying to install freetype. I'm using the latest toolchain and I've tried it on cygwin and on linux (fedora).

Here's the contents of config.log:

Any ideas?

Code:

## ----------- ##
## Core tests. ##
## ----------- ##

configure:1537: checking build system type
configure:1555: result: i686-pc-cygwin
configure:1563: checking host system type
configure:1577: result: mipsallegrexel-psp-elf
configure:1585: checking target system type
configure:1599: result: mipsallegrexel-psp-elf
configure:1625: checking for psp-gcc
configure:1641: found /usr/local/pspdev/bin/psp-gcc
configure:1651: result: psp-gcc
configure:1933: checking for C compiler version
configure:1936: psp-gcc --version </dev/null >&5
psp-gcc (GCC) 4.0.1 (PSPDEV 20050827)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:1939: $? = 0
configure:1941: psp-gcc -v </dev/null >&5
Using built-in specs.
Target: psp
Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --enable-cxx-flags=-G0
Thread model: single
gcc version 4.0.1 (PSPDEV 20050827)
configure:1944: $? = 0
configure:1946: psp-gcc -V </dev/null >&5
psp-gcc: '-V' option must have argument
configure:1949: $? = 1
configure:1972: checking for C compiler default output file name
configure:1975: psp-gcc    conftest.c  >&5
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/crt0.o: In function `_main':
/tmp/pspdev/pspsdk/sdk/startup/crt0.c:72: undefined reference to `atexit'
/tmp/pspdev/pspsdk/sdk/startup/crt0.c:78: undefined reference to `exit'
/tmp/pspdev/pspsdk/sdk/startup/crt0.c:65: undefined reference to `strlen'
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/crt0.o: In function `_start':
/tmp/pspdev/pspsdk/sdk/startup/crt0.c:134: undefined reference to `sceKernelCreateThread'
/tmp/pspdev/pspsdk/sdk/startup/crt0.c:135: undefined reference to `sceKernelStartThread'
collect2: ld returned 1 exit status
configure:1978: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2017: error: C compiler cannot create executables
See `config.log' for more details.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sun Sep 25, 2005 3:22 am    Post subject: Reply with quote

What's the command line you pass to configure? Are you you using
Code:
LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" ./configure --host psp --prefix=`psp-config --psp-prefix`

as found in README.PSP?
Back to top
View user's profile Send private message
daveyc



Joined: 24 Sep 2005
Posts: 5

PostPosted: Sun Sep 25, 2005 3:53 am    Post subject: Reply with quote

Yup, that's the one
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sun Sep 25, 2005 5:17 am    Post subject: Reply with quote

Are you using bash (or a compatible shell) or csh? It's strange that your linker options aren't showing up in config.log. And to be on the safe side, what versions of autoconf and automake do you have installed?
Back to top
View user's profile Send private message
warpdesign



Joined: 27 May 2009
Posts: 2

PostPosted: Wed May 27, 2009 9:12 am    Post subject: Reply with quote

Quote:

configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
...

I just downloaded a fresh toolchain, built everything, and when trying to build SDL libs (after having downloaded it from SVN trunk), I'm having the exact same error when trying to run configure...

But we're 4 years later... and still no answer :/

When running the configure line found in README.PSP, I first have the following warning:

Quote:

$ ./configure --host psp --prefix=`psp-config --psp-prefix`
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.

Then this error..
Quote:

checking for C compiler default output file name...
configure: error: in `/home/warpdesign/temp/SDL':
configure: error: C compiler cannot create executables
See `config.log' for more details.

And the error found quoted above can be found in config.log
Back to top
View user's profile Send private message
Wally



Joined: 26 Sep 2005
Posts: 672

PostPosted: Wed May 27, 2009 12:08 pm    Post subject: Reply with quote

warpdesign wrote:
Quote:

configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
...

I just downloaded a fresh toolchain, built everything, and when trying to build SDL libs (after having downloaded it from SVN trunk), I'm having the exact same error when trying to run configure...

But we're 4 years later... and still no answer :/

When running the configure line found in README.PSP, I first have the following warning:

Quote:

$ ./configure --host psp --prefix=`psp-config --psp-prefix`
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.

Then this error..
Quote:

checking for C compiler default output file name...
configure: error: in `/home/warpdesign/temp/SDL':
configure: error: C compiler cannot create executables
See `config.log' for more details.

And the error found quoted above can be found in config.log


What platform are you using?
The warning is normal.

The config log error is not specific enough you'll need to paste the entire log to pastebin.
Back to top
View user's profile Send private message AIM Address
warpdesign



Joined: 27 May 2009
Posts: 2

PostPosted: Wed May 27, 2009 6:53 pm    Post subject: Reply with quote

I'm having the exact same error as reported by daveyc:

Quote:

undefined reference to `sceKernelCreateThread'
...


I'll past the full log later if needed though.

I'm using Windows/cygwin, don't remember GCC version, I'll post the details if needed.

Thanks.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Thu May 28, 2009 11:11 am    Post subject: Reply with quote

Quote:
When running the configure line found in README.PSP, I first have the following warning:

Quote:

$ ./configure --host psp --prefix=`psp-config --psp-prefix`
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.

That's not the configure line found in README.PSP. It is:
Quote:

$ LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" ./configure --host psp --prefix=$(psp-config --psp-prefix)

as shown here:
http://psp.jim.sh/svn/filedetails.php?repname=psp&path=%2Ftrunk%2FSDL%2FREADME.PSP
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