Multiple errors when running native unit test on M1 Mac

I am running into multiple errors when running a native unit test on my Mac (which works just fine on linux).

Here’s my plantformio.ini content:

[env:native]
platform = native
debug_test = *
build_flags = -std=gnu++11
              -pthread
              -DNATIVE ;compilation flag for conditional build
              ;-DMBR2
              -DMBR3
test_filter = test_desktop
lib_ignore = UserSwitch, Watchdog, Storage, Gps, UartComms, InternalAdc, BoardPinDefinition, InterfaceBrd, Leds, DataAcq
lib_ldf_mode = deep+
lib_compat_mode = off ;not ideal but can't make it work otherwise

Here’s the output when I run ‘pio test -e native -vvv’:

Processing test_desktop in native environment
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep+, Compatibility ~ off
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/BoardPinDefinition
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/DataAcq
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/Gps
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/InterfaceBrd
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/InternalAdc
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/Leds
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/Storage
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/UartComms
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/UserSwitch
Ignored library /Users/simon/MEGA/project/dev/project_STM32/lib/Watchdog
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Stubs (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/Stubs)
|-- Unity @ 2.5.2 (License: MIT, Path: /Users/simon/MEGA/project/dev/project_STM32/.pio/libdeps/native/Unity)
|-- Misc (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/Misc)
|-- SDCard (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/SDCard)
|   |-- Stubs (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/Stubs)
|   |-- Misc (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/Misc)
|-- StateMachine (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/StateMachine)
|   |-- Misc (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/Misc)
|   |-- ConfigManager (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/ConfigManager)
|   |-- Stubs (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/Stubs)
|-- ConfigManager (License: Unknown, Path: /Users/simon/MEGA/project/dev/project_STM32/lib/ConfigManager)
Building in test mode
gcc -o .pio/build/native/unity_config_build/unity_config.o -c -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest .pio/build/native/unity_config/unity_config.c
g++ -o .pio/build/native/test/test_desktop/AnalogIn_stub.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/AnalogIn_stub.cpp
g++ -o .pio/build/native/test/test_desktop/BufferedSerial_stub.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/BufferedSerial_stub.cpp
g++ -o .pio/build/native/test/test_desktop/DigitalIn_stub.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/DigitalIn_stub.cpp
g++ -o .pio/build/native/test/test_desktop/FATFileSystem_stub.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/FATFileSystem_stub.cpp
g++ -o .pio/build/native/test/test_desktop/Ticker_stub.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/Ticker_stub.cpp
g++ -o .pio/build/native/test/test_desktop/Timer_stub.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/Timer_stub.cpp
g++ -o .pio/build/native/test/test_desktop/test.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/test.cpp
g++ -o .pio/build/native/test/test_desktop/uartComms_stub.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -Ilib/StateMachine -Ilib/ConfigManager -Ilib/SDCard -Ilib/Misc -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config -Ilib/Stubs -I.pio/build/native/unity_config -Itest/test_desktop -Itest test/test_desktop/uartComms_stub.cpp
gcc -o .pio/build/native/lib408/Unity/unity.o -c -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -DUNITY_INCLUDE_CONFIG_H -I.pio/libdeps/native/Unity/src -I.pio/build/native/unity_config .pio/libdeps/native/Unity/src/unity.c
g++ -o .pio/build/native/libfbd/SDCard/sdCardDriver.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -Ilib/SDCard -Ilib/Misc -Ilib/Stubs lib/SDCard/sdCardDriver.cpp
g++ -o .pio/build/native/libae0/ConfigManager/configParameters.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -Ilib/ConfigManager lib/ConfigManager/configParameters.cpp
g++ -o .pio/build/native/lib789/StateMachine/stateMachine.o -c -std=gnu++11 -pthread -DPLATFORMIO=60114 -DNATIVE -DMBR3 -DPIO_UNIT_TESTING -Ilib/StateMachine -Ilib/Stubs -Ilib/ConfigManager -Ilib/Misc lib/StateMachine/stateMachine.cpp
ar rc .pio/build/native/libae0/libConfigManager.a .pio/build/native/libae0/ConfigManager/configParameters.o
ar rc .pio/build/native/lib408/libUnity.a .pio/build/native/lib408/Unity/unity.o
ranlib .pio/build/native/libae0/libConfigManager.a
In file included from test/test_desktop/test.cpp:2:
In file included from include/../lib/Stubs/fakeit.hpp:15:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:521:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/bind.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:268:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/compare:145:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/compare_partial_order_fallback.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/partial_order.h:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/weak_order.h:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/strong_order.h:20:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:588:17: error: expected unqualified-id
    return std::isnan(__lcpp_x);
                ^
.pio/libdeps/native/Unity/src/unity_internals.h:217:18: note: expanded from macro 'isnan'
#define isnan(n) ((n != n) ? 1 : 0)
                 ^
In file included from test/test_desktop/test.cpp:2:
In file included from include/../lib/Stubs/fakeit.hpp:15:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:521:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/bind.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:268:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/compare:145:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/compare_partial_order_fallback.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/partial_order.h:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/weak_order.h:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/strong_order.h:20:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:586:1: error: no return statement in constexpr function
__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:608:17: error: expected unqualified-id
    return std::isinf(__lcpp_x);
                ^
.pio/libdeps/native/Unity/src/unity_internals.h:211:18: note: expanded from macro 'isinf'
#define isinf(n) (isnan((n) - (n)) && !isnan(n))
                 ^
In file included from test/test_desktop/test.cpp:2:
In file included from include/../lib/Stubs/fakeit.hpp:15:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:521:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/bind.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:268:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/compare:145:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/compare_partial_order_fallback.h:13:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/partial_order.h:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/weak_order.h:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__compare/strong_order.h:20:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:606:1: error: no return statement in constexpr function
__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
^
ranlib .pio/build/native/lib408/libUnity.a
ar rc .pio/build/native/libfbd/libSDCard.a .pio/build/native/libfbd/SDCard/sdCardDriver.o
ar rc .pio/build/native/lib789/libStateMachine.a .pio/build/native/lib789/StateMachine/stateMachine.o
ranlib .pio/build/native/libfbd/libSDCard.a
ranlib .pio/build/native/lib789/libStateMachine.a
In file included from test/test_desktop/test.cpp:3:
lib/Stubs/BufferedSerial.h:17:9: warning: 'EAGAIN' macro redefined [-Wmacro-redefined]
#define EAGAIN 11
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/errno.h:129:9: note: previous definition is here
#define EAGAIN          35              /* Resource temporarily unavailable */
        ^
In file included from test/test_desktop/test.cpp:4:
lib/Stubs/AnalogIn.h:4:9: warning: 'NAN' macro redefined [-Wmacro-redefined]
#define NAN 0
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:61:15: note: previous definition is here
#   define    NAN          __builtin_nanf("0x7fc00000")
              ^
test/test_desktop/test.cpp:64:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    sprintf(msg, "FALLO: valor de salida que se obtuvo %d", salida);
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
3 warnings and 4 errors generated.
*** [.pio/build/native/test/test_desktop/test.o] Error 1
Building stage has failed, see errors above. Use `pio test -vvv` option to enable verbose output.