[SOLVED] Requesting help compiling 8.90.4 with Retroarch

  • Hi everyone -

    I have recently had success compiling my own S905 and S912 images using the latest from adamg's git repository - GitHub - LibreELEC-AML/LibreELEC.tv: Just enough OS for KODI

    I am trying to add RetroArch to my build by copying over the retroarch package folders from the Lakka repository - GitHub - libretro/Lakka-LibreELEC: Lakka is a lightweight Linux distribution that transforms a small computer into a full blown game console.

    Unfortunately, when I try to build the retroarch package, I get a toolchain error:

    Code
    /storage/LibreELEC.tv.AML$ PROJECT=Amlogic DEVICE=S912 ARCH=arm scripts/build retroarch
      BUILD    retroarch-assets (target)
    Not possible to detect toolchain automatically. Add PKG_TOOLCHAIN= to package.mk

    Can someone help show me the proper way to add the retroarch package (and its dependencies) from Lakka into this other build tree?

    I noticed that when I run this build command in the Lakka tree, a script fetches the source files from github before building it. In the adamg tree, the build command does not download anything, so I suspect that might be part of the problem - but I do not know how to fix it :(

    If anyone could help, I would greatly appreciate it - thanks in advance!

  • Hi there,

    I'm currently doing a little bit of self education, and was wondering if you came across any guides on how to build Retroarch and cores for amlogic s905/x. Found plenty on compiling from scratch for Pi with very little effort. I've written my own addon for Kodi that launches roms directly, with a nice simple interface to do so, but with some nice features including the likes of MAME rom name scraping and more. At the moment, for amlogic, it relies on the Lakka cores and executable. I'm wanting to update Retroarch to 1.7.1(Pi version updated), but it looks like Lakka development has gone silent for the moment.

    like yourself any pointers would be a great help :)

  • I think Lakka is still being actively maintained - the repository I checked out was updated as recently as a week ago. Unfortunately when I tried adding these packages into another working build tree, I couldn't get them to build successfully anymore.

    I'm hoping someone can point me in the right direction as to how to add these packages properly so they compile with the rest of the adamg build tree I already have set up and working.

    Anybody? I can't be the only person out there trying to add Retroarch to the latest LE build, right?

  • Well, I figured it out...the package.mk files need to be tweaked a little bit to work with adamg's build.

    Now I'm just trying to figure out an elegant way to switch between RetroArch and Kodi.

  • Nice one.. Did it compile retroarch to 1.7.1 or Lakka's 1.6.7?

    The easiest way is to just write a little addon that suspends Kodi and launches retroarch by calling a bash script to do so.

    I'll write up a quick example and share it up in a bit.

  • It compiled 1.7.0, because that's the package version currently being pointed to in the package.mk file I was using. I suppose I could try updating it to a new version and have it compile 1.7.1, but I haven't gotten around to it yet.

    For now I've been using a script that stops the kodi service, runs retroarch, then starts kodi again. I haven't had any success getting suspending and resuming with kill -SIGCONT via a bash script, though I would prefer this option - just haven't gotten it to work yet.

    Code
    kodi-ra:~ # retroarch --version
    RetroArch: Frontend for libretro -- v1.7.0 -- ff19aa2 --
    Compiler: GCC (7.3.0) 32-bitBuilt: Mar  7 2018
  • the thing a lot of people forget to do is to make sure the bash scripts permission is set to be executable.

    link to script below..

    sample script

    don't install it straight off.. uncompress, go to the switch.sh script and change the location of the executable and config paths and zip it up again.

    hope this helps

  • also, in the switch.sh script, you could delete line 9 'ICON_PATH' and replace $ICON_PATH on line 11 with $ADDON_DIR.

    it slipped my mind for a moment.. been a few months since I last played with addons in Kodi

  • Also been able to compile Retroarch for s905x from Lakka source using your provided link.. did not have to change anything to do with package.mk files though.. alls good.. cheers for the link... really did not think of using Lakka source to do this.

  • Thanks for the script, I'll give it a try!

    Glad you got it to compile yourself as well. For me, I had to change some of the PKG_GIT_URL lines to PKG_URL, and some other minor tweaks, like disabling the retroarch.autostart service.

  • FYI I tried the script, but after starting Retroarch, it appears that Kodi is still capturing all input events, so I'm unable to interact with Retroarch. For now I'm just going to go back to my script that completely stops the Kodi service before starting Retroarch.

    EDIT: Actually, the wireless controller is able to interact with Retroarch, so I guess that's all I really need anyways.

    EDIT 2: Suspending Kodi instead of stopping it completely also appears to be causing audio conflicts. If I suspend and start RetroArch, games have no sound. I have to stop the Kodi service altogether to get sound working in RetroArch.

    Edited 4 times, last by dapharsyde (March 9, 2018 at 6:58 AM).

  • This is a pretty terrible hack, but the only way I could get sound to work with Kodi suspended in the background was by telling it to use another audio device just before suspending it:

    Code
    curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.audiodevice","value":"ALSA:hdmi:CARD=NVidia,DEV=0"},"id":1}' http://localhost:8080/jsonrpc
    
    pgrep kodi.bin | xargs kill -SIGSTOP

    This allows RetroArch to use the audio device.

    After resuming Kodi, I run a similar command, except this time I set the audio device back to the correct one.

    Code
    pgrep kodi.bin | xargs kill -SIGCONT
    
    curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.audiodevice","value":"ALSA:hdmi:CARD=NVidia,DEV=1"},"id":1}' http://localhost:8080/jsonrpc
  • Yea I'm seeing this issue on my x86_64 devices, but not the Amlogic S912 build. I'm building them from different trees so that might be the reason for the difference (the x86_64 is from LibreElec.tv master, the S912 is from adamg's repository)

    I'm able to work around the issue with the hack above, and setting System – Audio – Keep Audio Device Alive – OFF

    It's not pretty, but it works :)

  • I'm wanting to update Retroarch to 1.7.1(Pi version updated), but it looks like Lakka development has gone silent for the moment.

    If you only want Retroarch, you can use the source directly from GitHub - libretro/RetroArch: Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3. I compile it with a few patches, but in general it doesn't need any mayor changes, you will need to add PKG_TOOLCHAIN if you are using adamg's souce

    Here is my example package

    Sx05RE/packages/sx05re/retroarch-sx05re at Sx05RE_8.2 · shantigilbert/Sx05RE · GitHub

    The reason I made mine to fully quit Kodi was that I noticed a bit of performance issue when Kodi was in the background, specially in input lag, but not sure if it was just for my box.

    I also created a patch to re-enable content that was left out of Lakka (like the core download) so you can use those cores instead of compiling your own, but I will be honest, I haven't used it on a clean LE build, so not sure if it works 100%.

  • This is a pretty terrible hack, but the only way I could get sound to work with Kodi suspended in the background was by telling it to use another audio device just before suspending it:

    Code
    curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.audiodevice","value":"ALSA:hdmi:CARD=NVidia,DEV=0"},"id":1}' http://localhost:8080/jsonrpc
    
    pgrep kodi.bin | xargs kill -SIGSTOP

    This allows RetroArch to use the audio device.

    After resuming Kodi, I run a similar command, except this time I set the audio device back to the correct one.

    Code
    pgrep kodi.bin | xargs kill -SIGCONT
    
    curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.audiodevice","value":"ALSA:hdmi:CARD=NVidia,DEV=1"},"id":1}' http://localhost:8080/jsonrpc

    Maybe you could set Retroarch to use alsathread? It fixed most of the audio problems with me

  • If you only want Retroarch, you can use the source directly from....

    I actually got that side of things well a truly sorted yesterday... also I discovered I could easily build a non-laka Retroarch executable simply by going into the build folder for your chosen architectures Retroarch, give it a clean and build it again. Full Retroarch without any of Lakkas custom bits, and full Retroarch Update system for the like of assets, cheats, overlays, etc are back in the menu. The first thing I tried before going down the Lakka route was your suggestion. Cheers