DEV: How to compile toolchain only - EmuELEC/EmuELEC GitHub Wiki

How to help/contribute with development?

Many people that want to help are turned off because they think they need to compile the whole distro to do so, well its time I explain how to help, without compiling the whole distro.

Note about disk space

Before you start, keep in mind this is a big project, so a lot of disk space is needed, for example for one project this is the disk space:

21G	sources/
63G	build.EmuELEC-Amlogic-ng.aarch64-4.2/

So around 84GB is needed just for the sources and one project folder EmuELEC has 4 projects, so divide 63GB times 4 and that is you need to build all the projects. But remember this is not counting everything else that might be needed in your computer.

But for just the toolchain the space needed is about 25GB per project counting sources and the build folder

Building the toolchain

First follow the steps on github, with some slight changes. I will compile for Amlogic-ng, these instructions are for Ubuntu but I am sure they work for any Linux distro (although I cannot guarantee it), even on WSL2 (tried it on 18.04 and 20.04):

sudo apt update && sudo apt upgrade
sudo apt-get install gcc make git unzip wget xz-utils libsdl2-dev libsdl2-mixer-dev libfreeimage-dev libfreetype6-dev libcurl4-openssl-dev rapidjson-dev libasound2-dev libgl1-mesa-dev build-essential libboost-all-dev cmake fonts-droid-fallback libvlc-dev libvlccore-dev vlc-bin texinfo premake4 golang libssl-dev curl patchelf xmlstarlet default-jre xsltproc xfonts-utils python
git clone https://github.com/EmuELEC/EmuELEC.git EmuELEC    
cd EmuELEC  
git checkout dev
PROJECT=Amlogic-ng ARCH=aarch64 DISTRO=EmuELEC ./scripts/build toolchain

This will compile JUST the toolchain for Amlogic-ng.

For Amlogic do:
PROJECT=Amlogic ARCH=aarch64 DISTRO=EmuELEC ./scripts/build toolchain

For OdroidGoAdvance:
PROJECT=Rockchip DEVICE=OdroidGoAdvance ARCH=aarch64 DISTRO=EmuELEC ./scripts/build toolchain

For GameForce:
PROJECT=Rockchip DEVICE=GameForce ARCH=aarch64 DISTRO=EmuELEC ./scripts/build toolchain(edited)

NOTE: you can replace ./scripts/build with ./scripts/build_mt to build in multi thread mode which should be faster.

Once you have the toolchain, which takes about 15 minutes to build depending on your computer, you can build single packages

for example: PROJECT=Amlogic-ng ARCH=aarch64 DISTRO=EmuELEC ./scripts/build flycast

resulting core will be in build.xxxxxxxxx/install_pkg/flycast-xxxxxxx folder

At this point you can now create your own package.mk for any core/emulator/program but I won't go into detail as it depends on what you want to compile but there is a very comprehensive README about packages.mk here https://github.com/EmuELEC/EmuELEC/tree/master/packages as well as some templates.

Once you have your package built, you can copy them via network to /emuelec/bin or if its a lib to /emuelec/lib you can SSH to your device, and execute your new binary, or make a script and run it. Those paths are both first priority on the env variables (PATH and LD_LIBRARY_PATH), so anything you put there will be executed before the ones in /usr/bin or /usr/lib, even retroarch and emulationstation.

An example, say you compiled a retroarch core, copy the resulting xxxx_libretro.so (it needs to end in _libretro.so) to /tmp/cores (or Cores on network share) then edit the es_systems.cfg, add the corresponding core to the section you want it to appear, or create a new one for that core, restart ES and you should now be able to run that core directly.

Further discussion can be done via Discord on the #dev-tech-talk channel