I tried this time ago and got a successful compilation for SITL (I don’t remember if with Big Sur or Monterey); however I had a Python problem with Mavproxy, so usage was limited. Later I found a workaround for it, but trying again:
… [881/881] Linking build/sitl/bin/arducopter ld: warning: pointer not aligned at address 0x100227A9B (__ZN6Copter13log_structureE + 7043 from ArduCopter/Log.cpp.45.o)
… (many similar lines) … ld: warning: pointer not aligned at address 0x100225F1A (__ZN6Copter13log_structureE + 2 from ArduCopter/Log.cpp.45.o) ld: unaligned pointer(s) for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Waf: Leaving directory `/Users/…/ardupilot/build/sitl’ Build failed
Compilers:
… Setting board to : sitl Using toolchain : native Checking for ‘g++’ (C++ compiler) : not found Checking for ‘clang++’ (C++ compiler) : /opt/homebrew/opt/ccache/libexec/clang++ Checking for ‘gcc’ (C compiler) : not found Checking for ‘clang’ (C compiler) : /opt/homebrew/opt/ccache/libexec/clang Checking for c flags ‘-MMD’ : yes Checking for cxx flags ‘-MMD’ : yes CXX Compiler : clang++ 13.1.6
…
So I left it for better times or looking what happens at ArduCopter/Log.cpp.45.
Anyhow, for your case, with gcc-arm-none-eabi-10.3-2021.10-mac.pkg installed (which I think it is not the standard compiler to use) I tried a single board: ./waf configure --board Pixhawk1 ./waf copter
showing: Autoconfiguration : enabled Setting board to : Pixhawk1 Using toolchain : arm-none-eabi Checking for ‘g++’ (C++ compiler) : /Applications/ARM/bin/arm-none-eabi-g++ Checking for ‘gcc’ (C compiler) : /Applications/ARM/bin/arm-none-eabi-gcc Checking for c flags ‘-MMD’ : yes Checking for cxx flags ‘-MMD’ : yes CXX Compiler : g++ 10.3.1 Checking for program ‘make’ : /usr/bin/make
and leaving in build/Pixhawk1/bin: $ file build/Pixhawk1/bin/* build/Pixhawk1/bin/arducopter: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped build/Pixhawk1/bin/arducopter.apj: ASCII text, with very long lines (65436) build/Pixhawk1/bin/arducopter.bin: TTComp archive data, binary, 4K dictionary build/Pixhawk1/bin/arducopter.hex: ASCII text build/Pixhawk1/bin/arducopter_with_bl.hex: ASCII text
after compiling and linking 828 files in only 1m40.601s (M1).
About that, apart from the compiler and mavproxy (at /opt/homebrew/bin/mavproxy.py) this is what I have installed on the M1: $ brew list|grep px4 $ brew list|grep genromfs $ brew list|grep gawk gawk $ pip list|grep pyserial pyserial 3.5 $ pip list|grep future future 0.18.2 $ pip list|grep empy empy 3.3.4 $ ls -l /Library/Developer/CommandLineTools/SDKs total 0 lrwxr-xr-x 1 root wheel 14 4 may 2021 MacOSX.sdk → MacOSX11.3.sdk drwxr-xr-x 8 root wheel 256 4 may 2021 MacOSX10.15.sdk drwxr-xr-x 7 root wheel 224 30 nov 2020 MacOSX11.1.sdk drwxr-xr-x 7 root wheel 224 16 mar 2021 MacOSX11.3.sdk lrwxr-xr-x 1 root wheel 14 4 may 2021 MacOSX11.sdk → MacOSX11.3.sdk
so yes, that page needs a look, and also it would be good that sitl version would compile on the M1 (M1 code).
So uninstall what you installed following that page and try, and install (brew+pip) what you see missing.
That cannot happen. Check your installation. Do basic checks: $ which python $ locate python $ python → it should show something similar to: $ python Python 3.9.10 (main, Jan 15 2022, 11:48:04) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin Type “help”, “copyright”, “credits” or “license” for more information. >>>
(or perhaps 3.10)
Test any python script with first line: #!/usr/bin/env python
Check not to use python2.
The problem is in this line of code: logger.Init(log_structure, ARRAY_SIZE(log_structure));
in each of the Log.cpp for each SITL model.
So a simple dirty workaround would be to modify the beginning of the file as follows
//#if LOGGING_ENABLED == ENABLED #if 0
so that every routine is compiled as {}.
Of course, the best is to accomodate log_structure to M1 arquitecture.
Possibly. At the beginning: // Code to Write and Read packets from AP_Logger log memory // Code to interact with the user to dump or erase logs
I’ll try shortly a simulation and see what happens, but the best is having log_structure adapted for M1 arquitecture.
At ardupilot/libraries/AP_Logger/LogStructure.h: #define LOG_PACKET_HEADER_LEN 3 // bytes required for LOG_PACKET_HEADER // once the logging code is all converted we will remove these from // this header