Issues porting libraries for PSP development

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

Moderators: cheriff, TyRaNiD

Post Reply
Neo-Rio
Posts: 11
Joined: Thu Jul 03, 2008 5:26 pm

Issues porting libraries for PSP development

Post by Neo-Rio »

Hi everyone,

I'm trying to build a PSP dev/build environment on Ubuntu

So far I have managed to successfully build the psptoolchain (from trunk/psptoolchain) as well as all the libraries from trunk/psplibraries.
Now I have turned my attention to getting some of the other libraries to build and I am having issues. I'm using svn revision 2399

Mainly I want zziplib to build, but the trunk/zziplib is unported. I've tried copying the config.sub from libtremor over to zziplib/uses (in order to get configure to recognise host=psp), and I can get as far as a proper configure (again, borrowing from the configure details of the libtremor install script from trunk/psplibraries) - although it starts whining about requiring aclocal-1.9
Thing is, the compile breaks (mmapped.c contains multiple errors)
Where to I pick up aclocal from?


aalib has similar issues (and doesn't even require a configure). Something goes wrong in aastdin.c (function stdin_getchar contains undeclared fd_set and readfds)

I have no idea how to get these builds to compile properly, but I think they'll need patches of one kind or another.

Any help?
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

aclocal is part of autotools, they provide you:

autoconf
automake
aclocal
and others.

You can get the version you need from your debian package repository or build them from source yourself from here:

http://www.gnu.org/software/autoconf/
http://www.gnu.org/software/automake/
http://www.gnu.org/software/libtool/

Not sure if you need the last one. Then download the version you need and build. The procedure is always the same:

./configure --prefix=/usr/local
make
make install
Neo-Rio
Posts: 11
Joined: Thu Jul 03, 2008 5:26 pm

Post by Neo-Rio »

autotools-dev is already installed (I have tried on both Debian and Ubuntu)

the configure looks for aclocal in the pspdev directory (as well as pkgconfig for that matter)

Thing is, there's no aclocal in there, but there IS an aclocal.m4 and an acinclude.m4 in the zziplib directory

Anyone got zziplib to build for PSP? I'm pulling my hair out here.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

have you tried to run autoreconf to install the missing stuff?
Neo-Rio
Posts: 11
Joined: Thu Jul 03, 2008 5:26 pm

Post by Neo-Rio »

yes, but that doesn't solve my problem. Autoconf on 8.04 Ubuntu is 2.61
I ran autoreconf on the zziplib source directory and it made a few changes. However it still refuses to configure correctly for building for the PSP.
I'm now using the latest psp2dev revision as well

I copied across the config.sub from sqlite for zziplib to use so that it understands what --host psp means. Now, however, the configure crashes out complaining:-

checking build system type... Invalid configureation `elf' : machine `elf' not recognised

I'm pretty sure the problem lies with config.sub, but I have no idea where to start trying to debug this.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Typically all you need is to add an alias for psp into the config.sub file:

Code: Select all

       psp)
               basic_machine=mipsallegrexel-psp
               os=-elf
               ;;
When you specify 'psp' as the target, you're actually building for a machine called 'mipsallegrexel-psp-elf' in a standard way. (cpu + hardware + os/executable type).

Just copying over the config.sub from another place may have some unintended consequences. You might want to try just adding the psp lines above, or manually specifying the full platform name to see if you can get it to build and worry about naming it 'psp' later on.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

I've added the stuff to config.sub in zziplib in the repository. I then configured it with this:

Code: Select all

LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" ./configure --host psp --prefix=$(psp-config --psp-prefix)
Then started to build, but got this:

Code: Select all

