Page 1 of 1

Need some advice compiling with libfreetype

Posted: Thu Jul 02, 2020 1:55 pm
by bladeoner
Hi there,

After compiling the Snes9x GX source with the latest libfreetype the application throws an error when started.
The compilation itself seems to go well without any error.

A really old libfreetype from 2010 is used to prevent the error and let the application start, which is just a workaround.

Because this is a long standing issue and we want to use the lastest tools and the issue resolved, there is a need of advice how to approach this error. I saw another post on this forum to add -lbz2, and the -lbz2 was added after libfreetype:

LIBS := -ldi -liso9660 -lpng -lmxml `freetype-config --libs` \
-lfat -lwiiuse -lz -lbte -lasnd -logc -lvorbisidec -logg -ltinysmb

LIBS := -ldi -liso9660 -lpng -lmxml `freetype-config --libs` \
-lbz2 -lfat -lwiiuse -lz -lbte -lasnd -logc -lvorbisidec -logg -ltinysmb

Exception (DSI) occurred!

GPR00 808E50E0 GPR08 00006C30 GPR16 9015C368 GPR24 00000010
GPR01 807A52D0 GPR09 00000000 GPR17 9014E700 GPR25 00000030
GPR02 804B8FC0 GPR10 808B6360 GPR18 00000004 GPR26 807A5320
GPR03 807AC754 GPR11 808B6350 GPR19 00000002 GPR27 80762D5C
GPR04 00000000 GPR12 00000019 GPR20 00000001 GPR28 00000000
GPR05 000D12C6 GPR13 805354A0 GPR21 0000000D GPR29 80762D4C
GPR06 808B6338 GPR14 80730030 GPR22 0000000E GPR30 808B6348
GPR07 00000076 GPR15 80530000 GPR23 00000000 GPR31 808D5810
LR 8023AD40 SRR0 8024b984 SRR1 00001032 MSR 00001000
DAR 00006C3C DSISR 06000000

8024b984 --> 8023ad40 --> 8023f7a0 --> 802456e4 -->
80005118 --> 802470d0 --> 8026106c --> 8025bcc8 -->

8024b984: 9148000C 810B0008 910A00008 48000090
8024b984: 39400000 2C090000 41820010 7D4000A6
8024b984: 614A8000 7D400124 38600000 4E800020

Reloading in 8 seconds


Thanks in advance.

Re: Need some advice compiling with libfreetype

Posted: Fri Jul 03, 2020 1:23 pm
by WinterMute
Adding -lbz2 is a bit pointless when you're already using freetype-config and probably not that relevant.

Code: Select all

$ /opt/devkitpro/portlibs/ppc/bin/freetype-config --libs
-L/opt/devkitpro/portlibs/ppc/lib -lfreetype -lbz2 -lpng16 -lz -lm -lz
Using an old library without the corresponding headers isn't the best of ideas either. I guess you've been fortunate with this in that it works.

In the error screen SRR0 holds the address where the DSI exception happened. LR is usually the previous function aand the stack dump section is a list of function addresses from the stack frames - the equivalent of gdb's backtrace.

You can find out what all of these are using addr2line

Code: Select all

powerpc-eabi-addr2line -e <your elf file> 0x<address>
Which should give you a hint as to where to start looking for the issue. Given that the fault address (SRR0) and the address in the first stack frame (0x8024b984) are both the same my first instinct would be that it's a stack overrun. Find out what it's failing on first though.

Re: Need some advice compiling with libfreetype

Posted: Fri Jul 03, 2020 1:30 pm
by bladeoner
Thank you for pointing me in the right direction.

I will try as suggested and let you know when I have some more information.

Re: Need some advice compiling with libfreetype

Posted: Tue Jul 14, 2020 8:14 pm
by bladeoner
Sorry, I didn't find the time to look into it further, but I did.

I attached the results of the LR, SRR0 and Stack Dump.

The problem seems to be there when the Wiimote is connected so I think a function to define the Wiimote is not used correctly in the Snes9x GX code, but I'm not sure.

Re: Need some advice compiling with libfreetype

Posted: Fri Jul 17, 2020 8:27 pm
by Tantric
This has been a long-standing issue ever since the latest portlib build of libfreetype was posted. With your freetype build, this issue happens. I never tracked it down, other than that if I use an older freetype or my own compile of freetype, everything works fine. If i use the portlib one, I get this crash in wiiuse consistently as soon as the wiimote is connected.

Another user suggested compiling without png and bz2 support might help.

Here's the thread where this was recently discussed:

Re: Need some advice compiling with libfreetype

Posted: Tue Jul 21, 2020 4:11 pm
by WinterMute
Thanks for stopping by Tantric, much appreciated.

Could you possibly chuck me the config.log from your own freetype build? It is the same version, right?

Re: Need some advice compiling with libfreetype

Posted: Tue Jul 21, 2020 11:21 pm
by Tantric
I haven't compiled this thing in eons. I dusted off my cross-compiling environment and compiled 2.9.1, and linked against that, and found the exact same wiiuse crash as soon as you connect the wiimote.

So...there's something about 2.9 that doesn't work for us. :cry: