Compiling Android Cores

Hi I am still :slight_smile: trying to get my own android cores compiled. I managed to get a basic bit of info from the documentation (thanks to those on github). If successful, I want to write up a thorough guide for this and also supply split cores for bezel purposes).

Tried cross-compiling from windows - cygwin and msys2 - absolute mare! Went for the virtualbox ubuntu for compiling purposes - better :slight_smile:

Here is where I am right now.

  • installed sdk - check

  • Installed ndk (r15c and tried r10e) - check went 32bit

  • set paths to sdk and ndk - check

  • set paths to ANDROID_HOME and JAVA_HOME (not sure if needed but done) - check - using openjava

  • cloned libretro-super - check

If I now run ./libretro-build-android-mk.sh - off it goes compiling and creating dist fold with android sub folder (plus info and unix). Inside android subfolder

  • arm64-v8a - blank no contents

  • armeabi - cores eg 4do_libretro_android.so

  • armeabi-v7a - cores eg 4do_libretro_android.so

  • armeabi-v7a-neon - cores eg 4do_libretro_android.so

  • x86 - cores eg 4do_libretro_android.so

My retroarch is one from the google play store for the Nvidia Shield and as the buildbot address in the cfg was for armeabi-v7a, I assumed it was these cores i needed.

If i copy them across to my rooted shield in the correct core folder I either get one of 2 things (tried both with and without info file as precompiled cores still load without just showing full core filename instead of .info name)

Unmodified core (as in left libretro cpp alone) goto load cores, select core and still says no core loaded. Change core (rename core name in library of libretro cpp) - retroarch not responding.

I have tried all the other cores and get retroarch crash when i try to enter the load cores menu.

Sorry for the rambling. If anyone could shed any light on this then that would be fantastic.

Brent

2 Likes

Ramblings continued…

File sizes aren’t matching between pre-compiled cores and mine:

example

mednafen_wswan_libretro_android.so - 286kb in my /data/data/com.retroarch/cores

mednafen_wswan_libretro_android.so - 267.7kb in armeabi (dist folder)

mednafen_wswan_libretro_android.so - 267.7kb in armeabi-v7a (dist folder)

mednafen_wswan_libretro_android.so - 276.5kb in armeabi-v7a-neon (dist folder)

mednafen_wswan_libretro_android.so - 321.0kb in x86(dist folder)

I was/am at least hoping that the v7a would be the same filesize.

2 Likes

Sorry i cant help with this but i would certainly use the split cores and attempt it myself with a good guide.

I really hope someone can help you out.

Good luck…you got way further than me already :+1:

1 Like

Cheers Thatman84. I have seen your name “popping” up around various forum searches on cores and compiling.

At least i have it compiling. What hehe who knows but it’s a start and I shall keep on keeping on :slight_smile:

I currently have build environments setup for…

cygwin

msys2

ubuntu under virtualbox

Hoping someone who has successfully compiled can give a learner like me a few pointers

I suppose the ultimate goal would be to prepare an OVA (virtualbox image file) of a completed environment - just drop in a clone of libretro-super and away you go.

Brent

Fingers crossed!

That OVA idea sounds great. Never thought about that.

Hi @brentg, in order to get more useful information you’ll need to check logcat to see what is causing the core load to fail. What cores have you tried to load on android that are failing? Is it one that you’ve confirmed already works from the buildbot?

1 Like

Hi Always been a bane trying to get logs from my nvidia shield - easy as pssss :wink: in the windows environment - but yeah I really need further info from the shield tv end as to what is failing.

As for cores, tried them all - unmodified and modified and same results just plain refusal to load core although they show up in load cores menu. Not sure how much of a role the info file plays other than proper naming and the role it plays when trying to load rom once core selected, bios, filetype etc.

Anyways next project getting logcat

Brent

Think i went the harder route by using adb terminal from a PC instead of an. Worth the trouble imo. I can dig out some info from my notes later when home.

Had to connect the shield by usb to the laptòp once iirc and now it all works over the network

Yep. I did customize (well lashed up really) a cable to run from my main pc to the shield when i was unlocking bootloaders/rooting etc.

