TUTORIAL: How to build LuaPlayer
Moderators: Shine, Insert_witty_name
-
- Posts: 27
- Joined: Sat Oct 01, 2005 7:24 pm
TUTORIAL: How to build LuaPlayer
A short guide to compiling LuaPlayer
by sweetlilmre 04 Oct 2005
Hi,
I had a hard time getting this to work so I thought a guide would be appropriate!
Lines that start with # below are comments, other lines are shell commands that should
be entered exactly as shown. Some commands will take a long time to complete, be patient.
PREREQUISITES:
You must have cygwin setup and running, I would suggest this guide: http://wiki.ps2dev.org/psp:programming_faq
NOTE: when installing cygwin, make sure you install 'opengl' under the graphics category if you wish to compile
the Windows player.
FLACK JACKET:
I like to 'make clean' before making the libs etc. Sometimes you can get halfway through a build, encounter an
error and the build will then continue to fail until you do this. If you are not as paranoid as me, forget the 'make clean'.
If you encounter errors, try a 'make clean' before continuing.
INSTRUCTIONS:
# open a cygwin shell, you should be in your home directory
mkdir source
cd source
# lets get all of the latest source for starters:
svn checkout svn://svn.ps2dev.org/psp/trunk/psptoolchain
svn checkout svn://svn.ps2dev.org/psp/trunk/lua
svn checkout svn://svn.ps2dev.org/psp/trunk/libpng
svn checkout svn://svn.ps2dev.org/psp/trunk/mikmodlib
svn checkout svn://svn.ps2dev.org/psp/trunk/zlib
svn checkout svn://svn.ps2dev.org/pspware/trunk/LuaPlayer
# sort out the toolchain and the LATEST PSPSDK
cd psptoolchain
# here is the big decision, do you need to update the PSPSDK? Then do this:
./toolchain.sh -p
# if you need to install it from scratch then do this:
# WARNING, this will take a LOOOOOOOOOOOOOOOONG time!
./toolchain.sh
cd ..
# build zlib for libpng
cd zlib
make
make install
cd ..
# build libpng
cd libpng
make
make install
cd ..
#build mikmodlib
cd mikmodlib
make install
cd ..
# build lua, NOTE: you must specifically use Makefile.psp here, Makefile is the normal Linux makefile
# which will be used later
cd lua
make -f Makefile.psp
make -f Makefile.psp install
cd ..
# Finally build the player
cd LuaPlayer
make
make install
cd ..
###########################################################################################
# To compile the windows version: #
###########################################################################################
# Once you have done all of the above:
wget http://mikmod.raphnet.net/files/mikmod-3.0.3.tar.gz
tar xvf mikmod-3.0.3.tar.gz
cd mikmod-3.0.3
# Copy the supplied Makefile (see next post) into the mikmod-3.0.3 directory
# Using the supplied Makefile:
make
make install
cd ..
# Build the Linux version of lua
# [edit]: You MUST 'make clean' here to remove the files from the PSP build
cd lua
make clean
make
make install
cd ..
# Build the Windows LuaPlayer
cd LuaPlayer
make -f Makefile.windows
# if you get errors at this point, it is probably due to missing exports in the emulator.c file.
# this means that the emulator is not yet up to date. You have 2 choices:
# 1. implement the functions yourself
# 2. wait for Shine to do so :)
#
# I am impatient ;)
by sweetlilmre 04 Oct 2005
Hi,
I had a hard time getting this to work so I thought a guide would be appropriate!
Lines that start with # below are comments, other lines are shell commands that should
be entered exactly as shown. Some commands will take a long time to complete, be patient.
PREREQUISITES:
You must have cygwin setup and running, I would suggest this guide: http://wiki.ps2dev.org/psp:programming_faq
NOTE: when installing cygwin, make sure you install 'opengl' under the graphics category if you wish to compile
the Windows player.
FLACK JACKET:
I like to 'make clean' before making the libs etc. Sometimes you can get halfway through a build, encounter an
error and the build will then continue to fail until you do this. If you are not as paranoid as me, forget the 'make clean'.
If you encounter errors, try a 'make clean' before continuing.
INSTRUCTIONS:
# open a cygwin shell, you should be in your home directory
mkdir source
cd source
# lets get all of the latest source for starters:
svn checkout svn://svn.ps2dev.org/psp/trunk/psptoolchain
svn checkout svn://svn.ps2dev.org/psp/trunk/lua
svn checkout svn://svn.ps2dev.org/psp/trunk/libpng
svn checkout svn://svn.ps2dev.org/psp/trunk/mikmodlib
svn checkout svn://svn.ps2dev.org/psp/trunk/zlib
svn checkout svn://svn.ps2dev.org/pspware/trunk/LuaPlayer
# sort out the toolchain and the LATEST PSPSDK
cd psptoolchain
# here is the big decision, do you need to update the PSPSDK? Then do this:
./toolchain.sh -p
# if you need to install it from scratch then do this:
# WARNING, this will take a LOOOOOOOOOOOOOOOONG time!
./toolchain.sh
cd ..
# build zlib for libpng
cd zlib
make
make install
cd ..
# build libpng
cd libpng
make
make install
cd ..
#build mikmodlib
cd mikmodlib
make install
cd ..
# build lua, NOTE: you must specifically use Makefile.psp here, Makefile is the normal Linux makefile
# which will be used later
cd lua
make -f Makefile.psp
make -f Makefile.psp install
cd ..
# Finally build the player
cd LuaPlayer
make
make install
cd ..
###########################################################################################
# To compile the windows version: #
###########################################################################################
# Once you have done all of the above:
wget http://mikmod.raphnet.net/files/mikmod-3.0.3.tar.gz
tar xvf mikmod-3.0.3.tar.gz
cd mikmod-3.0.3
# Copy the supplied Makefile (see next post) into the mikmod-3.0.3 directory
# Using the supplied Makefile:
make
make install
cd ..
# Build the Linux version of lua
# [edit]: You MUST 'make clean' here to remove the files from the PSP build
cd lua
make clean
make
make install
cd ..
# Build the Windows LuaPlayer
cd LuaPlayer
make -f Makefile.windows
# if you get errors at this point, it is probably due to missing exports in the emulator.c file.
# this means that the emulator is not yet up to date. You have 2 choices:
# 1. implement the functions yourself
# 2. wait for Shine to do so :)
#
# I am impatient ;)
Last edited by sweetlilmre on Thu Oct 06, 2005 12:29 am, edited 2 times in total.
-
- Posts: 27
- Joined: Sat Oct 01, 2005 7:24 pm
Copy below to a file called "Makefile" and put this in the mikmod-3.0.3 directory.
[edit]: okay this won't work exactly as the post does not preserve tabs...
[edit]: pm me if you want the file
-------------------------------------------------------------------------------------------
INSTALLDIR=/usr/local
OBJS = example.o
LIBS = $(INSTALLDIR)/lib/libmikmod.a $(INSTALLDIR)/lib/libmmio.a -lpspaudiolib -lpspaudio
TARGET = mikmodtest
all: libs
libs: mmio playercode
$(MAKE) -C mmio
$(MAKE) -C playercode
install: libs
@echo "Installing mikmodlib into $(INSTALLDIR)"
@mkdir -p $(INSTALLDIR)/include $(INSTALLDIR)/lib
@cp include/* $(INSTALLDIR)/include
@cp lib/* $(INSTALLDIR)/lib
@echo "Done"
clean:
$(MAKE) -C mmio clean
$(MAKE) -C playercode clean
rm -f *.o libmikmod.a mikmodtest.elf
[edit]: okay this won't work exactly as the post does not preserve tabs...
[edit]: pm me if you want the file
-------------------------------------------------------------------------------------------
INSTALLDIR=/usr/local
OBJS = example.o
LIBS = $(INSTALLDIR)/lib/libmikmod.a $(INSTALLDIR)/lib/libmmio.a -lpspaudiolib -lpspaudio
TARGET = mikmodtest
all: libs
libs: mmio playercode
$(MAKE) -C mmio
$(MAKE) -C playercode
install: libs
@echo "Installing mikmodlib into $(INSTALLDIR)"
@mkdir -p $(INSTALLDIR)/include $(INSTALLDIR)/lib
@cp include/* $(INSTALLDIR)/include
@cp lib/* $(INSTALLDIR)/lib
@echo "Done"
clean:
$(MAKE) -C mmio clean
$(MAKE) -C playercode clean
rm -f *.o libmikmod.a mikmodtest.elf
ok, i did everything up to the zlib compile, i typed make, and i got this error:
any idea why this is happening? i did EVERYTHING you had there up to the zlib stuff... please help.
EDIT: hmmm nvm, seems i fixed it... i had to export everything first... you should add that to your tut...
Code: Select all
make: psp-config: Command not found
Makefile:9: /lib/build.mak: No such file or directory
make: *** No rule to make target '/lib/build.mak'. Stop.
EDIT: hmmm nvm, seems i fixed it... i had to export everything first... you should add that to your tut...
Would be a good idea to add this tutorial to a subpagee of http://wiki.ps2dev.org/psp:lua_player and while doing this, feel free to move the last change by joshdb to a subpage, too, perhaps called "code snippets".
-
- Posts: 27
- Joined: Sat Oct 01, 2005 7:24 pm
-
- Posts: 27
- Joined: Sat Oct 01, 2005 7:24 pm
-
- Posts: 27
- Joined: Sat Oct 01, 2005 7:24 pm
can't laugh at that point :(# if you get errors at this point, it is probably due to missing exports in the emulator.c file.
# this means that the emulator is not yet up to date. You have 2 choices:
# 1. implement the functions yourself
# 2. wait for Shine to do so :)
i get TONS of errors
for example:
Code: Select all
src/emulator/emulator.c:1:23: pspkernel.h: No such file or directory
Code: Select all
pspkernel.h C:\cygwin\usr\local\pspdev\psp\sdk\include
just to show up the last few:
Code: Select all
rc/emulator/windows/windows.c:48: error: initializer element is not constant
rc/emulator/windows/windows.c:48: error: (near initialization for `specialKeyM
pings[3].psp')
rc/emulator/windows/windows.c:48: error: initializer element is not constant
rc/emulator/windows/windows.c:48: error: (near initialization for `specialKeyM
pings[3]')
rc/emulator/windows/windows.c:49: error: initializer element is not constant
rc/emulator/windows/windows.c:49: error: (near initialization for `specialKeyM
pings[4]')
rc/emulator/windows/windows.c: In function `display':
rc/emulator/windows/windows.c:61: error: `u16' undeclared (first use in this f
ction)
rc/emulator/windows/windows.c:61: error: (Each undeclared identifier is report
only once
rc/emulator/windows/windows.c:61: error: for each function it appears in.)
rc/emulator/windows/windows.c: In function `main':
rc/emulator/windows/windows.c:141: warning: assignment from incompatible point
type
ake: *** [luaplayer.exe] Error 1
i ran ./toolchain.sh -n
and ./toolchain.sh -p
so newlibs and the sdk is fresh set up;
still the same errors!
greets
Lumo
PS: hope to get that fixed
Errors!
=D
=D
Code: Select all
Robin@mizukage ~/source/LuaPlayer
$ make -f Makefile.windows
gcc -o luaplayer.exe \
src/graphics.c src/sound.c src/luaplayer.c src/luacontrols.c src/luagrap
hics.c src/luasound.c src/luasystem.c src/utility.c \
src/emulator/emulator.c src/emulator/framebuffer.c src/emulator/windows/
windows.c src/emulator/md5.c \
-I/usr/local/pspdev/psp/sdk/sdk/include -I/usr/local/pspdev/psp/sdk/incl
ude -Isrc -L/usr/local/lib -lglut32 -lglu32 -llua -llualib -lopengl32 -lpng -lke
rnel32
src/emulator/emulator.c:9:19: md5.inc: No such file or directory
src/emulator/emulator.c: In function `sceKernelUtilsMd5Digest':
src/emulator/emulator.c:597: error: `MD5_CTX' undeclared (first use in this func
tion)
src/emulator/emulator.c:597: error: (Each undeclared identifier is reported only
once
src/emulator/emulator.c:597: error: for each function it appears in.)
src/emulator/emulator.c:597: error: parse error before "ctx"
src/emulator/emulator.c:598: error: `ctx' undeclared (first use in this function
)
make: *** [luaplayer.exe] Error 1
Proud Dvorak User
US 1.5 PSP (Original)
US 1.5 PSP (Original)
-
- Posts: 27
- Joined: Sat Oct 01, 2005 7:24 pm
Zenurb:
These are the missing functions in the emulator. I have patched the build to include these (also added serial IO, not tested and added pixel perfect collision detection: Image:hitTest ).
I am new to linux so need some assistance in generating diff / patch sets so that I can send the changes to Shine (or you).
If you can help me with this then I can sort out your errors.
As a quick fix, change the emulator.c file to include "md5.h" not "md5.inc" and that error should disappear.
btw. Thanks for the excellent edit you did on the tut, made it look MUCH better :)
-(e)
These are the missing functions in the emulator. I have patched the build to include these (also added serial IO, not tested and added pixel perfect collision detection: Image:hitTest ).
I am new to linux so need some assistance in generating diff / patch sets so that I can send the changes to Shine (or you).
If you can help me with this then I can sort out your errors.
As a quick fix, change the emulator.c file to include "md5.h" not "md5.inc" and that error should disappear.
btw. Thanks for the excellent edit you did on the tut, made it look MUCH better :)
-(e)
mikmodlib is already in the SVN. Currently only the header files are used for the windows version, at least for my version. Did you manage to compile a working sound support? I don't know, if this should be done with enhancing the emulator.c or with native mikmod support.sweetlilmre wrote: Cool I'll look into it. Where could we host the Makefile for mikmod (the linux / cygwin makefile)? Could you put it into SVN along with the mikmod3.0.3 source?
The md5 files are already in the SVN and included in the makefile, as md5.h and md5.c, update from SVN.sweetlilmre wrote: These are the missing functions in the emulator. I have patched the build to include these (also added serial IO, not tested and added pixel perfect collision detection: Image:hitTest ).
I am new to linux so need some assistance in generating diff / patch sets so that I can send the changes to Shine (or you).
If you can help me with this then I can sort out your errors.
As a quick fix, change the emulator.c file to include "md5.h" not "md5.inc" and that error should disappear.
The image:hitTest sounds interesting, I can include it in the SVN, send it by eMail to [email protected] . If you want to do more for Lua Player, perhaps ask Oobles for SVN write access.
How do you select your .lua files in windows? I used a compile method on the lua.org site and came up with lua_static. now what do i do? do i have to retype ALL of my code into there? or can i point it to the index.lua? ive tried to load the index through there but it comes up (cannot define global)! how do i fix this. I dont want to retype everything. Is there a way to write your lua's in a text editor then import that .lua file? please help me. This is my first time (as you can probably tell) writing on windows i normally write on psp but i thought i would try my hand at windows. HELP!
About sound on desktop platform:
I stupidly removed the makefile for all platforms but PSP when putting mikmodlib together. Feel free to search the forum for the original mikmod release, and find the windows makefile in that dist, and sound support should be trivial to add to the Windows and other desktop versions of LuaPlayer. (Perhaps you can use the makefile from the official mikmod release (it's the version before the libmikmod era, 3.1.6 I believe))
I stupidly removed the makefile for all platforms but PSP when putting mikmodlib together. Feel free to search the forum for the original mikmod release, and find the windows makefile in that dist, and sound support should be trivial to add to the Windows and other desktop versions of LuaPlayer. (Perhaps you can use the makefile from the official mikmod release (it's the version before the libmikmod era, 3.1.6 I believe))
Im sorry i just dont get it. am i supposed to get a black word prompt screen? i put in luaplayer.exe then index.lua but it says i need a "=" near index how do i solve this. do I need index.lua to be in a specific folder? i currently have it next to the static_lua file.exe i tried typing them on the same sentence and diffent lines but still nothing. Please help!!!!
Can ANYONE send me([email protected]) the .dll's?When i compile it it compiles OK but i cannot find the .dll file that is supposed to result from this. : ( And exactly which dll's am i supposed to have in my luaplayer.exe folder? names please. and again im incredibly sorry for all these questions.
you need to open a cmd go to the folder with luaplayer.exe and the script.lua file then type
hit enter, then it should work
greets
Code: Select all
luaplayer.exe script.lua
greets
ok this is my problem. i cannot get my code loaded i already asked Lumo and stuff but still. it gives me an error saying that the file doesnt exist. Ive included a picture, which shows the file tree containing my file, the error(window under the file tree) and the actual file and luaplayer in the background. PLEASE anybody that experienced or knows anything about this problem HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ohh by the way the luaplayer in the command window(the one with the error) doesnt have .exe after it. please dont tell me to put .exe becuase i already did
ohh by the way the luaplayer in the command window(the one with the error) doesnt have .exe after it. please dont tell me to put .exe becuase i already did