In file included from ../../zzip/mmapped.c:25:
../../zzip/mmapped.h:49: warning: type qualifiers ignored on function return type
../../zzip/mmapped.h:52: warning: type qualifiers ignored on function return type
../../zzip/mmapped.h:58: warning: type qualifiers ignored on function return type
../../zzip/mmapped.h:74: warning: type qualifiers ignored on function return type
../../zzip/mmapped.h:91: warning: type qualifiers ignored on function return type
../../zzip/mmapped.h:94: warning: type qualifiers ignored on function return type
../../zzip/mmapped.c:79: warning: type qualifiers ignored on function return type
../../zzip/mmapped.c:95: warning: type qualifiers ignored on function return type
../../zzip/mmapped.c:128: warning: type qualifiers ignored on function return type
../../zzip/mmapped.c:174: warning: type qualifiers ignored on function return type
../../zzip/mmapped.c:188: error: expected ';', ',' or ')' before 'a'
../../zzip/mmapped.c:242: warning: type qualifiers ignored on function return type
../../zzip/mmapped.c: In function 'zzip_disk_findfile':
../../zzip/mmapped.c:358: error: '_zzip_strcasecmp' undeclared (first use in this function)
../../zzip/mmapped.c:358: error: (Each undeclared identifier is reported only once
../../zzip/mmapped.c:358: error: for each function it appears in.)
../../zzip/mmapped.c: In function '_zzip_fnmatch':
../../zzip/mmapped.c:385: warning: implicit declaration of function 'puts'
../../zzip/mmapped.c: At top level:
../../zzip/mmapped.c:456: warning: type qualifiers ignored on function return type
../../zzip/mmapped.c: In function 'zzip_disk_entry_fopen':
../../zzip/mmapped.c:473: warning: pointer targets in assignment differ in signedness
../../zzip/mmapped.c: At top level:
../../zzip/mmapped.c:490: warning: type qualifiers ignored on function return type
make[3]: *** [mmapped.lo] Error 1
make[3]: Leaving directory `/home/danpeori/Coding/psp/zziplib/mipsallegrexel-psp-elf/zzip'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/danpeori/Coding/psp/zziplib/mipsallegrexel-psp-elf'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/danpeori/Coding/psp/zziplib/mipsallegrexel-psp-elf'
make: *** [all-all] Error 2
I don't have time right now to spend on it, but that should at least give you a bit of a head start on porting it...
Neo-Rio
Posts: 11
Joined: Thu Jul 03, 2008 5:26 pm

Post by Neo-Rio »

ooPo wrote:I've added the stuff to config.sub in zziplib in the repository. I then configured it with this:

Code: Select all

LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" ./configure --host psp --prefix=$(psp-config --psp-prefix)
This is the same configure line that I used.

Code: Select all

../../zzip/mmapped.c: In function 'zzip_disk_findfile':
../../zzip/mmapped.c:358: error: '_zzip_strcasecmp' undeclared (first use in this function)
../../zzip/mmapped.c:358: error: (Each undeclared identifier is reported only once
../../zzip/mmapped.c:358: error: for each function it appears in.)
This seems to be a common problem across some of the other libraries. It seems that the compiler has a few issues with code where certain things go undeclared. I have seen the same problem in aalib and the psppacker as well.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

This was the important line:

Code: Select all

../../zzip/mmapped.c:188: error: expected ';', ',' or ')' before 'a' 
It ends up that there was an extra underscore in this line:

Code: Select all

static int _zzip_strcasecmp(char* _zzip_restrict a, char* _zzip_restrict b)
Change __zzip_restrict to _zzip_restrict and it builds fine. Well, almost fine - the bins directory has to be skipped but that was easily removed from the makefile.

Its seems to build fine now and I've committed it to the repository. Feel free to test it.
Neo-Rio
Posts: 11
Joined: Thu Jul 03, 2008 5:26 pm

Post by Neo-Rio »

Cheers for that. I'll try it out!
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

I've also added it to the psplibraries script as #23.
Neo-Rio
Posts: 11
Joined: Thu Jul 03, 2008 5:26 pm

Post by Neo-Rio »

Great, I'll try that too.

I was having problems installing the libraries in Ubuntu because of file permissions. (I used sudo to build the psptoolchain and libraries), so maybe your script will sort this out. I'll let you know how it goes.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

When you use sudo, it clears out your path and other environment variables. This is usually why a 'sudo make install' will fail. You can either make the destination directory user-writable, or re-set the environment variables after calling sudo. (This is all toolchain-sudo.sh does, btw... a wrapper to set the environment before calling toolchain.sh.)
Neo-Rio
Posts: 11
Joined: Thu Jul 03, 2008 5:26 pm

Post by Neo-Rio »

You might want to tweak your zzlib scirpt. It didn't svn the sources before it attempted to build for me (on a completely new install), so we end up with

Code: Select all

can't cd to zziplib
...because the script looks for the existance of a zlib directory in "build", and not zziplib. (and since zlib already exists, it failes to svn the zziplib sources)

no biggie to fix
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Doh! Fixed. :)
Post Reply