 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
greymouser
Joined: 20 Jan 2006 Posts: 5
|
Posted: Fri Jan 20, 2006 6:00 am Post subject: Porting glib (some progress, could use some help) |
|
|
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?
Last edited by greymouser on Fri Jan 20, 2006 7:03 am; edited 1 time in total |
|
| Back to top |
|
 |
greymouser
Joined: 20 Jan 2006 Posts: 5
|
Posted: Fri Jan 20, 2006 6:58 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Jan 20, 2006 7:14 am Post subject: |
|
|
The PSP doesn't have Unix signals, so using sigsetjmp doesn't make sense.
Regarding iconv, newlib does have it (ref) but we might not have enabled it on the build. |
|
| Back to top |
|
 |
greymouser
Joined: 20 Jan 2006 Posts: 5
|
Posted: Fri Jan 20, 2006 9:50 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Jan 20, 2006 9:52 am Post subject: |
|
|
| All the newlib dirent stuff should be fine, what's missing? |
|
| Back to top |
|
 |
greymouser
Joined: 20 Jan 2006 Posts: 5
|
Posted: Fri Jan 20, 2006 10:03 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
greymouser
Joined: 20 Jan 2006 Posts: 5
|
Posted: Fri Jan 20, 2006 10:28 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Jan 20, 2006 11:07 am Post subject: |
|
|
| Like sigsetjmp, those functions don't make sense on the PSP, that's why they don't exist. You could make stubs that just return fake data. |
|
| Back to top |
|
 |
|
|
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
|