Unsupported platform help

Hello, I’m trying to port Libretro to WarpOS, and having some trouble understanding a couple concepts. I downloaded the Retroarch-Master from git and extracted it. Ran configure and had to set no-dynamic and with SDL. Ran make and it seemed to build everything ok up until it tried to link to libretro.

Here’s the part that I don’t understand, where/what package is libretro supposed to be built from?

I downloaded the SNES2010 core and tried to build that but also failed when it tried to link. The platform I’m using doesn’t like git, in that it just hangs whenever it tries to fetch packages. So I’m just downloading the master files from git.

Am I supposed to start with libretro-super and download a game core into that directory first?

Does WarpOS support dynamic linking? If so, you would want to build RetroArch and then link to the core dynamic libraries at runtime.

The process you’re going through in your post is used for statically linking RetroArch with a single libretro core, which is fine, but you’ll need to compile a core library into a *.a file, which you move/rename to libretro.a and place within the RetroArch source tree.

Thanks for the quick response.

No dynamic linking doesn’t exist on this platform so I have the joy on this platform of trying to figure out the linking order and using -lretro.

So you’re saying I should just build a game core and use that as my libretro.a ? So if I were to build snex2010_libretro.a I would rename that to libretro.a and use that to link to retroarch?

Yep, that’s exactly right.

Thanks again, I’ll give that a try.

Ran into a problem with retroarch in /audio/audio_driver.c at line 218 " stddev = (unsigned)sqrt((double)accum_var / (samples - 2));"

It looks like accum_var is using a unit64_t which my platform is 32-bit and doesn’t have that type defined, which the compiler then tries to use __floatundidf to convert the unsigned 64-bit int to float-which doesn’t exist. Haven’t thought of a way around this, so I guess I’ll look into other frontends. Any suggestions of a minimalist frontend for SDL 1.2 for Video/Sound/Input?

Hmm, while RA isn’t simple by any stretch, I think it’s the only shot you really have. Lemme get some more eyes on this. I feel certain this should be a problem we’ve run into before.

EDIT: welp, I asked Alcaro about it and his response was:

“we have almost 1000 instances of {u,}int64_t across our codebase of which ~8 are in libretro.h. I don’t think it will ever be possible to run rarch on a platform not supporting that.”

So, not very encouraging.

Alcaro had some good news and a couple of requests:

“his compiler most likely does support uint64_t, but doesn’t know how to convert uint64_t to double, which is much easier to fix than removing uint64 completely; I also need to know what preprocessor macros warpos defines, so I can push an ifdef for that one; finally, I need a log from ‘make -k’ to catch other instances of the same issue”

I’ll get the output of make -k. I didn’t do a good job of explaining myself, many other programs on this platform use int64 or uint64 via stdint.h if it’s not existing in the sys/types.h.

Which it’s not throwing an error that unit64 or int64 is not defined I think it’s trying to convert a long long to a double via the sqrt which is a float function, which for some reason my compiler is trying to use a soft-float function to convert to a float, __floatundidf, which that function doesn’t exist in my toolchain for whatever reason. Very confusing for me what’s going on here.

-DWARPUP is really the only define I think is relevant.
But the specs file has this:

%{!warpup:%{!nostdinc:-isystem /gg/os-include} %{!ansi:%{!noixemul:-Dixemul} %{noixemul:-Dlibnix}} %{mcpu=603e:-D__603e__} %{mcpu=604e:-D__604e__} %{!noixemul:-D__ixemul__ -D__ixemul} %{noixemul:-D__libnix__ -D__libnix %{!nostdinc:-isystem /gg/includestd}} %{malways-restore-r13:-Derrno=(*ixemul_errno)} %{malways-restore-a4:-Derrno=(*ixemul_errno)} %{mrestore-r13:-Derrno=(ixemul_errno)} %{mrestore-a4:-Derrno=(ixemul_errno)} %{msoft-float: -D_SOFT_FLOAT}}
%{warpup:-I/gg/os-includeppc %{clib2:-I/gg/includeclib2} -D__PPC__ -DWARPUP %{posix: -D_POSIX_SOURCE} %{mrelocatable: -D_RELOCATABLE} %{mcall-sysv: -D_CALL_SYSV} %{mcall-aix: -D_CALL_AIX} %{!mcall-sysv: %{!mcall-aix: -D_CALL_SYSV}} %{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT} %{mlittle: -D_LITTLE_ENDIAN -Amachine(littleendian)} %{mlittle-endian: -D_LITTLE_ENDIAN -Amachine(littleendian)} %{!mlittle: %{!mlittle-endian: -D_BIG_ENDIAN -Amachine(bigendian)}} %{!mcpu
: %{mpower: %{!mpower2: -D_ARCH_PWR}} %{mpower2: -D_ARCH_PWR2} %{mpowerpc
: -D_ARCH_PPC} %{mno-powerpc: %{!mpower: %{!mpower2: -D_ARCH_COM}}} %{!mno-powerpc: -D_ARCH_PPC}} %{mcpu=common: -D_ARCH_COM} %{mcpu=power: -D_ARCH_PWR} %{mcpu=powerpc: -D_ARCH_PPC} %{mcpu=rios: -D_ARCH_PWR} %{mcpu=rios1: -D_ARCH_PWR} %{mcpu=rios2: -D_ARCH_PWR2}
%{mcpu=rsc: -D_ARCH_PWR} %{mcpu=rsc1: -D_ARCH_PWR} %{mcpu=403: -D_ARCH_PPC} %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} %{mcpu=603: -D_ARCH_PPC} %{mcpu=604: -D_ARCH_PPC}}

