[SOLVED] Compile for LibreELEC / SDK (RPi3) ?

  • Sorry if this might sound stupid but finding documentation on this doesn't seem to be easy.

    I'm searching for a way to compile my own binaries for LibreELEC / Raspberry Pi 3. These binaries should not be Kodi addons as I want to start them with the help of .config/autostart.sh (or systemd) and said binaries should handle things like fan control, LED control and so on.
    So I'm simply searching a way to cross-compile for LibreELEC. Is there any good entry point for documentation?

    Side question: This is my (quick&dirty) Makefile, is there anything to do better (i.e. CFLAGS, I guess -march=native won't work while cross compiling) ?

    Edited once, last by V10lator (June 7, 2016 at 8:11 AM).

    • Official Post

    I normally copy simple x86_64 binary things over from an Ubuntu VM .. which generally works unless something is kernel specific or has a bunch of lib dependencies that aren't accounted for. If you really do need to compile things you're best off using the build-system and creating packages for them.


  • I normally copy simple x86_64 binary things over from an Ubuntu VM .. which generally works unless something is kernel specific or has a bunch of lib dependencies that aren't accounted for. If you really do need to compile things you're best off using the build-system and creating packages for them.

    Sorry, I forgot to say that this is for the Raspberry Pi 3, so x86_64 binaries won't work.


  • V10lator, why don't you create proper package for your programs and compile them as everything else is done in librelec?

    Cause I don't know how to "create proper package for your programs and compile them as everything else is done in librelec". Also I guess that means creating Kodi addons which isn't what I want.

    Anyway, I found this: Kernel building - Raspberry Pi Documentation - It's not only usefull to compile kernels. In a nutshell:

    Code
    git clone https://github.com/raspberrypi/tools
    PATH="${PATH}:$(pwd)/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin" /bin/bash


    This opens a bash with a altered PATH including cross-compile tools. In that bash the following Makefile worked:


    While this is great progress there's one thing that annoys me: The gcc version used is from 2014. Does anyone know where to get a more modern toolchain?

  • Clone Libreelec repo and build libreelec.
    Then you will get toolchain build too. You can use it to build somethig outside libreelec build environment.

    Code
    user:~/LibreELEC/LibreELEC.tv$ ./build.LibreELEC-RPi2.arm-7.0.1/toolchain/bin/armv7ve-libreelec-linux-gnueabi-gcc -v
    Using built-in specs.
    COLLECT_GCC=/home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/toolchain/bin/armv7ve-libreelec-linux-gnueabi-gcc-5.3.0
    COLLECT_LTO_WRAPPER=/home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/toolchain/lib/gcc/armv7ve-libreelec-linux-gnueabi/5.3.0/lto-wrapper
    Target: armv7ve-libreelec-linux-gnueabi
    Configured with: /home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/gcc-5.3.0/configure --host=i686-linux-gnu --build=i686-linux-gnu --prefix=/home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/toolchain ...........
    Thread model: posix
    gcc version 5.3.0 (GCC)

    You create package with looking into one another.

    Edited once, last by vpeter (June 6, 2016 at 11:28 AM).


  • Clone Libreelec repo and build libreelec.
    Then you will get toolchain build too. You can use it to build somethig outside libreelec build environment.

    Code
    user:~/LibreELEC/LibreELEC.tv$ ./build.LibreELEC-RPi2.arm-7.0.1/toolchain/bin/armv7ve-libreelec-linux-gnueabi-gcc -v
    Using built-in specs.
    COLLECT_GCC=/home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/toolchain/bin/armv7ve-libreelec-linux-gnueabi-gcc-5.3.0
    COLLECT_LTO_WRAPPER=/home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/toolchain/lib/gcc/armv7ve-libreelec-linux-gnueabi/5.3.0/lto-wrapper
    Target: armv7ve-libreelec-linux-gnueabi
    Configured with: /home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/gcc-5.3.0/configure --host=i686-linux-gnu --build=i686-linux-gnu --prefix=/home/user/LibreELEC/LibreELEC.tv/build.LibreELEC-RPi2.arm-7.0.1/toolchain ...........
    Thread model: posix
    gcc version 5.3.0 (GCC)

    You create package with looking into one another.

    Once you've built libreelec for your architecture, how do you get another project's build system to be aware of the toolchain you've installed. I can't imagine you just run ./configure and make and end up with the correct binary.