The `ArduinoIoTCloud-Basic` sample fails to build for Portenta H7

Similar to the Portenta C33, the ArduinoIoTCloud library does not run on the Portenta H7.

I’ve already added the new command I learned from yesterday (lib_ldf_mode = deep+) to the .ini, but it made no difference.

.ini file:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter, extra scripting
;   Upload options: custom port, speed and extra flags
;   Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:portenta_h7_m7]
platform = ststm32
board = portenta_h7_m7
framework = arduino

; Build Options
build_flags =
    -Wall
    -Wextra
    ; -Wpedantic
    ; -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
    ; -D RELEASE
    ; -O3
    -Og
lib_deps =
    ArduinoIoTCloud
lib_ldf_mode = deep+

; Upload Options
    upload_protocol = jlink

; Debug Options
    debug_tool = jlink
    debug_init_break = tbreak setup

Build Logs:

(truncated to meet forum requirements)
...
Compiling .pio/build/portenta_h7_m7/libec2/Ethernet/EthernetServer.cpp.o
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/utility/http_parser/http_parser.c: In function 'http_parser_execute':
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/utility/http_parser/http_parser.c:1817:31: warning: this statement may fall through [-Wimplicit-fallthrough=]
               parser->upgrade = 1;
               ~~~~~~~~~~~~~~~~^~~
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/utility/http_parser/http_parser.c:1819:13: note: here
             case 1:
             ^~~~
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/utility/http_parser/http_parser.c: In function 'http_parser_parse_url':
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/utility/http_parser/http_parser.c:2376:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
         found_at = 1;
         ~~~~~~~~~^~~
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/utility/http_parser/http_parser.c:2379:7: note: here
       case s_req_server:
       ^~~~
In file included from /home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/src/ArduinoIoTCloud_Basic.ino:17:0:
src/arduino_secrets.h:22:0: warning: "SECRET_PASS" redefined
   #define SECRET_PASS ""
 
src/arduino_secrets.h:9:0: note: this is the location of the previous definition
   #define SECRET_PASS "!og0nNow"
 
.pio/libdeps/portenta_h7_m7/Arduino_DebugUtils/src/Arduino_DebugUtils.cpp: In member function 'void Arduino_DebugUtils::vPrint(const char*, va_list)':
.pio/libdeps/portenta_h7_m7/Arduino_DebugUtils/src/Arduino_DebugUtils.cpp:139:28: warning: variable length array 'msg_buf' is used [-Wvla]
   char msg_buf[msg_buf_size];
                            ^
Archiving .pio/build/portenta_h7_m7/libfe9/libArduino_DebugUtils.a
Indexing .pio/build/portenta_h7_m7/libfe9/libArduino_DebugUtils.a
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GPRS.cpp.o
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GSM.cpp.o
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GSMBand.cpp.o
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GSMClient.cpp.o
Archiving .pio/build/portenta_h7_m7/libba3/libSPI.a
Indexing .pio/build/portenta_h7_m7/libba3/libSPI.a
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GSMFileUtils.cpp.o
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GSMLocation.cpp.o
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GSMModem.cpp.o
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static void SpiDrv::begin()':
Compiling .pio/build/portenta_h7_m7/libae6/MKRGSM/GSMPIN.cpp.o
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp:103:15: error: 'NINA_GPIO0' was not declared in this scope
       pinMode(NINA_GPIO0, OUTPUT);
               ^~~~~~~~~~
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp:103:15: note: suggested alternative: 'NINA_GPIOIRQ'
       pinMode(NINA_GPIO0, OUTPUT);
               ^~~~~~~~~~
               NINA_GPIOIRQ
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/MbedClient.cpp: In member function 'virtual size_t arduino::MbedClient::write(const uint8_t*, size_t)':
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/MbedClient.cpp:214:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   } while ((ret != size && ret == NSAPI_ERROR_WOULD_BLOCK) && connected());
             ~~~~^~~~~~~
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static int SpiDrv::available()':
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp:66:25: error: 'NINA_GPIO0' was not declared in this scope
 #define NINA_GPIOIRQ    NINA_GPIO0
                         ^
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp:66:25: note: in definition of macro 'NINA_GPIOIRQ'
 #define NINA_GPIOIRQ    NINA_GPIO0
                         ^~~~~~~~~~
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp:66:25: note: suggested alternative: 'NINA_GPIOIRQ'
 #define NINA_GPIOIRQ    NINA_GPIO0
                         ^