I have seen somewhere sometime a reference to being able to use ADB thru wifi or ethernet. So if you could dig out any info that would be great and hopefully get me one step nearer :slight_smile: Brent

So i cant remember my setup for android sdk an ndk but its was floored I expect. I was able to decompile and compile the hyperspin app which was the goal orginally. Aswell as logcat for retroarch issues

Anyway here are my notes on the subject

https://drive.google.com/open?id=0B1v5ou8ATmXwZ3ZoSkwyTG5NNlU

1 Like

Does anything here help? https://github.com/libretro/mame2010-libretro/issues/23#issuecomment-261952891

1 Like

Have done a second fresh ubuntu install to test but not looking good. All the references to the android platform in the makefile don’t exist - not sure if they are out in the jni folder now

For the cores there seems to be 2 methods bouncing around…

  • run make from the core directory setting platform=android

  • using ndk-build from the jni directory to compile the core

What is the current accepted method in compiling cores? make from core folder? or ndk-build from jni subdir?

The “whole” toolchain has an ndk-build in it, but when I make a standalone toolchain I cannot find an ndk-build anywhere

Running the libretro-build-android-mk.sh uses ndk-build and as before seems to compile ok but the filesizes are different to what I expect and they dont launch.

Still stubborn as a mule and not giving up - hopefully if time tonight i can see what retroarch thinks about my poorly compiled cores by way of logcat

Brent

Great!

Thanks for that information I will try to logcat now.

hmmm Hyperspin - not right forum here - I may hit you up on their forums as thats next on my list for sub wheels and horzontal menus :slight_smile: Brent

I know its the wrong forum but…fyi horizontal wheel and sub menus on HS android is a no go.

Main -> Game list only

Vertical right wheel only

But if I can access the code I dont see any reason why it cannot be implemented.

I currently use tasker app to have a front end that just loads different main menu xmls - so i can have consoles only, handhelds only, mame genres only, etc.

Anyways compiling cores first - might have gotten mame2010 to compile correctly thanks to markwkidds link - shame it doesn’t apply globally as most of the cores do not have a specific android section in their makefile.

Brent

Just as you think you are gaining ground - nope lol.

My compiling seems to be going successful but when I copy across and try to launch - no go. hand typed from catlog application…

type=1400 audit(0.0.2012): avc: denied {open} for path=/data/user/0/com.retroarch/cores/game_gear_plus_gx_libretro_android.so and any other .so file I copy up.

Stupid question alert!!! I actually copy all cores to /data/data/com.retroarch/cores/ If I try to navigate to /data/user/0/… it changes the directory to the /data/data one anyways so I guess thats not the problem.

I have played and checked permissions too and set the same

so yet again sorry to be a pain in the backside but can anyone shed any light on this?

Thanks

Brent

1 Like

Have you taken a look at the recipes used by the libretro buildbot?

“avc: denied {open} for path=/data/user/0/com.retroarch/cores/game_gear_plus_gx_libretro_android.so”

Thats selinux blocking access, you would need to either set the proper selinux lables on the file or set selinux to permissive mode

1 Like

I am sure it is permission rather than compile related and have been looking into selinux.

Below is what happens if i download a core, try it - works ok, so I then move the core off to ext hd and move core back.

No crash just stays at no core and logcat snipped it below…

10-07 19:31:50.946 5389 5389 W Thread-2: type=1400 audit(0.0:265): avc: denied { open } for path="/data/data/com.retroarch/cores/81_libretro_android.so" dev=“mmcblk0p33” ino=469269 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0 tclass=file permissive=0

10-07 19:31:50.957 5365 5389 E RetroArch: Failed to open libretro core: “/data/user/0/com.retroarch/cores/81_libretro_android.so”

10-07 19:31:50.957 5365 5389 E RetroArch: Error(s): dlopen failed: library “/data/user/0/com.retroarch/cores/81_libretro_android.so” not found

1 Like

Success. Not sure if its the best solution but for now i went into terminal

su

setenforce 0

and suddenly all cores loaded, roms loaded split cores loaded and ran roms too.

Still must be missing something but at last thanks to everyones help - now can compile cores and modify :slight_smile:

Brent

1 Like