The make process fails during linking:

LD retaroarch Reaping winning child 0x26fd1210 PID 652812640

Live child 0x26fd1210 (retroarch) PID 654100752

obj-unix/audio/audio_driver.o: In function `audio_driver_deinit_internal’:

/Work/RetroArch-master/audio/audio_driver.c:218: undefined reference to `__floatundidf’

Reaping losing child 0x26fd1210 PID 654100752

make: *** [retroarch] Error 1

Removing child 0x26fd1210 PID 654100752 from chain.

Ah, thanks.

Alcaro pushed a couple of commits that might have you fixed up. Would you mind pulling down a new snapshot and trying again?

That seems to have resolved that issue, thanks, got a little further during linking.

This is pretty weird, I already have a libflac that I compiled, which doesn’t have this issue. I might try just substituting in my version. Now again getting the __floatundidf on deps/libflac/fixed.c 320-324

#ifndef FLAC__INTEGER_ONLY_LIBRARY residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0);

residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0);

residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0);

residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0);

residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0);

Using my libflac worked, so now I’m hung up on a missing function here in my buildchain, realpath. Working on resolving that now.

That’s resolved, now I’m getting an error that my sensei says is because I’m trying to dynamically link libretro.a.

That’s resolved, executable created but have just a black window with yellow text: [Config] Configuration directory not set. Cannot save con and it is cut off.

Seems I’m missing the xmb assets package. And a couple other things.

Is it possible or supported to run Retroarch in 16-bit mode? I take it that 24 or 32-bit is the default?

Since I statically linked a single core, do I have to tell Retroarch in a config file or otherwise that X core is available?

Also, I’m having trouble finding this information via searching since I keep getting to the wiki saying this page has been moved, XMB is the only GUI menu system that doesn’t require GL? RGUI requires GL? Is that correct?

I’m pretty sure 32-bit is as low as we go.

No, you shouldn’t need to tell it anything. Just ‘load content’ and pick the game.

XMB (the fancy PS3 crossbar-style menu) does require GL (or GDI) but RGUI (the green pixel-art one) does not.

Oh ok, I was confused by this page: https://github.com/libretro/docs/blob/master/docs/guides/RGUI.md Where it says “RGUI is currently only supported on hardware accelerated video drivers (OpenGL / D3D).”

It works without GL but it is not supported?

No, I think that’s just an error. It definitely works/is supported on non-accelerated drivers because RGUI was invented for and is still used on Wii/U, which don’t support hardware acceleration. I’m pretty sure it’s the only menu that works with xvideo/sdl, as well.

I managed to get RGUI launched in 16bpp but paths and such are all screwed up so I can’t actually navigate to where my ROMs are but it’s progress.

1 Like

Have you tried launching from a command line?

I have but it doesn’t seem to like that either, no output just a blank window when specifying a ROM. I managed to get it to load a ROM via RGUI but it hung on: [INFO] ENVIRON: SET_MEMORY_MAPS Which now I’m suspecting my SNES2010 core compile might have issues. It does display the ROM information and such, I’ll keep at it.

Also can I link multiple cores statically? As in -lquicknes_libretro.a -lsnes2010_libretro.a -lmame2003_libretro.a? Linking multiple cores didn’t work out it just picked the one in the middle which for me happened to be doom.

Anyway I managed to get PrBoom running, slowly. Also Snes2005 core, also slowly, with this-my CPU only shows at about 60% utilization so something is amiss.

1 Like

It seems that there is something fundamentally off with the timings on my build. With CPU utilization at about 50%, I had thought it was the other CPU that handles sound that was getting overloaded but that is also only at about 50%. The rate counter in the RGUI menu from whatever I set the Video Rate at starts counting down until it gets to around 28Hz. Games seem to run at about half speed. I don’t have the option of turning on threading on this platform as pthread.h or the like don’t exist.

Are there any variables anyone can suggest in the code to try modifying or setting statically?

After trying a few things I changed this in https://github.com/libretro/RetroArch/blob/master/libretro-common/features/features_cpu.c: From: #elif defined(mips) struct timeval tv; gettimeofday(&tv,NULL); time_ticks = (1000000 * tv.tv_sec + tv.tv_usec); To: #elif defined(mips) || defined(WARPUP) struct timeval tv; gettimeofday(&tv,NULL); time_ticks = (3000000 * tv.tv_sec + tv.tv_usec);

And: #elif defined(mips) || defined(DJGPP) struct timeval tv; gettimeofday(&tv,NULL); return (1000000 * tv.tv_sec + tv.tv_usec);

#elif defined(mips) || defined(DJGPP) || defined(WARPUP) struct timeval tv; gettimeofday(&tv,NULL); return (3000000 * tv.tv_sec + tv.tv_usec);

Turned Vsync on and set my monitor hz to 44.1 and sound rate to 22050. SNES2005 is almost the correct speed now with the sound pitch shifted down, still a tad slow but PrBoom is much faster. Now it detects my monitor as running at about 8hz. Obviously this is not a fix but I’m still playing around with it.