.pio/libdeps/portenta_h7_m7/WiFiNINA/src/utility/spi_drv.cpp:66:25: note: in definition of macro 'NINA_GPIOIRQ'
 #define NINA_GPIOIRQ    NINA_GPIO0
                         ^~~~~~~~~~
In file included from .pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_ConnectionHandler.h:59:0,
                 from .pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/ArduinoIoTCloud.h:27,
                 from src/arduino_secrets.h:1,
                 from /home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/src/ArduinoIoTCloud_Basic.ino:17:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.h:25:29: error: redeclaration of 'ERROR'
 enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED, GSM_OFF};
                             ^~~~~
In file included from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22:0,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/variants/PORTENTA_H7_M7/pinmode_arduino.h:24,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/Arduino.h:26,
                 from /tmp/tmpvedgf3d5:1:
/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:190:3: note: previous declaration 'ErrorStatus ERROR'
   ERROR = !SUCCESS
   ^~~~~
In file included from .pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_ConnectionHandler.h:304:0,
                 from .pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/ArduinoIoTCloud.h:27,
                 from src/arduino_secrets.h:1,
                 from /home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/src/ArduinoIoTCloud_Basic.ino:17:
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:103: error: 'RadioAccessTechnologyType' has not been declared
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
*** [.pio/build/portenta_h7_m7/libf7a/WiFiNINA/utility/spi_drv.cpp.o] Error 1
In file included from .pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_ConnectionHandler.h:304:0,
                 from .pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/ArduinoIoTCloud.h:27,
                 from src/arduino_secrets.h:1,
                 from /home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/src/ArduinoIoTCloud_Basic.ino:17:
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:62:5: error: 'RadioAccessTechnologyType' does not name a type
     RadioAccessTechnologyType _rat;
     ^~~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:65:5: error: 'GSMUDP' does not name a type; did you mean 'GSM'?
     GSMUDP _gsm_udp;
     ^~~~~~
     GSM
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:66:5: error: 'GSMClient' does not name a type; did you mean 'DNSClient'?
     GSMClient _gsm_client;
     ^~~~~~~~~
     DNSClient
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:135: error: 'CATM1' was not declared in this scope
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                       ^~~~~
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:135: note: suggested alternative: 'CAN_1'
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                       ^~~~~
                                                                                                                                       CAN_1
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:158: error: 'BAND_3' was not declared in this scope
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                                              ^~~~~~
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:158: note: suggested alternative: 'CAN_2'
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                                              ^~~~~~
                                                                                                                                                              CAN_2
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:167: error: 'BAND_20' was not declared in this scope
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                                                       ^~~~~~~
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:167: note: suggested alternative: 'CAN_2'
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                                                       ^~~~~~~
                                                                                                                                                                       CAN_2
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:177: error: 'BAND_19' was not declared in this scope
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                                                                 ^~~~~~~
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:38:177: note: suggested alternative: 'CAN_1'
     CatM1ConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, RadioAccessTechnologyType rat = CATM1, uint32_t band = BAND_3 | BAND_20 | BAND_19, bool const keep_alive = true);
                                                                                                                                                                                 ^~~~~~~
                                                                                                                                                                                 CAN_1
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h: In member function 'virtual arduino::Client& CatM1ConnectionHandler::getClient()':
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:42:52: error: '_gsm_client' was not declared in this scope
     virtual Client & getClient() override { return _gsm_client; };
                                                    ^~~~~~~~~~~
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:42:52: note: suggested alternative: 'getClient'
     virtual Client & getClient() override { return _gsm_client; };
                                                    ^~~~~~~~~~~
                                                    getClient
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h: In member function 'virtual arduino::UDP& CatM1ConnectionHandler::getUDP()':
.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src/Arduino_CatM1ConnectionHandler.h:43:46: error: '_gsm_udp' was not declared in this scope
     virtual UDP & getUDP() override { return _gsm_udp; };
                                              ^~~~~~~~
In file included from .pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/cbor/../property/PropertyContainer.h:51:0,
                 from .pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/cbor/CBORDecoder.h:31,
                 from .pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/ArduinoIoTCloud.h:35,
                 from src/arduino_secrets.h:1,
                 from /home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/src/ArduinoIoTCloud_Basic.ino:17:
.pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/cbor/../property/types/automation/CloudTelevision.h: In member function 'virtual void CloudTelevision::setAttributesFromCloud()':
.pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/cbor/../property/types/automation/CloudTelevision.h:229:39: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
       setAttribute((int&)_cloud_value.pbc, "pbc");
                                       ^~~
.pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src/cbor/../property/types/automation/CloudTelevision.h:230:39: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
       setAttribute((int&)_cloud_value.inp, "inp");
                                       ^~~
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/MbedUdp.cpp: In member function 'virtual int arduino::MbedUDP::endPacket()':
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/MbedUdp.cpp:76:22: warning: variable length array 'buffer' is used [-Wvla]
   uint8_t buffer[size];
                      ^
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/MbedUdp.cpp:77:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < size; i++) {
                   ~~^~~~~~
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/MbedUdp.cpp: In member function 'virtual size_t arduino::MbedUDP::write(const uint8_t*, size_t)':
/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src/MbedUdp.cpp:97:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i<size; i++) {
                   ~^~~~~
*** [.pio/build/portenta_h7_m7/src/ArduinoIoTCloud_Basic.ino.cpp.o] Error 1
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:23:0:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:25:0:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.h:25:29: error: redeclaration of 'ERROR'
 enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED, GSM_OFF};
                             ^~~~~
In file included from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22:0,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/variants/PORTENTA_H7_M7/pinmode_arduino.h:24,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/Arduino.h:26,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:26,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:23:
/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:190:3: note: previous declaration 'ErrorStatus ERROR'
   ERROR = !SUCCESS
   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp: In constructor 'GSM::GSM(bool)':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:51:13: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in initialization
   _timeout(0)
             ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp: In member function 'GSM3_NetworkStatus_t GSM::begin(const char*, bool, bool)':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:61:14: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
     _state = ERROR;
              ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:72:20: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
           _state = ERROR;
                    ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp: In member function 'int GSM::ready()':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:122:17: warning: comparison between 'enum GSM3_NetworkStatus_t' and 'enum ErrorStatus' [-Wenum-compare]
   if (_state == ERROR) {
                 ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:154:20: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
           _state = ERROR;
                    ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:170:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:178:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:197:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:216:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:235:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:254:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:274:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:291:20: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
           _state = ERROR;
                    ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.cpp:308:18: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _state = ERROR;
                  ^~~~~
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GSM.cpp.o] Error 1
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:1:0:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp: In member function 'uint32_t GSMFileUtils::downloadFile(arduino::String, const char*, uint32_t, bool)':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:97:22: warning: variable length array 'hex' is used [-Wvla]
     char hex[size * 2] { 0 };
                      ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:99:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (auto i = 0; i < size; i++) {
                      ~~^~~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp: In member function 'uint32_t GSMFileUtils::readFile(arduino::String, arduino::String*)':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:152:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (auto i = 0; i < size; i++) {
                      ~~^~~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp: In member function 'uint32_t GSMFileUtils::readFile(arduino::String, uint8_t*)':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:199:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (auto i = 0; i < size; i++) {
                      ~~^~~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp: In member function 'uint32_t GSMFileUtils::readBlock(arduino::String, uint32_t, uint32_t, uint8_t*)':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:246:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (auto i = 0; i < size; i++) {
                      ~~^~~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp: In member function 'int GSMFileUtils::deleteFiles()':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:290:24: warning: variable length array 'files' is used [-Wvla]
     String files[_count];
                        ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp: In function 'void printFiles(GSMFileUtils)':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMFileUtils.cpp:336:23: warning: variable length array 'files' is used [-Wvla]
     String files[count];
                       ^
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GSMFileUtils.cpp.o] Error 1
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMLocation.h:25:0,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMLocation.cpp:20:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GSMLocation.cpp.o] Error 1
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMBand.cpp:20:0:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMBand.h:23:0,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMBand.cpp:22:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.h:25:29: error: redeclaration of 'ERROR'
 enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED, GSM_OFF};
                             ^~~~~
In file included from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22:0,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/variants/PORTENTA_H7_M7/pinmode_arduino.h:24,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/Arduino.h:26,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:26,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMBand.cpp:20:
/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:190:3: note: previous declaration 'ErrorStatus ERROR'
   ERROR = !SUCCESS
   ^~~~~
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMClient.cpp:20:0:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.h:24:0,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:20:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.h:25:29: error: redeclaration of 'ERROR'
 enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED, GSM_OFF};
                             ^~~~~
In file included from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22:0,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/variants/PORTENTA_H7_M7/pinmode_arduino.h:24,
                 from /home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/Arduino.h:26,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSM.h:23,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.h:24,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:20:
/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:190:3: note: previous declaration 'ErrorStatus ERROR'
   ERROR = !SUCCESS
   ^~~~~
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.h:26:0,
                 from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:20:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp: In member function 'int GPRS::ready()':
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:128:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:145:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:163:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:181:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:199:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:235:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:254:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:272:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
.pio/libdeps/portenta_h7_m7/MKRGSM/src/GPRS.cpp:290:19: error: cannot convert 'ErrorStatus' to 'GSM3_NetworkStatus_t' in assignment
         _status = ERROR;
                   ^~~~~
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMModem.cpp:20:0:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GSMBand.cpp.o] Error 1
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GSMClient.cpp.o] Error 1
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GSMModem.cpp.o] Error 1
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GPRS.cpp.o] Error 1
In file included from .pio/libdeps/portenta_h7_m7/MKRGSM/src/GSMPIN.cpp:20:0:
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:35:18: error: expected ')' before '&' token
   ModemClass(Uart& uart, unsigned long baud, int resetPin, int dtrPin);
                  ^
.pio/libdeps/portenta_h7_m7/MKRGSM/src/Modem.h:71:3: error: 'Uart' does not name a type; did you mean 'sqrt'?
   Uart* _uart;
   ^~~~
   sqrt
*** [.pio/build/portenta_h7_m7/libae6/MKRGSM/GSMPIN.cpp.o] Error 1
================================== [FAILED] Took 5.62 seconds ==================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

Does it build in the Arduino IDE using the latest stable version of GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino?

Yes. It builds with warnings, but it still compiles.

It looks like it’s including tons of unrelated libraries (found by header name only or not evaluated correctly), same for WiFiNINA. Try using

lib_ignore = 
  lib1
  lib2 

to pull them out of the build process.

Simply removing libraries didn’t seem to improve the situation (other problems arose).

I grabbed one of the compiler invocations from the Arduino IDE.

/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -Wall -Wextra -g3 -nostdlib @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/variants/PORTENTA_H7_M7/defines.txt @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/variants/PORTENTA_H7_M7/cxxflags.txt -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_PORTENTA_H7_M7 -DARDUINO_ARCH_MBED_PORTENTA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/variants/PORTENTA_H7_M7 -DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000 -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/cores/arduino/api/deprecated-avr-comp -iprefix/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/cores/arduino @/home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/variants/PORTENTA_H7_M7/../PORTENTA_H7_M7/includes.txt /home/zak/.arduino15/packages/arduino/hardware/mbed_portenta/4.0.10/variants/PORTENTA_H7_M7/variant.cpp -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/core/variant.cpp.o

If you compare the #define’s it’s injecting into the compilation versus what is listed in the c_cpp_properties.json generated by PlatformIO, you will see that PlatformIO is providing several additional #defines.

//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
    "configurations": [
        {
            "name": "PlatformIO",
            "includePath": [
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/include",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_Portenta_OTA/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDCARD/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/ArduinoMqttClient/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/ArduinoECCX08/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Wire",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/GSM/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Ethernet/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/WiFi/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_DebugUtils/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino",
                "/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated",
                "/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated-avr-comp",
                "/home/zak/.platformio/packages/framework-arduino-mbed/variants/PORTENTA_H7_M7",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Adafruit SleepyDog Library",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Adafruit SleepyDog Library/utility",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_ESP32_OTA/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/MKRNB/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/MKRWAN/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/RTCZero/src",
                "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/WiFi101/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Arduino_CAN/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Arduino_H7_Video/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Camera/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/GC2145",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/GPS/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM01B0",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM0360",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/KernelDebug/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/MCUboot/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/MLC/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/MRI/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/NDP/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Nano33BLE_System/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Nicla_System/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/OV7670",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/PDM/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Portenta_Audio/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDRAM/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/RPC/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SE05X/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SFU/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SPI",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/STM32H747_System/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Scheduler/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/ThreadDebug/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBAudio",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBHID/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBHOST/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBMIDI",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBMSD/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/doom/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/ea_malloc",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/mbed-memory-status",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/openamp_arduino/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src",
                "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/syntiant_ilib/src",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "path": [
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/include",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/ArduinoIoTCloud/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_Portenta_OTA/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDCARD/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/ArduinoMqttClient/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/ArduinoECCX08/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Wire",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_ConnectionHandler/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/GSM/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Ethernet/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/WiFi/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_DebugUtils/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated-avr-comp",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/variants/PORTENTA_H7_M7",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Adafruit SleepyDog Library",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Adafruit SleepyDog Library/utility",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/Arduino_ESP32_OTA/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/MKRNB/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/MKRWAN/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/RTCZero/src",
                    "/home/zak/Development/PlatformIO/ArduinoIoTCloud_Basic/.pio/libdeps/portenta_h7_m7/WiFi101/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Arduino_CAN/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Arduino_H7_Video/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Camera/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/GC2145",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/GPS/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM01B0",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM0360",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/KernelDebug/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/MCUboot/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/MLC/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/MRI/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/NDP/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Nano33BLE_System/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Nicla_System/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/OV7670",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/PDM/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Portenta_Audio/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDRAM/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/RPC/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SE05X/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SFU/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/SPI",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/STM32H747_System/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/Scheduler/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/ThreadDebug/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBAudio",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBHID/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBHOST/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBMIDI",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/USBMSD/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/doom/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/ea_malloc",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/mbed-memory-status",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/openamp_arduino/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src",
                    "/home/zak/.platformio/packages/framework-arduino-mbed/libraries/syntiant_ilib/src",
                    ""
                ]
            },
            "defines": [
                "PLATFORMIO=60111",
                "ARDUINO_PORTENTA_H7_M7",
                "ARM_MATH_CM7",
                "BT_UART_NO_3M_SUPPORT",
                "CM4_BOOT_BY_APPLICATION",
                "__CMSIS_RTOS",
                "COMPONENT_4343W_FS=1",
                "COMPONENT_CYW43XXX=1",
                "COMPONENT_FLASHIAP=1",
                "COMPONENT_QSPIF=1",
                "COMPONENT_WHD=1",
                "CORE_CM7",
                "__CORTEX_M7",
                "CYW43XXX_UNBUFFERED_UART",
                "DEVICE_ANALOGIN=1",
                "DEVICE_ANALOGOUT=1",
                "DEVICE_CAN=1",
                "DEVICE_CRC=1",
                "DEVICE_EMAC=1",
                "DEVICE_FLASH=1",
                "DEVICE_I2C=1",
                "DEVICE_I2C_ASYNCH=1",
                "DEVICE_I2CSLAVE=1",
                "DEVICE_INTERRUPTIN=1",
                "DEVICE_LPTICKER=1",
                "DEVICE_MPU=1",
                "DEVICE_PORTIN=1",
                "DEVICE_PORTINOUT=1",
                "DEVICE_PORTOUT=1",
                "DEVICE_PWMOUT=1",
                "DEVICE_QSPI=1",
                "DEVICE_RESET_REASON=1",
                "DEVICE_RTC=1",
                "DEVICE_SERIAL=1",
                "DEVICE_SERIAL_FC=1",
                "DEVICE_SLEEP=1",
                "DEVICE_SPI=1",
                "DEVICE_SPI_ASYNCH=1",
                "DEVICE_SPISLAVE=1",
                "DEVICE_STDIO_MESSAGES=1",
                "DEVICE_TRNG=1",
                "DEVICE_USBDEVICE=1",
                "DEVICE_USTICKER=1",
                "DEVICE_WATCHDOG=1",
                "EXTRA_IDLE_STACK_REQUIRED",
                "FEATURE_BLE=1",
                "__FPU_PRESENT=1",
                "LSE_STARTUP_TIMEOUT=200",
                "__MBED__=1",
                "MBED_BUILD_TIMESTAMP=1693899029.64443",
                "__MBED_CMSIS_RTOS_CM",
                "MBED_TICKLESS",
                "MBEDTLS_FS_IO",
                "MBEDTLS_SHA1_C",
                "METAL_INTERNAL",
                "METAL_MAX_DEVICE_REGIONS=2",
                "NO_ATOMIC_64_SUPPORT",
                "QSPI_NO_SAMPLE_SHIFT",
                "RPMSG_BUFFER_SIZE=2048",
                "STM32H747xx",
                "TARGET_CORDIO",
                "TARGET_CORTEX",
                "TARGET_CORTEX_M",
                "TARGET_LIKE_CORTEX_M7",
                "TARGET_LIKE_MBED",
                "TARGET_M7",
                "TARGET_MCU_STM32",
                "TARGET_MCU_STM32H7",
                "TARGET_MCU_STM32H747xI",
                "TARGET_NAME=PORTENTA_H7_M7",
                "TARGET_PORTENTA_H7",
                "TARGET_PORTENTA_H7_M7",
                "TARGET_RELEASE",
                "TARGET_RTOS_M4_M7",
                "TARGET_STM",
                "TARGET_STM32H7",
                "TARGET_STM32H747xI",
                "TARGET_STM32H747xI_CM7",
                "TOOLCHAIN_GCC",
                "TOOLCHAIN_GCC_ARM",
                "TRANSACTION_QUEUE_SIZE_SPI=2",
                "USB_DYNAMIC_CONFIGURATION",
                "USE_FULL_LL_DRIVER",
                "USE_HAL_DRIVER",
                "VIRTIO_MASTER_ONLY",
                "MBED_NO_GLOBAL_USING_DIRECTIVE=1",
                "CORE_MAJOR=4",
                "CORE_MINOR=0",
                "CORE_PATCH=6",
                "USE_ARDUINO_PINOUT",
                "ARDUINO=10810",
                "ARDUINO_ARCH_MBED",
                "CM4_BINARY_START=0x08100000",
                ""
            ],
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "compilerPath": "/home/zak/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin/arm-none-eabi-gcc",
            "compilerArgs": [
                "-mcpu=cortex-m7",
                "-mfloat-abi=softfp",
                "-mfpu=fpv5-d16",
                "-mthumb",
                "-iprefix/home/zak/.platformio/packages/framework-arduino-mbed/cores/arduino",
                "@/home/zak/.platformio/packages/framework-arduino-mbed/variants/PORTENTA_H7_M7/includes.txt",
                "-mfloat-abi=soft",
                "-mfpu=fpv5-d16",
                ""
            ]
        }
    ],
    "version": 4
}

