notes on using qemu to build sonic-pi for raspi

latest runner from tami fork are here. this cover linux\windows\osx.

below are attempts at compiling dev branch for raspberry-pi(4)


it is not know if building on ARM is even possible with the dev branch, the build scripts/readme for pi where updated a few weeks ago, but they basicly call the linux scripts. and this fail. im using the xeviar jetson as it is similar to the pi, with debian based distro (ubuntu 18.04LTS) and arm core. but 8x more cores and 15Gb of RAM.

xeviar arm

either add yourself to the telavivmakers sonic-pi repo, where you can run automated CI workflows, or ask yair to add you key to SSH in.
address is

we're using a nice octa-core jetson xevier kit from nvidia

bare metal

Tried following the sonic-pi github action , but as arm based "runners" are not yet supported nativly in github, ARM is missing important actions (community functions/wrappers around automated installers) used on the other platforms (win/osx/linux) see elixer fail.

so here are the manual things i did to get cmake/qt6/erlang going.

#install qt
unzip && cd qt-everywhere-src-6.3.0-beta2
chmod a+x configure && ./configure
make && sudo make install

elixer, used in the linux/osx/win build.yml didnt work for me erlang siggested usign kerl

#install erlang
curl -O
chmod a+x kerl 
./kerl list releases
kerl build 24.2
error bellow
./kerl build 24.2
Downloading 24.2 to /home/nvidia/.kerl/archives...
Building Erlang/OTP 24.2 (24.2), please wait...
APPLICATIONS DISABLED (See: /home/nvidia/.kerl/builds/24.2/otp_build_24.2.log)
 * jinterface     : No Java compiler found

APPLICATIONS INFORMATION (See: /home/nvidia/.kerl/builds/24.2/otp_build_24.2.log)
 * wx             : wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available

DOCUMENTATION INFORMATION (See: /home/nvidia/.kerl/builds/24.2/otp_build_24.2.log)
 * documentation  :
 *                  xmllint is missing.
 *                  Using fakefop to generate placeholder PDF files.

Build failed.
make[3]: *** [aarch64-unknown-linux-gnu/wxe_init.o] Error 4
make[3]: Leaving directory '/home/nvidia/.kerl/builds/24.2/otp_src_24.2/lib/wx/c_src'
/home/nvidia/.kerl/builds/24.2/otp_src_24.2/make/ recipe for target 'opt' failed
make[2]: *** [opt] Error 2
make[2]: Leaving directory '/home/nvidia/.kerl/builds/24.2/otp_src_24.2/lib/wx'
/home/nvidia/.kerl/builds/24.2/otp_src_24.2/make/ recipe for target 'opt' failed
make[1]: *** [opt] Error 2
make[1]: Leaving directory '/home/nvidia/.kerl/builds/24.2/otp_src_24.2/lib'
Makefile:498: recipe for target 'libs' failed
make: *** [libs] Error 2

Please see /home/nvidia/.kerl/builds/24.2/otp_build_24.2.log for full details.

virtual machine

nice links

sudo apt full-upgrade
mkdir ~/qemu-raspi && cd ~/qemu-raspi
#get image
#mount image and copy DTDs and kernel
cp 2022-01-28-raspios-bullseye-arm64-lite.img foo.img
qemu-img resize foo.img 16G
mount -o loop,offset=4194304 foo.img /mnt
cp /mnt/*.dtb .
cp /mnt/kernel8.img .
umount /mnt

#build machine
qemu-system-aarch64 -m 1024 \
    -M raspi3 -smp 4 \
    -kernel kernel8.img \
    -dtb bcm2710-rpi-3-b-plus.dtb \
    -sd foo.img \
    -append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4" \
    -nographic -device usb-net,netdev=net0 \
    -netdev user,id=net0,hostfwd=tcp::5555-:22

# expand filesystem
# clone reepository


we have a working github workflow in the tami github/sonic-pi repo , its outputs are in the download section of this wiki

this is the env path of a working virtual build from upstream

   pythonLocation: /opt/hostedtoolcache/Python/3.10.2/x64
   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.2/x64/lib:/home/runner/work/sonic-pi/Qt/6.2.2/gcc_64/lib
   PKG_CONFIG_PATH: /home/runner/work/sonic-pi/Qt/6.2.2/gcc_64/lib/pkgconfig
   Qt6_DIR: /home/runner/work/sonic-pi/Qt/6.2.2/gcc_64
   QT_PLUGIN_PATH: /home/runner/work/sonic-pi/Qt/6.2.2/gcc_64/plugins
   QML2_IMPORT_PATH: /home/runner/work/sonic-pi/Qt/6.2.2/gcc_64/qml
   INSTALL_DIR_FOR_OTP: /home/runner/work/_temp/.setup-beam/otp
   INSTALL_DIR_FOR_ELIXIR: /home/runner/work/_temp/.setup-beam/elixir
   CC: clang
   QT_INSTALL_LOCATION: /home/runner/work/sonic-pi/Qt/6.2.2/gcc_64

linux on metal


sudo apt-get install build-essential libgl1-mesa-dev libxkbcommon-x11-0 libpulse-dev libxcb-util1 libxcb-glx0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 \
libxcb-xfixes0 libxcb-xinerama0 libxcb1 automake autoconf libncurses5-dev -y


# list-qt linux desktop --arch <QT_VERSION>' to list valid architectures.
$ aqt list-qt linux desktop --arch 6.2.2
$ aqt list-qt linux desktop --modules 6.2.2 gcc_64
debug_info qt3d qt5compat qtcharts qtconnectivity qtdatavis3d qtimageformats qtlottie qtmultimedia qtnetworkauth \
qtpositioning qtquick3d qtquicktimeline qtremoteobjects qtscxml qtsensors qtserialbus qtserialport qtshadertools \
qtvirtualkeyboard qtwaylandcompositor qtwebchannel qtwebengine qtwebsockets qtwebview

$ python3 -m aqt install-qt linux desktop 6.2.2 -m qtwebengine -O /home/user/sonic-pi/qt6
curl -O
chmod a+x kerl
./kerl list releases
./kerl build 24.2
prebuild and config
export QT_INSTALL_LOCATION=/home/user/sonic-pi/qt6/6.2.2/gcc_64
cd app
cd build
cmake --build . --config release
also (some tips for local builds)[]