balena-os/balena-raspberry build error on Apple Mac M1 max host.

HI,
Would like to know if anybody has succcesfully built balena OS using apple M1 host chip or is it not supported yet?. I am using VM with Ubuntu running on MacOS Monterey 12.2.1. But keep getting this error (Please note, this was also built on ubuntu 20.04, 21,10 with almost same error):

| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_install
| NOTE: make -j 4 DESTDIR=/home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image install-static
| cd jim && CFLAGS=" -Os -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0=/usr/src/debug/usb-modeswitch/2.5.2-r0                      -fdebug-prefix-map=/home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0=/usr/src/debug/usb-modeswitch/2.5.2-r0                      -fdebug-prefix-map=/home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/recipe-sysroot-native=  -Wall" CC="aarch64-poky-linux-gcc  -mcpu=cortex-a53 -march=armv8-a+crc -fstack-protector-strong  -Os -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Wdate-time --sysroot=/home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/recipe-sysroot" ./configure --disable-lineedit --with-out-jim-ext="stdlib posix load signal syslog" --prefix=/usr
| install -D --mode=755 usb_modeswitch /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/usr/sbin/usb_modeswitch
| install -D --mode=755 usb_modeswitch.sh /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/lib/udev/usb_modeswitch
| install -D --mode=644 usb_modeswitch.conf /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/etc/usb_modeswitch.conf
| install -D --mode=644 usb_modeswitch.1 /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/usr/share/man/man1/usb_modeswitch.1
| install -D --mode=644 usb_modeswitch_dispatcher.1 /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/usr/share/man/man1/usb_modeswitch_dispatcher.1
| install -D --mode=755 usb_modeswitch_dispatcher /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/usr/sbin/usb_modeswitch_dispatcher
| install -d /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/var/lib/usb_modeswitch
| test -d /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/etc/init -a -e /sbin/initctl && install --mode=644 usb-modeswitch-upstart.conf /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/etc/init || test 1
| test -d /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/etc/systemd/system -a \( -e /usr/bin/systemctl -o -e /bin/systemctl \) && install --mode=644 usb_modeswitch@.service /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/image/etc/systemd/system || test 1
| autosetup/system.tcl:204: Error: /home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/usb-modeswitch-2.5.2/jim/autosetup/config.guess: unable to guess system type
| 
| This script, last modified 2010-09-24, has failed to recognize
| the operating system you are using. It is advised that you
| download the most up to date version of the config scripts from
| 
|   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
| and
|   http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
| 
| If the version you run (/home/azmi/workdir/project1/balena-raspberrypi/build/tmp/work/cortexa53-poky-linux/usb-modeswitch/2.5.2-r0/usb-modeswitch-2.5.2/jim/autosetup/config.guess) is already up to date, please
| send the following data and any information you think might be
| pertinent to <config-patches@gnu.org> in order to provide the needed
| information to handle your system.
| 
| config.guess timestamp = 2010-09-24
| 
| uname -m = aarch64
| uname -r = 5.15.0-22-generic
| uname -s = Linux
| uname -v = #22-Ubuntu SMP Tue Feb 8 13:17:51 UTC 2022
| 
| /usr/bin/uname -p = aarch64
| /bin/uname -X     =
| 
| hostinfo               =
| /bin/universe          =
| /usr/bin/arch -k       =
| /bin/arch              = aarch64
| /usr/bin/oslevel       =
| /usr/convex/getsysinfo =
| 
| UNAME_MACHINE = aarch64
| UNAME_RELEASE = 5.15.0-22-generic
| UNAME_SYSTEM  = Linux
| UNAME_VERSION = #22-Ubuntu SMP Tue Feb 8 13:17:51 UTC 2022
| in procedure 'use' called at file "auto.def", line 5
| in procedure 'use' called at file "autosetup/cc.tcl", line 29
| in procedure 'config_guess' called at file "autosetup/system.tcl", line 204
| Try: 'configure --debug' for a full stack trace
| make: *** [Makefile:46: jim/libjim.a] Error 1
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/azmi/workdir/project1/balena-raspberrypi/build/../layers/meta-balena/meta-balena-common/recipes-support/usb-modeswitch/usb-modeswitch_2.5.2.bb:do_install) failed with exit code '1'


Best regards,
Azmi.

Hi, are you able to build Poky Honister following the instructions in Yocto Project Quick Build — The Yocto Project ® 3.4.4 documentation with that setup?

Hi,
I have no problem building plain Honister. Anyway I did build succesfully, but forgot to update it here.

In order to make the build successful for my environment, i have done the flowing:

  1. usb_modeswitch - use new version usb-modeswitch_2.6.0.bb with “install” switch, which will depend on “tclsh” instead of “Jim”. I have the 2 errors with existing version:
    ** GLIBC version *
    ** jim/autosetup/config.guess: unable to guess system type … it is old and does not support ARM host yet.*

  2. golang compilation: from what i see, balena is using bootstrap toolchain from C souce code. The toolchain is old and does not support arm, therefore I am using bootstrap toolchain from Binary release using go-binary-native_1.16.2.bb recipe as default.

  3. meta-balena-common/recipes-kernel/linux/files/Dockerfile - it was for intel host, for arm i did this changes:

@@ -1,4 +1,5 @@
-FROM balenalib/intel-nuc-debian:buster-20210705
+#FROM balenalib/intel-nuc-debian:buster-20210705
+FROM balenalib/aarch64-debian-node:17.7.2-buster-build-20220321

Best regards,
Azmi.