Is there a way to compile Libretro cores for Android on Android?

I wanted to know if there is a way to compile Libretro cores such as the Atari800 core from a makefile using tools on Android. Could someone please help me with this? I can’t use Linux.

I don’t know of any way to compile stuff directly in Android, no.

Yes, but it requires root if you want it to work smoothly.

You can use gnuroot otherwise but it has ads and is a giant file I/O hack.

Install Linux: https://github.com/meefik/linuxdeploy

Install android gcc: sudo apt-get install gcc-arm-linux-android

Compile your core:

cd coredir

make platform=unix CC=gcc-arm-linux-android

I have never done this, but I have installed linux on my android devices before.

If you have any questions or errors feel free to ask here and if I can I will help.

1 Like

@guicrith Can you please give more details on how to do this?I want to compile old versions of mGBA core.I installed Linux Deploy and don’t know how to do the next step,thanks.

My guide above is way outdated, and gcc-arm-linux-android may not even exist in current linux repos.

Just a warning, this process will be very slow and so is x86_64 linux on an arm device, I have never used emulation mode on linux deploy and cant guarantee it works but the author of linux deploy says it does.

Create a linux deploy profile and configure it.

Set “Architecture:” to “amd64” and configure the other options the way you would like.
You have to install an x86_64 linux and your device is likely armv7a(32 bit), so linux will be running in an emulator, expect mGBA to take 30min to compile.

Now start installing it and wait for it to finish.

Then just install the sdk and ndk like on a normal computer.

Add the android ndk tools dir(the one with “ndk-build” in it) to your $PATH variable.
Also set $NDK_ROOT_DIR to the root directory of the ndk.

Fork the repo at the desired commit number in in the linux enviroment.

cd repodir
make platform=android_“YOUR PHONES REAL CPU ARCHITECTURE”

Now go to a root file manager and copy the .so file from repodir,(the linux root filesystem begins at “/data/local/mnt/”) to the retroarch cores directory /data/data/com.retroarch/cores.

Change the user and group of the .so to RetroArchs app user id, set permissions to 0600.

If everything went right it should load a rom and play in RetroArch.

1 Like

Thank you so much for this tutorial!

I can’t root my device. Which is also why I can’t easily load older versions of cores that I find (hypothetically speaking).