It seems like teasing this apart may be worth looking into.

I am happy to continue helping as I can, but feel like a bit of a mechanical Turk. It is worth noting, this exercise doesn’t require any hardware. It may be more productive if you start with the platformio.ini file I provided, and attempt to compile the sample named ArduinoIoTCloud-Basic.

Thank you for all your help,
Zak

It really is all about the ignored libraries, PlatformIO has troubles identifying them correctly.

The way I look at it, is to look in the .pio/libdeps folder and try to identify libraries that don’t belong there:
grafik

The board, being a Portenta M7, is not a “MKR” (Maker) board like the MKR WiFI 1010, so everything starting with MKR is wrong. There should also not be any WiFi library in libdeps, because only the WiFi library from the framework is supposed to be taken, as listed here, so WiFi101 and WiFiNINA are wrong. RTCZero is equally wrong, since that’s for an Arduino Zero (Atmel SAMD21G18), not a Portenta (STM32H7…). It’s also not an ESP32, so Arduino_ESP32_OTA goes out.

Applying all that by using

[env:portenta_h7_m7]
platform = ststm32
board = portenta_h7_m7
framework = arduino
lib_ldf_mode = deep+
lib_deps =
   arduino-libraries/ArduinoIoTCloud@^1.13.0
lib_ignore =
   WiFiNINA
   WiFi101
   MKRNB
   MKRGSM
   Arduino_ESP32_OTA
   RTCZero

