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

    Install and configure precompiled emulator binaries

    Scheduled Pinned Locked Moved Ideas and Development
    scriptmodule
    14 Posts 3 Posters 2.7k 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.
    • BuZzB
      BuZz administrators
      last edited by BuZz

      can ignore the warnings- must have set the platform flag in the wrong place - just put it after sudo - btw building binaries on a qemu chroot is built into retropie-setup including a cross compiler via distcc on the host machine. Note that this functionality was built for myself to easily automate building of binaries.

      on an Ubuntu PC: (18.04 for example)

      sudo ./retropie_packages.sh builder chroot_build module lr-mame
      

      will build binaries for rpi1/rpi2 on jessie and stretch in an emulated chroot. I am going to remove jessie from this though as I am discontinuing building binaries for Raspbian Jessie.

      sudo ./retropie_packages.sh crosscomp setup stretch
      

      will build and install a cross compiler to be used via distcc. The first command will use it if it's available. Also sudo ./retropie_packages.sh crosscomp setup jessie for the jessie cross compiler.

      with the emulated chroot using the cross compiler on the host, compilation can be very quick and requires no modifications to any of the retropie-setup modules.

      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
      • M
        Menion
        last edited by

        question, maybe stupid: how the module makefiles/cmake/whatever will pickup native cross compiler in chroot, instead of the emulated compiler? Will the crosscomp setup stretch rename the crosscompiler in gcc/g++ or?

        mituM 1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator @Menion
          last edited by

          @Menion The 'native' compiler is never called. distcc transfers the compilation to the host system, where a cross compiler runs. The system in the chroot calls the normal binaries (cc/gcc/c++g++), but those are actually symlinks to distcc (your $PATH includes the distcc symlinks before the actual compilers' binaries in /usr/lib/distcc).

          1 Reply Last reply Reply Quote 0
          • M
            Menion
            last edited by

            so I need to install distcc in the host system, or in the chroot-ed environment? Also, the

            sudo ./retropie_packages.sh crosscomp setup stretch
            

            shall be called in chroot-ed environment on on the host from the /hostdir/retropie/home/pi/RetroPie-Setup/scriptmodules ?

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

              @Menion No - you don't need to create a chrooted environment or run anything on it. It's all done from the host.

              The command you list sets up distcc and the cross compiler on the host machine.

              The builder command creates a chroot (actually two - one for jessie and one for stretch), and does all the building etc. Note you need to make sure RetroPie-Setup is installed in $HOME on the host machine.

              I use this to build and prepare binaries. I used to have a lot of standalone scripts for doing this, but I decided to implement it into RetroPie-Setup.

              For more info look through the scriptmodules/admin/builder.sh / scriptmodules/admin/image.sh and scriptmodules/admin/crosscomp.sh files.

              This code is also used for creating images for distribution (in this case image.sh is used but that's also used for the chroot creation for the builder.sh)

              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
              • M
                Menion
                last edited by

                Hi the scripts stopped because missing distcc (it checks for missing packages at the beginning but for some reason it does not check distcc itself) :

                /1847]Running action 'switch_distcc' for 'crosscomp' : Create am arm cross compiler env - based on examples from http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler
                = = = = = = = = = = = = = = = = = = = = =                                    '/opt/retropie/admin/crosscomp/bin/cc' -> '/opt/retropie/admin/crosscomp/stretch/bin/arm-linux-gnueabihf-gcc'
                '/opt/retropie/admin/crosscomp/bin/gcc' -> '/opt/retropie/admin/crosscomp/stretch/bin/arm-linux-gnueabihf-gcc'
                '/opt/retropie/admin/crosscomp/bin/arm-linux-gnueabihf-gcc' -> '/opt/retropie/admin/crosscomp/stretch/bin/arm-linux-gnueabihf-gcc'
                '/opt/retropie/admin/crosscomp/bin/c++' -> '/opt/retropie/admin/crosscomp/stretch/bin/arm-linux-gnueabihf-g++'                                            '/opt/retropie/admin/crosscomp/bin/g++' -> '/opt/retropie/admin/crosscomp/stretch/bin/arm-linux-gnueabihf-g++'                                            '/opt/retropie/admin/crosscomp/bin/arm-linux-gnueabihf-g++' -> '/opt/retropie/admin/crosscomp/stretch/bin/arm-linux-gnueabihf-g++'                        sed: can't read /etc/init.d/distcc: No such file or directory                Failed to restart distcc.service: Unit distcc.service not found.
                

                Can I resume the job manually without having to start from scratch, invoking the remaining actions?

                BuZzB 2 Replies Last reply Reply Quote 0
                • BuZzB
                  BuZz administrators @Menion
                  last edited by

                  @Menion you need to manually run the depends for both modules. Sorry. I don't have time to go into more depth. You can manually install the dependencies also, but I don't recommend using this admin code if unfamiliar with debugging and perhaps having to adjust it.

                  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
                  • BuZzB
                    BuZz administrators @Menion
                    last edited by BuZz

                    @Menion you will have to check the code in regards to continuing where it left off. Probably can just trigger the distcc switch function.

                    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
                    • M
                      Menion
                      last edited by

                      No problem, I figured it out, it was really the last step, just add the compiled cross-compiler bin path to the init.d script of distcc. It is strange because there is a function that checks for distcc, maybe it is not called at all.
                      I don't want to bother you more, I don't pretend immediate answers don't worry. I am moving ahead now to the builder part. I have modified the script because I run an headless server, so there is no network manager and thus, no nmcli for detecting the DNS server.
                      I know that these scripts are not meant for end user, I just need some fast compiling environment for me if I need to make some experiments to give back to the community, like the fix for mame2016 I did (see my post in the General Discussion forum) without having to wait ages for compiling.

                      1 Reply Last reply Reply Quote 0
                      • M
                        Menion
                        last edited by

                        According to this process inspection, it worked :)

                        23595 ?        Ss     0:03 tmux
                        23596 pts/1    Ss     0:01  \_ -bash
                        24946 pts/1    S+     0:00      \_ sudo ./retropie_packages.sh builder chroot_build module lr-mame
                        24947 pts/1    S+     0:01          \_ bash ./retropie_packages.sh builder chroot_build module lr-mame
                         6155 pts/1    Sl+    0:01              \_ /usr/bin/qemu-arm-static /usr/bin/sudo PATH=/usr/lib/distcc:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
                         6157 pts/1    Sl+    0:10                  \_ /usr/bin/qemu-arm-static /bin/bash /home/pi/RetroPie-Setup/retropie_packages.sh builder module lr-mame
                         7921 pts/1    Sl+    0:01                      \_ /usr/bin/qemu-arm-static /usr/bin/make OSD=retro RETRO=1 NOWERROR=1 OS=linux TARGETOS=linux CONFIG=libretro NO_USE_MIDI=1
                         7984 pts/1    Sl+    0:00                          \_ /usr/bin/qemu-arm-static /usr/bin/make -R --no-print-directory -C 3rdparty/genie/build/gmake.linux -f genie.make
                         8827 pts/1    Sl+    0:00                          |   \_ /usr/bin/qemu-arm-static /bin/sh -c gcc -O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -pipe  -MMD -MP -MP -DND
                         8833 pts/1    Sl+    0:00                          |   |   \_ /usr/bin/qemu-arm-static /usr/lib/distcc/gcc -O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -pipe -MMD -MP
                         8860 pts/1    Sl+    0:00                          |   \_ /usr/bin/qemu-arm-static /bin/sh -c gcc -O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -pipe  -MMD -MP -MP -DND
                         8863 pts/1    Sl+    0:00                          |       \_ /usr/bin/qemu-arm-static /usr/lib/distcc/gcc -O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -pipe -MMD -MP
                         8854 pts/1    Rl+    0:01                          \_ /usr/bin/qemu-arm-static /usr/bin/python scripts/build/msgfmt.py --output-file language/Vietnamese/strings.mo language
                         8878 pts/1    Rl+    0:00                          \_ /usr/bin/qemu-arm-static /usr/bin/python scripts/build/msgfmt.py --output-file language/Burmese/strings.mo language/Bu
                         2681 ?        SNs    0:00 /usr/bin/distccd --pid-file=/var/run/distccd.pid --log-file=/var/log/distccd.log --daemon --allow 127.0.0.1 --listen 127.0.0.1 --nice 10
                         2682 ?        SN     0:00  \_ /usr/bin/distccd --pid-file=/var/run/distccd.pid --log-file=/var/log/distccd.log --daemon --allow 127.0.0.1 --listen 127.0.0.1 --nice 10
                         2690 ?        SN     0:00  \_ /usr/bin/distccd --pid-file=/var/run/distccd.pid --log-file=/var/log/distccd.log --daemon --allow 127.0.0.1 --listen 127.0.0.1 --nice 10
                         2691 ?        SN     0:00  \_ /usr/bin/distccd --pid-file=/var/run/distccd.pid --log-file=/var/log/distccd.log --daemon --allow 127.0.0.1 --listen 127.0.0.1 --nice 10
                         2692 ?        SN     0:00  \_ /usr/bin/distccd --pid-file=/var/run/distccd.pid --log-file=/var/log/distccd.log --daemon --allow 127.0.0.1 --listen 127.0.0.1 --nice 10
                         8848 ?        SN     0:00  |   \_ gcc -O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -pipe -Wall -Wextra -Os -o /tmp/distccd_20ddb5c9.o -c /tmp/distccd_230bb5c9.i
                         8849 ?        RN     0:02  |       \_ /opt/retropie/admin/crosscomp/stretch/libexec/gcc/arm-linux-gnueabihf/6.4.0/cc1 -fpreprocessed /tmp/distccd_230bb5c9.i -quiet -dumpbas
                         8850 ?        SN     0:00  |       \_ /opt/retropie/admin/crosscomp/stretch/lib/gcc/arm-linux-gnueabihf/6.4.0/../../../../arm-linux-gnueabihf/bin/as -mcpu=arm1176jzf-s -mfl
                         2693 ?        SN     0:00  \_ /usr/bin/distccd --pid-file=/var/run/distccd.pid --log-file=/var/log/distccd.log --daemon --allow 127.0.0.1 --listen 127.0.0.1 --nice 10
                         8875 ?        SN     0:00  |   \_ gcc -O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -pipe -Wall -Wextra -Os -o /tmp/distccd_befeb5cc.o -c /tmp/distccd_a1dab5cc.i
                         8876 ?        RN     0:00  |       \_ /opt/retropie/admin/crosscomp/stretch/libexec/gcc/arm-linux-gnueabihf/6.4.0/cc1 -fpreprocessed /tmp/distccd_a1dab5cc.i -quiet -dumpbas
                         8877 ?        SN     0:00  |       \_ /opt/retropie/admin/crosscomp/stretch/lib/gcc/arm-linux-gnueabihf/6.4.0/../../../../arm-linux-gnueabihf/bin/as -mcpu=arm1176jzf-s -mfl
                         2694 ?        SN     0:00  \_ /usr/bin/distccd --pid-file=/var/run/distccd.pid --log-file=/var/log/distccd.log --daemon --allow 127.0.0.1 --listen 127.0.0.1 --nice 10
                        menion@Menionubuntu:/etc/default$
                        

                        I have heard about distcc but I have never looked into it in the details, I have to study it :)

                        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.