Compiling Android Cores

Im not getting to the online updater from my S7. Task failed

It was being shared temp from laptop, once fixed I will find a more permanent address.

ls -lZ found the culprit…

Good version:

-rw------- 1 u0_a199 u0_a199 u:object_r:app_data_file:s0:c512,c768 mgba_libretro_android.so

Bad version (or one that runs with setenforce 0:

-rw------- 1 u0_a199 u0_a199 u:object_r:app_data_file:s0: mednafen_wswan_mono_libretro_android.so

:c512,c768 it is then :slight_smile: now to find out how, where and a bit of why

Brent

1 Like

I really hope someone can help you out.

Im a bit out of my depth at this point but…

From the root shell in that directory try

chcon --reference=mgba_libretro_android.so mednafen_wswan_mono_libretro_android.so

this should change the labels on mednafen_wswan core to match the ones from mgba core

Not out of depth to me :slight_smile:

I tried to set the categories using chcon directly - assigning both the c512 and c768 which got accepted though I couldn’t see the categories on an ls -Z still (maybe a restorecon??? command needed to fix) - After playing with removing apparmour and installing selinux on my now dedicated build laptop lol, I had a few unmodified cores that built with correct permissions. So yet again even nearer.

I shall try to reference a working core and see if it assigns and shows.

Side note - I am now looking for somewhere to store these cores as an online updater - anyone know of any sites where I can store and access these files directly?

Thanks

Brent

Calling all testers!!!

core_updater_buildbot_url = “http://cores.pagekite.me/cores/

I have a selection of cores on there - some inherited, some by me - info files need creating (unless someone knows how to supply/upload them too)

I have rebooted and tried without disabling security and it worked here so I could do with someone giving it a test please. - Nvidia Shield owners or anyone using arm-v7a.

Currently shared from home connection but always accessible via the - http://cores.pagekite.me/cores/ address.

EDIT:

I took a look into the info files too and managed to share those.

My retroarch.cfg now has these sets of lines (at the top initially lol but retroarch has a habit of moving the cfg around):

oh and i had to put the hash sign as text here in the post even though you should hash symbol those lines to comment that out in the actual retroarch.cfg. hash makes a bold heading style in posts :confused:

hash core_updater_buildbot_url = “http://buildbot.libretro.com/nightly/android/latest/armeabi-v7a/

core_updater_buildbot_url = “http://cores.pagekite.me/cores/

hash core_updater_buildbot_assets_url = “http://buildbot.libretro.com/assets/

core_updater_buildbot_assets_url = “http://cores.pagekite.me/assets/

This way you can grab the split cores and goto online update and get the info files for them too - i had to exit retroarch and re-enter for the info files to take effect and show in the load cores feature.

Also tested the info files existing are not touched and remain. Once you have grabbed what you need, simply go back in and switch the hashes around making the defaults live again and the “pagekite” ones as comments.

EDIT 2

Turns out retroarch.cfg has a habit of deleting comment/hash lines too :frowning: so semi ignore the 4 lines just make sure you set them both to the pagekite one to grab split cores and matching infos

Eagerly awaiting feedback

Brent

1 Like

Man im plasterboarding tonight after work! Will try to test though

Ok i forgot I can do this on my phone lol

Download the GG core and info files and tested outrun for like 20 seconds. All loaded perfect.

Although i cant access the updater again or download the info files on a second atempt

Edit It started reading the core updater again. Now. Guess its just an iffy connection.

Great work Brent :grin::grin:

Just to give credit where credit is due on some of these cores (though this is still WIP and I hope to replace them all with my own)

cap32_libretro_android.so.zip <----lindqvist updater

gambatte_gb_libretro_android.so.zip <---- @zoragon

gambatte_gbc_libretro_android.so.zip <---- @zoragon

game_gear_plus_gx_libretro_android.so.zip <---- @zoragon

hatari_libretro_android.so.zip <----lindqvist updater

master_system_plus_gx_libretro_android.so.zip <---- @zoragon

mednafen_ngp_color_libretro_android.so.zip <----- me

mednafen_ngp_mono_libretro_android.so.zip <----- me

mednafen_pce_fast_tg16_libretro_android.so.zip <----- me

mednafen_pce_fast_tgcd_libretro_android.so.zip <----- me

mednafen_wswan_color_libretro_android.so.zip <----- me

mednafen_wswan_mono_libretro_android.so.zip <----- me

Adding and playing, playing and adding still

Brent

2 Likes

Updated cores now (some in test though marked in italic) all cores now compiled by me in this list with accompanying info file as explained in previous post.

The atari cores are in test - more firmware is required and is listed in the info file. I am trying to have split cores for different Atari Bezels

The Vice cores (Commodore 64,128 etc.) - looks like currently the core only runs c64 roms (from the readme) but I split down anyways.

atari800_libretro_android.so.zip

atari5200_libretro_android.so.zip

atarixegs_libretro_android.so.zip

bsnes_mercury_performance_mario_libretro_android.so.zip

bsnes_mercury_performance_sfam_libretro_android.so.zip

bsnes_mercury_performance_snes_libretro_android.so.zip

cap32_libretro_android.so.zip

gambatte_gb_libretro_android.so.zip

gambatte_gbc_libretro_android.so.zip

genesis_plus_gx_gen_libretro_android.so.zip

genesis_plus_gx_gg_libretro_android.so.zip

genesis_plus_gx_sms_libretro_android.so.zip

hatari_libretro_android.so.zip

vice_x64_libretro_android.so.zip

vice_x128_libretro_android.so.zip

vice_xplus4_libretro_android.so.zip

vice_xvic_libretro_android.so.zip

nestopia_fam_libretro_android.so.zip

nestopia_famj_libretro_android.so.zip

nestopia_nes_libretro_android.so.zip

mednafen_ngp_color_libretro_android.so.zip

mednafen_ngp_mono_libretro_android.so.zip

mednafen_pce_fast_pccd_libretro_android.so.zip

mednafen_pce_fast_tg16_libretro_android.so.zip

mednafen_pce_fast_tgcd_libretro_android.so.zip

mednafen_wswan_color_libretro_android.so.zip

mednafen_wswan_mono_libretro_android.so.zip

Still trying to crack the mame core - trickiest one of the lot for me yet probably the one i would use the most :slight_smile: sod’s law hehe

Brent

2 Likes

@hunterk @markwkidd @r-type

I heavily use the logs from buildbot to find out correct compiling techniques for different cores.

Trouble being that the logs only show the last (IIRC) 3 days of changed cores? These don’t always as far as I can see relate to the recipes.

Do you have any logs further back at all? I am especially looking for last successful compile of MAME and Picodrive logs for armeabi-v7a

Thanks

Brent

hi,

I don’t follow all this thread but for mame build you have to use different ndk.

for mame 2016 you should use ndk 10e . you can look at the buildbot conf file on libretro-super.

make OSD=retro RETRO=1 NOWERROR=1 NOASM=1 gcc=android-arm gcc_version=4.9 TARGETOS=android-arm CONFIG=libretro NO_USE_MIDI=1 OS=linux VERBOSE=1 verbose=1 OVERRIDE_CC=/home/buildbot/tools/android/android-ndk-r10e/toolchains/llvm-3.5/prebuilt/linux-x86_64/bin/clang OVERRIDE_CXX=/home/buildbot/tools/android/android-ndk-r10e/toolchains/llvm-3.5/prebuilt/linux-x86_64/bin/clang++ TARGET=mame -j4

For mame current ndk 13b at least

 make  OSD=retro verbose=1 RETRO=1 NOWERROR=1 NOASM=1 gcc=android-arm OS=linux TARGETOS=android-arm  CONFIG=libretro NO_USE_MIDI=1 TARGET=mame  -j4

for older (2014 and 2010) you just need to setup an android standalone toolchain

make  VRENDER=soft PTR64=0 CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ LD=arm-linux-androideabi-g++ platform=android emulator 
3 Likes

Well

Picodrive done and multiple copies up.

Managed to eventually get MAME to compile too but (and there’s always a but…

218mb??? It did zip down to around 70mb so like the current one

My goal is to compile MAME multiple times to allow a custom mame for each system I use - aquarius, intellivision, supervision etc.

I notice it makes just about every system while it compiles so once I get the size down to something more reasonable, I can see if I can strip out unwanted systems to make more “singular” mame compiles.

Passing target=mame or mess is one thing, but can we pass a target of a specific system? that way the build should be smaller. Not sure if it’s possible

Brent

1 Like

Note to self :slight_smile:

Seems /src/mame/drivers has all the drivers for mame including systems

SOURCES=src/mame/drivers/coleco.cpp REGENIE=1

Tried compile with added lines above and it compiled ok, copied across and loaded ok too - will be trying later

My compile works by running (from within libretro-mame folder)…

make -f Makefile.libretro platform=android -j3

1 Like

Thanks for keeping this updated. You doing a sterling job good progression. :smile:

Compiling Libretro Cores for Android on Ubuntu

*** Not saying this is THE way to do it, but it was MY way for getting cores working on the Nvidia Shield - probably an overkill at times :slight_smile: ***

Pre-ramble There is no one size fits all way to compile cores - different versions of NDK,Tools,etc. There is a recipes directory in libretro-super that “kinda” shows exactly whats needed to compile each core. As the guide below stands - I managed to compile 42 of the cores without any juggling - there are some more that compile by specifically naming it - so this guide covers the most part but the files below will allow you to compile more if you are prepared to change some paths later on.

Whats needed: Ubuntu 16.04 running (dedicated or a virtual machine) other flavours do work but this is the goto build.

Android NDK r15c - https://developer.android.com/ndk/downloads/older_releases.html

Android NDK r13b - https://developer.android.com/ndk/downloads/older_releases.html

Android NDK r10e - https://developer.android.com/ndk/downloads/older_releases.html

Android SDK latest - https://developer.android.com/studio/index.html

Android SDK r25.2.5 - https://androidsdkoffline.blogspot.fr/p/android-sdk-tools.html

java-8-openjdk-amd64 - (from terminal) sudo apt install default-jdk

ant - (from terminal) sudo apt install ant

Preliminary steps:

  1. Create a folder “android” in your home directory. <----THIS IS YOUR GOTO FOLDER EVERYTHING IS STORED IN HERE.

  2. Extract Android NDK r15c into folder “android-ndk-r15c” in the android directory.

  3. Extract Android NDK r13b into folder “android-ndk-r13b” in the android directory.

  4. Extract Android NDK r10e into folder “android-ndk-r10e” in the android directory.

  5. Extract Android SDK latest into folder “tools” in the android directory.

  6. Extract Android SDK r25.2.5 into folder “tools_r25.2.5” in the android directory.

  7. Make Standalone toolkit for android-ndk-r15c in folder “stdtc-r15c” and place in android directory.

    • from the android-ndk-r15c/build/tools directory…
    • make_standalone_toolchain.py --arch arm --api 21 --install-dir stdtc-r15c
  8. Make Standalone toolkit for android-ndk-r13b in folder “stdtc-r13b” and place in android directory.

    • from the android-ndk-r13b/build/tools directory…
    • make_standalone_toolchain.py --arch arm --api 21 --install-dir stdtc-r13b
  9. Make Standalone toolkit for android-ndk-r10e in folder “stdtc-r10e” and place in android directory.

    • from the android-ndk-r10e directory…
    • /build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androideabi-4.9 --platform=android-21 --install-dir=stdtc-r10e
  10. In terminal run (from the android directory) git clone https://github.com/libretro/libretro-super to clone the libretro-super folder

  11. From the newly created libretro-super directory run ./libretro-fetch.sh in terminal and go and grab a coffee (or 3). This will clone all the cores and retroarch and is a fair size.

  12. Finally we need to add the paths to our compiling tools - run from terminal -sudo gedit ~/.bashrc (or your preferred text editor)

*** Add these lines your .bashrc at the end ***

export ANDROID_HOME=~/android/tools_r25.2.5

export NDK_ROOT=~/android/android-ndk-r15c

export ANDROID_NDK=~/android/android-ndk-r15c

export ANDROID_STANDALONE_TOOLCHAIN=~/android/stdtc-r15c

export ANDROID_NDK_ARM=~/android/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64

export ANDROID_NDK_ROOT=~/android/android-ndk-r15c

export ANDROID_NDK_LLVM=~/android/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64

export TOOLCHAIN=~/android/android-ndk-r15c/toolchains

export ANDROID_TOOL_CHAIN=~/android/android-ndk-r1c/toolchains

export PATH=$PATH:/usr/share/ant/bin

export PATH=$PATH:~/android/stdtc-r15c/bin

export PATH=$PATH:~/android/tools_r25.2.5

export PATH=$PATH:~/android/android-ndk-r15c

export PATH=$PATH:~/android/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/

export CC=arm-linux-androideabi-gcc

export CXX=arm-linux-androideabi-g++

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

NOW REBOOOOOOOOOOOTTTTT!!!

If you got this far then well done - you now have a working environment to compile cores so lets do just that :slight_smile:

I was only interested in the armeabi-v7a cores so I changed the line in libretro-config.sh (in libretro-super directory) to - export TARGET_ABIS=“armeabi-v7a” - and deleted the other ones - it compiled far quicker for me not compiling unecessary targets. Probably a command line way but this worked.

To compile your first cores…

  1. For me, I need to change the permissions on the file libretro-buid-android-mk.sh in the “libretro-super” directory to allow execute (Allow executing file as program)
  2. From terminal, enter the libretro-super directory and run - ./libretro-buid-android-mk.sh This builds completed cores in the “dist/android/armeabi-v7a” directory. As previously stated some fail but I managed to get 42 cores compiled this way off the bat.

To get cores onto your Retroarch install… Cores need to be zipped and then moved onto your Retroarch.

Easiest way to do this (and it works on an non-rooted Shield) is to follow Thatman84’s excellent guide for creating an local updater here - http://emulationguide.com/retroarch-local-online-updater.

That should be that for now. Your next steps in exploration should be to look at the recipes and see what cores are compiled using different toolchains.

my .bashrc has multiple sections commented out (use a #) the one below is for the r13b NDK for example, some versions of mame if I recall prefer the older r10 version too. I just comment out all but the version I want to use and reboot.

export ANDROID_HOME=~/android/tools_r25.2.5

export NDK_ROOT=~/android/android-ndk-r13b

export ANDROID_NDK=~/android/android-ndk-r13b

export ANDROID_STANDALONE_TOOLCHAIN=~/android/stdtc-r13b

export ANDROID_NDK_ARM=~/android/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64

export ANDROID_NDK_ROOT=~/android/android-ndk-r13b

export ANDROID_NDK_LLVM=~/android/android-ndk-r13b/toolchains/llvm/prebuilt/linux-x86_64

export TOOLCHAIN=~/android/android-ndk-r13b/toolchains

export ANDROID_TOOL_CHAIN=~/android/android-ndk-r13b/toolchains

export PATH=$PATH:/usr/share/ant/bin

export PATH=$PATH:~/android/stdtc-r13b/bin

export PATH=$PATH:~/android/tools_r25.2.5

export PATH=$PATH:~/android/android-ndk-r13b

export PATH=$PATH:~/android/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/

export CC=arm-linux-androideabi-gcc

export CXX=arm-linux-androideabi-g++

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

I do have a google sheet that I have noted what compiled best for me and how I acheived it - I would be willing to share that with anyone interested.

So to sign out - I am not saying this is THE way and no doubt I added unecessary steps but if you followed this guide to the letter you certainly “should” have compiled cores sitting on your pc :slight_smile:

If people try this guide sucessfully please let me know and I will offer it to update the docs. Also if anyone has any improvements please share too :slight_smile:

Brent

1 Like

One last quicky.

for updating things:

In terminal enter your libretro-super directory and type git pull to update the main directory.

again in terminal (still in same folder) type ./libretro-fetch.sh to update the cores etc.

Brent

1 Like

Hi @brentg,would you mind compile two arm-v7a cores for me? I’ve tried compile cores on android but failed and I don’t have available compile environment on my old windows pc and don’t know how to use Linux.

Can I use this method to compile the mame core? There is no mame in WANT_CORES section (libretro-build-android-mk.sh),just found mame2000 and mame2003