makes the example compile.

Linking .pio\build\portenta_h7_m7\firmware.elf
Checking size .pio\build\portenta_h7_m7\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  17.8% (used 93128 bytes from 523624 bytes)
Flash: [=======   ]  69.6% (used 547680 bytes from 786432 bytes)
Building .pio\build\portenta_h7_m7\firmware.bin
====================[SUCCESS] Took 216.23 seconds ====================

There is a setting that should have been able to simplify all this, that is, ignoring at least libraries meant for a different architectures like SAMD and ESP32, that is lib_compat_mode = strict. That is however so strict that even the ArduinoIoT library gets filtered out as “nonmatching” (which seems like a bug in PIO because the library.properties does have mbed_portenta in it).

In any case, that should build now. The only thing to watch out for is that for a Portenta H7, it defines all these connectivity methods

grafik

You probably want to properly choose whether it should use WiFi, Ethernet, GSM, NB-IoT or whatever. As far as I can see it in thingProperties.h, it will prefer Ethernet if available

you might have to adapt so that it’s hardcoded to the WiFi path, while defining SSID and password, of course.

2 Likes

And as a sidenote, please don’t use that form. This just tells PlatformIO “Go find a library with that name, whatever author, whatever version, and install it”. For stability and reproducability, you really want to use the recommended form as shown in the registry, including both the author and acceptable versions as described by SemVer.

lib_deps =
  arduino-libraries/ArduinoIoTCloud@^1.13.0
1 Like

Wow! Thank you for breaking all that down and finding a path forward!!!

What is causing PlatformIO to pull in all the additional libraries? Is that just the way it works, or is it encountering a problem.

This makes the Portenta H7 nearly unusable by all but the most advanced users.

Well in the first step, PlatformIO faithfully downloads all dependency libraries (and their dependencies if needed) as the libary tells it

