RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Recompile RetroPie with DistCC

    Scheduled Pinned Locked Moved Ideas and Development
    cross compiledistccrpi3
    2 Posts 2 Posters 771 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      emclinux
      last edited by emclinux

      Here is my little guide on how to get distcc working to recompile Retropie. This guide is for Rpi3 and may or may not work on the 3+. For other Rpi versions it should be a quick trip into the crosstools-ng docs to get it working.

      This guide is for ubuntu.
      You can run this in vagrant or any other vm if you use a different OS. Or take these instructions as a jumping off point.

      On distcc compile machines

      First install needed software

      apt-get install -y git build-essential python3 python3-dev autoconf distcc flex makeinfo help2man libtool libtool-bin ncurses-dev bison
      

      Install crosstools-ng

      git clone https://github.com/crosstool-ng/crosstool-ng
      cd crosstool-ng
      ./bootstrap
      ./configure
      make
      sudo make install
      

      Install cross toolchain

      ct-ng armv8-rpi3-linux-gnueabihf
      #This can take an hour or more.
      ct-ng build
      

      Fix permissions and set links

      cd /home/<YOUR USER>/x-tools/armv8-rpi3-linux-gnueabihf
      chmod +w bin
      cd bin
      for i in `ls -1 | sed -e 's/armv8-rpi3-linux-gnueabihf-//g'`; do ln -s armv8-rpi3-linux-gnueabihf-$i $i; done
      

      Configure distcc
      Open /etc/default/distcc and set the following

      STARTDISTCC="true"
      #Set this to your network range
      ALLOWEDNETS="10.0.0.0/8"
      LISTENER="0.0.0.0"
      ZEROCONF="false"
      

      Open /etc/init.d/distcc and set

      PATH=/home/<YOUR USER>/x-tools/armv8-rpi3-linux-gnueabihf/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
      

      On RetroPie

      Install distcc

      sudo apt install distcc
      

      Configure distcc
      Open /etc/distcc/hosts and remove the +zeroconf line and add you hosts all on the same line
      For example if your hosts are 10.0.0.2 10.0.0.3 and 10.0.0.4 then it would look like this

      10.0.0.2 10.0.0.3 10.0.0.4
      

      Open /etc/profile and reconfigure your path to have distcc first

      PATH=/usr/lib/distcc:$PATH
      

      Then make it active

      . /etc/profile
      

      After all that is done now you can run the retropie_packages or the retropie-setup scripts as normal just when it compiles the software it should use the hosts you set first and fail back to the rpi if it can't compile on the listed hosts.

      There is much more to distcc and I will leave that to you to make it better. This is loosely based on http://www.raspberry-pi-geek.com/Archive/2016/17/Distributed-software-compilation-for-the-Raspberry-Pi

      The trick was not the install of distcc but getting a working cross compiler working. The one listed in that guide will not work on retropie using an rpi3

      If you want to monitor your distcc I find the best tool for me is running tail on the distcc log file on the compile hosts

      tail -f /var/log/distccd.log
      

      Some like distccmon-text so I will let you choose.

      This should work for most things in retropie. Im still in testing for a lot of it so I don't know how X emulator works or why it won't use distcc. Compiling software can be tricky. Cross compiling software distributed over the network even more so.

      *edit - change for loop link command to include all tools

      1 Reply Last reply Reply Quote 1
      • BuZzB
        BuZz administrators
        last edited by BuZz

        A lot of this functionality is built in

        eg. on your ubuntu machine

        sudo ./retropie_packages.sh crosscomp setup stretch
        

        then on the rpi3 just install distcc, configure it to use Ubuntu machine.

        for building:

        PATH="/usr/lib/distcc:$PATH" MAKEFLAGS="-j4 PATH=/usr/lib/distcc:$PATH" ./retropie_packages.sh etc
        

        note settings the PATH for makeflags is needed for some modules to use distcc.

        retropie also includes the facility to build raspberry pi binaries on an x86 Ubuntu machine using an emulated chroot and the distcc on the host. see the "builder" module.

        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

        Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.