Help compiling sample codes.

Hello :)
I'm an hobbyist game programmer who really loves the sega consoles, as such i started messing around with the sega genesis and master system. After a while i was curious to see if i could program something for the Saturn (never coded anything 3D before besides some tests with Unity 5), after searching for a time i found out about the SGL (and the whole SDK) and the Jo Engine, since SGL to my knowledge was a graphics library used back then by the saturn's developers, i decided to use it instead of Jo Engine.
After some struggle i was able to compile the GNU toolchain for the SH-2 and compile some samples provided with SGL, like the akira sample and demo_a, however there are some samples that i can't compile, like the "driving" sample, i get the following error mesages:

I get that undefined references happen because of some library that isn't linked properly in the executable, but i don't know which library i have to link, and after googling a bit i didn't find anyone using this SDK, does anybody know how to fix this?
If no one knows i'll probably move on to Jo Engine, but i would prefer to try some more with this one before that, i really wanted to code like the people way back then.
Also, sorry for any bad english, this isn't my native language. Thanks for the attention and reading until here.
Ok, just an update, i tried compiling the toolchain by myself following this thread, using a newer version of GCC and so on, now even the samples that previously i could compile, now i can't

Basically same error as before, but instead of it being an undefined reference to __sdivsi3 it's undefined reference to _memset.
Really would be grateful for some help here lol