so that 's how all of those libs end up in .pio/libdeps. Then, both the Arduino IDE and PlatformIO have to fish out the libaries that are not supposed to go into the build. Arduino probably has a slightly different logic, e.g., always prefering framework-builtin libraries (for WiFi) over external ones, while PlatformIO allows overriding them.

It might also be the case that the Arduino IDE prevents downloading of wrong sub-libraries that don’t match the architecture altogether, while PlatformIO doesn’t.

I wouldn’t per-sé say so because this isa complicated library dependency tree that not many libraries have, so lib_deps is used sparingly to help out PlatformIO. You can list that yourself with project tasks → Advanced → Verbose Build.

Found 50 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoIoTCloud @ 1.13.0 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\ArduinoIoTCloud)
|   |-- Arduino_ConnectionHandler @ 0.8.1 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_ConnectionHandler)
|   |   |-- Arduino_DebugUtils @ 1.4.0 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_DebugUtils)
|   |   |-- WiFi @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\WiFi)
|   |   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)    
|   |   |-- Ethernet @ 1.0.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Ethernet)
|   |   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |   |-- GSM @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\GSM)
|   |   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- Arduino_DebugUtils @ 1.4.0 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_DebugUtils)
|   |-- WiFi @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\WiFi)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- Ethernet @ 1.0.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Ethernet)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- GSM @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\GSM)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- ArduinoECCX08 @ 1.3.7 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\ArduinoECCX08)
|   |   |-- Wire (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Wire)
|   |-- Wire (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Wire)
|   |-- ArduinoMqttClient @ 0.1.7 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\ArduinoMqttClient)
|   |-- Arduino_Portenta_OTA @ 1.1.3 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_Portenta_OTA)
|   |   |-- Portenta_SDCARD @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Portenta_SDCARD)
|   |   |-- Arduino_DebugUtils @ 1.4.0 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_DebugUtils)
|   |   |-- WiFi @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\WiFi)
|   |   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- Portenta_SDCARD @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Portenta_SDCARD)
|-- Arduino_ConnectionHandler @ 0.8.1 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_ConnectionHandler)
|   |-- Arduino_DebugUtils @ 1.4.0 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_DebugUtils)
|   |-- WiFi @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\WiFi)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- Ethernet @ 1.0.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Ethernet)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|   |-- GSM @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\GSM)
|   |   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|-- Arduino_DebugUtils @ 1.4.0 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\Arduino_DebugUtils)
|-- WiFi @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\WiFi)
|   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|-- Ethernet @ 1.0.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Ethernet)
|   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|-- GSM @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\GSM)
|   |-- SocketWrapper @ 1.0 (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\SocketWrapper)
|-- ArduinoECCX08 @ 1.3.7 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\ArduinoECCX08)
|   |-- Wire (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Wire)
|-- Wire (License: Unknown, Path: C:\Users\Max\.platformio\packages\framework-arduino-mbed\libraries\Wire)
|-- ArduinoMqttClient @ 0.1.7 (License: Unknown, Path: C:\Users\Max\temp\portenta_iot\.pio\libdeps\portenta_h7_m7\ArduinoMqttClient)

If any of those libraries or subdependencies are wrongly determined by the build system, it will fail. And currently PlatformIO indeed stumbles wrongly over some libraries in the case for ststm32 + Portenta H7 (but it e.g. does not need lib_ignore when building in the Renesas-RA + Arduino Portenta C33 combination).

One can definitely open an issue about it that only lib_deps = arduino-libraries/ArduinoIoTCloud@^1.13.0 should be enough to make it work.

1 Like

You can track this issue in

1 Like

@maxgerhardt Thank you so much for the detailed response!

You are single-handedly helping me (along with anyone who reads this) to a greater understanding of the PlatformIO architecture and eco-system.

I truly appreciate your patience and insight.

Sincerely,
Zak