Last night I spent many an hour trying to port glib-2.8.6 to the PSP. I reached some major roadblocks.
- Newer glib releases seem to require iconv, as well as gettext
--+ iconv functions are referenced in the pspsdk headers, but I can't find the symbols in the psp sdk libs, so presumbably it's either all inline header stuff or the symbols are on psp itself (?), so I was not able to use whatever pspsdk iconv support there is
--+ compiling GNU libiconv went w/o too much hassle (most of the compilation errors were easy to root out)
--+ At one point, I also made a stub iconv lib (in a "well, "just in case..." kind of moment) (which actually worked just as well/no better than the GNU one)
--+ either way, glib requires gettext, or easpecially, libintl, which I cannot get to build/install correctly whatsoever (linker relocation errors, etc.)
... so, is anyone else out there working on porting glib? Has anyone actually done it, or has gotten farther than I have?
Porting glib (some progress, could use some help)
-
- Posts: 5
- Joined: Fri Jan 20, 2006 5:14 am
Porting glib (some progress, could use some help)
Last edited by greymouser on Fri Jan 20, 2006 7:03 am, edited 1 time in total.
-
- Posts: 5
- Joined: Fri Jan 20, 2006 5:14 am
Okay, I fixed my R_MIPS_GPREL16 error in gettext. Passing -G0 to C[XX]FLAGS helped, atlhough I'm sure that comes at a theoretical performance hit (not that I really care about gettext speed).
However, now I got a legit compilation error, in gettext:
msgfmt.c:795: error: syntax error before 'sigfpe_exit'
msgfmt.c:795: warning: data definition has no type or storage class
Line 795 is:
static sigjmp_buf sigfpe_exit;
Doing a quick
# for in in `find . -name "*.h"`; do cat $i | grep sigjmp && echo $i; done
# for in in `find . -name "*.c"`; do cat $i | grep sigjmp && echo $i; done
reports no matches...but...yeah...any ideas? I know this structure is used in sigsetjmp() and longjmp() ... should it be in the PSP SDK, or is a totally a POSIX thing?
However, now I got a legit compilation error, in gettext:
msgfmt.c:795: error: syntax error before 'sigfpe_exit'
msgfmt.c:795: warning: data definition has no type or storage class
Line 795 is:
static sigjmp_buf sigfpe_exit;
Doing a quick
# for in in `find . -name "*.h"`; do cat $i | grep sigjmp && echo $i; done
# for in in `find . -name "*.c"`; do cat $i | grep sigjmp && echo $i; done
reports no matches...but...yeah...any ideas? I know this structure is used in sigsetjmp() and longjmp() ... should it be in the PSP SDK, or is a totally a POSIX thing?
-
- Posts: 5
- Joined: Fri Jan 20, 2006 5:14 am
So, I managed to add iconv support to newlib -- thanks for the hint!
I munged the GLIB code a bit ... they took out --disable-nls, so it really does require gettext...there was old code in glibintl.h that did the work for the old --disable-nls option, which I have reenabled, for now (at least).
The build starts now...failing at gdir.c which uses POSIX dirent a lot. I'm poking around at patching newlib to build the posix library -- which seems like it's mostly for readdir and such...so I guess I need to read up on pspopfilemgr.h, but it actually looks feasible (heh, i think).
Again, thanks for the iconv hint.
I munged the GLIB code a bit ... they took out --disable-nls, so it really does require gettext...there was old code in glibintl.h that did the work for the old --disable-nls option, which I have reenabled, for now (at least).
The build starts now...failing at gdir.c which uses POSIX dirent a lot. I'm poking around at patching newlib to build the posix library -- which seems like it's mostly for readdir and such...so I guess I need to read up on pspopfilemgr.h, but it actually looks feasible (heh, i think).
Again, thanks for the iconv hint.
-
- Posts: 5
- Joined: Fri Jan 20, 2006 5:14 am
Ahh, good point, a quick:
# find . -name "dirent.h"
and a scan of the file proved things should be working. ... brain lockup on my part.
ugh, looks like my glibintl.h / gettext stub isn't going to cut it, which uses #defines ... i may have to write a "real" intl library stub ... that or the #defines are hiding a missing semicolon error in some file they're included in.
... still hacking -- thanks again.
# find . -name "dirent.h"
and a scan of the file proved things should be working. ... brain lockup on my part.
ugh, looks like my glibintl.h / gettext stub isn't going to cut it, which uses #defines ... i may have to write a "real" intl library stub ... that or the #defines are hiding a missing semicolon error in some file they're included in.
... still hacking -- thanks again.
-
- Posts: 5
- Joined: Fri Jan 20, 2006 5:14 am
Okay, things are actually really coming along. Much of glib is compiled. Mainly I'm having to munge some of the stuff where G_OS_WIN32 meant "not UNIX" rather than "hi, I'm Windows".
One thing, linking this particular file:
/bin/sh ../libtool --mode=link psp-gcc -G0 -Wall -L/home/armando/Projects/PSP/pspdev/psp/lib -L/home/armando/Projects/PSP/pspdev/psp/sdk/lib -o glib-genmarshal glib-genmarshal.o ../glib/libglib-2.0.la -lc -lpspuser -lpsplibc
psp-gcc -G0 -Wall -o glib-genmarshal glib-genmarshal.o -L/home/armando/Projects/PSP/pspdev/psp/lib -L/home/armando/Projects/PSP/pspdev/psp/sdk/lib ../glib/.libs/libglib-2.0.a -lc -lpspuser -lpsplibc
../glib/.libs/libglib-2.0.a(gutils.o): In function `g_get_any_init_do':
gutils.c:(.text+0x1568): undefined reference to `setpwent'
gutils.c:(.text+0x1570): undefined reference to `getuid'
gutils.c:(.text+0x157c): undefined reference to `getpwuid'
gutils.c:(.text+0x1588): undefined reference to `endpwent'
gutils.c:(.text+0x1760): undefined reference to `gethostname'
Now,
# for i in `find . -name "*.h"`; do cat $i |grep gethostname && echo $i; done
int _EXFUN(gethostname, (char *__name, size_t __len));
./psp/include/sys/unistd.h
... that returns something, but I can't find a psp sdk library that has that symbol defined.
If you have any ideas, please let me know -- I think I'm getting close. Thanks.
One thing, linking this particular file:
/bin/sh ../libtool --mode=link psp-gcc -G0 -Wall -L/home/armando/Projects/PSP/pspdev/psp/lib -L/home/armando/Projects/PSP/pspdev/psp/sdk/lib -o glib-genmarshal glib-genmarshal.o ../glib/libglib-2.0.la -lc -lpspuser -lpsplibc
psp-gcc -G0 -Wall -o glib-genmarshal glib-genmarshal.o -L/home/armando/Projects/PSP/pspdev/psp/lib -L/home/armando/Projects/PSP/pspdev/psp/sdk/lib ../glib/.libs/libglib-2.0.a -lc -lpspuser -lpsplibc
../glib/.libs/libglib-2.0.a(gutils.o): In function `g_get_any_init_do':
gutils.c:(.text+0x1568): undefined reference to `setpwent'
gutils.c:(.text+0x1570): undefined reference to `getuid'
gutils.c:(.text+0x157c): undefined reference to `getpwuid'
gutils.c:(.text+0x1588): undefined reference to `endpwent'
gutils.c:(.text+0x1760): undefined reference to `gethostname'
Now,
# for i in `find . -name "*.h"`; do cat $i |grep gethostname && echo $i; done
int _EXFUN(gethostname, (char *__name, size_t __len));
./psp/include/sys/unistd.h
... that returns something, but I can't find a psp sdk library that has that symbol defined.
If you have any ideas, please let me know -- I think I'm getting close. Thanks.