hey guys,
i have currently the problem that I can't compile ArduinoIoTCloud on MKR WiFi with PlatformIO as VS Code extension on macOS 14.5
The main Problem is that the compiler is throwing a lot of "redefinition of..." faults. I suppose that there is a problem with the buildin libraries of the board
In file included from .pio/libdeps/mkr_wifi1010/Arduino_SecureElement/src/SecureElement.h:19:0,
from .pio/libdeps/mkr_wifi1010/Arduino_SecureElement/src/Arduino_SecureElement.h:11,
from .pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/ArduinoIoTCloudTCP.h:32,
from .pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/ArduinoIoTCloud.h:165,
from src/thingproperties.h:4,
from src/main.cpp:3:
.pio/libdeps/mkr_wifi1010/Arduino_SecureElement/src/SecureElementConfig.h:15:78: warning: backslash and newline separated by space
defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \
Compiling .pio/build/mkr_wifi1010/lib4a5/src/utility/ASN1Utils.cpp.o
In file included from .pio/libdeps/mkr_wifi1010/WiFiNINA/src/utility/wifi_drv.h:28:0,
from .pio/libdeps/mkr_wifi1010/WiFiNINA/src/WiFiStorage.h:23,
from .pio/libdeps/mkr_wifi1010/WiFiNINA/src/WiFi.h:38,
from .pio/libdeps/mkr_wifi1010/WiFiNINA/src/WiFiNINA.h:23,
from .pio/libdeps/mkr_wifi1010/Arduino_ConnectionHandler/src/Arduino_ConnectionHandler.h:44,
from .pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/ArduinoIoTCloud.h:27,
from src/thingproperties.h:4,
from src/main.cpp:3:
.pio/libdeps/mkr_wifi1010/WiFi101/src/WiFiClient.h:31:7: error: redefinition of 'class WiFiClient'
class WiFiClient : public Client {
^~~~~~~~~~
In file included from .pio/libdeps/mkr_wifi1010/WiFiNINA/src/WiFi.h:35:0,
from .pio/libdeps/mkr_wifi1010/WiFiNINA/src/WiFiNINA.h:23,
from .pio/libdeps/mkr_wifi1010/Arduino_ConnectionHandler/src/Arduino_ConnectionHandler.h:44,
from .pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/ArduinoIoTCloud.h:27,
from src/thingproperties.h:4,
from src/main.cpp:3:
.pio/libdeps/mkr_wifi1010/WiFiNINA/src/WiFiClient.h:28:7: note: previous definition of 'class WiFiClient'
class WiFiClient : public Client {
^~~~~~~~~~
Compiling .pio/build/mkr_wifi1010/lib4a5/src/utility/ECCX08CSR.cpp.o
Compiling .pio/build/mkr_wifi1010/lib4a5/src/utility/ECCX08JWS.cpp.o
Archiving .pio/build/mkr_wifi1010/libcb5/libWire.a
In file included from .pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/cbor/../property/PropertyContainer.h:51:0,
from .pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/cbor/CBORDecoder.h:31,
from .pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/ArduinoIoTCloud.h:35,
from src/thingproperties.h:4,
from src/main.cpp:3:
.pio/libdeps/mkr_wifi1010/ArduinoIoTCloud/src/cbor/../property/types/automation/CloudTelevision.h: In member function 'virtual void CloudTelevision::setAttributesFromCloud()':
.pio/libdeps/mkr_wifi1010/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/mkr_wifi1010/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");
The Arduino Cloud Headers are only included in the following files:
ThingProperties:
#ifndef THINGPROPERTIES_H
#define THINGPROPERTIES_H
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
#include "arduino_secrets.h"
#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
#endif
#if defined(BOARD_HAS_SECRET_KEY)
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
#endif
void onLedChange();
bool led;
int potentiometer;
int seconds;
void initProperties() {
#if defined(BOARD_HAS_SECRET_KEY)
ArduinoCloud.setBoardId(BOARD_ID);
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY);
#endif
#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)
ArduinoCloud.addProperty(led, Permission::Write).onUpdate(onLedChange);
ArduinoCloud.addProperty(potentiometer, Permission::Read).publishOnChange(10);
ArduinoCloud.addProperty(seconds, Permission::Read).publishOnChange(1);
#elif defined(BOARD_HAS_LORA)
ArduinoCloud.addProperty(led, 1, Permission::ReadWrite).onUpdate(onLedChange);
ArduinoCloud.addProperty(potentiometer, 2, Permission::Read).publishOnChange(10);
ArduinoCloud.addProperty(seconds, 3, Permission::Read).publishEvery(5 * MINUTES);
#endif
}
#if defined(BOARD_HAS_ETHERNET)
/* DHCP mode */
//EthernetConnectionHandler ArduinoIoTPreferredConnection;
/* Manual mode. It will fallback in DHCP mode if SECRET_OPTIONAL_IP is invalid or equal to "0.0.0.0" */
EthernetConnectionHandler ArduinoIoTPreferredConnection(SECRET_OPTIONAL_IP, SECRET_OPTIONAL_DNS, SECRET_OPTIONAL_GATEWAY, SECRET_OPTIONAL_NETMASK);
#elif defined(BOARD_HAS_WIFI)
WiFiConnectionHandler ArduinoIoTPreferredConnection(SECRET_WIFI_SSID, SECRET_WIFI_PASS);
#elif defined(BOARD_HAS_GSM)
GSMConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
#elif defined(BOARD_HAS_LORA)
LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A);
#elif defined(BOARD_HAS_NB)
NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
#elif defined(BOARD_HAS_CATM1_NBIOT)
CatM1ConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
#endif
#endif // THINGPROPERTIES_H
Arduino Secrets:
#ifndef ARDUINO_SECRETS_H
#define ARDUINO_SECRETS_H
#include <Arduino_ConnectionHandler.h>
/* A complete list of supported boards with WiFi is available here:
* https://github.com/arduino-libraries/ArduinoIoTCloud/#what
*/
#if defined(BOARD_HAS_WIFI)
#define SECRET_WIFI_SSID "YOUR_WIFI_NETWORK_NAME"
#define SECRET_WIFI_PASS "YOUR_WIFI_PASSWORD"
#endif
/* ESP8266 ESP32 */
#if defined(BOARD_HAS_SECRET_KEY)
#define SECRET_DEVICE_KEY "my-device-password"
#endif
/* MKR GSM 1400 */ /* MKR NB 1500 */ /* Portenta CAT.M1/NB IoT GNSS Shield */
#if defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_CATM1_NBIOT)
#define SECRET_PIN ""
#define SECRET_APN ""
#define SECRET_LOGIN ""
#define SECRET_PASS ""
#endif
/* MKR WAN 1300/1310 */
#if defined(BOARD_HAS_LORA)
#define SECRET_APP_EUI ""
#define SECRET_APP_KEY ""
#endif
/* Portenta H7 + Ethernet shield */
#if defined(BOARD_HAS_ETHERNET)
#define SECRET_OPTIONAL_IP ""
#define SECRET_OPTIONAL_DNS ""
#define SECRET_OPTIONAL_GATEWAY ""
#define SECRET_OPTIONAL_NETMASK ""
#endif
#endif // ARDUINO_SECRETS_H
main.cpp:
#include "ir_receiver.hpp"
#include "iot_cli.hpp"
#include "thingproperties.h"
#include <Arduino.h>
IR_Handle _irHandle;
void setup() {
Serial.begin(9600);
// Defined in thingProperties.h
//initProperties();
// Connect to Arduino IoT Cloud
// ArduinoCloud.begin(ArduinoIoTPreferredConnection);
_irHandle.init(0, true);
}
void loop() {
//ArduinoCloud.update();
auto ret = _irHandle.run();
Serial.println(ret);
delay(1000);
}
I'm entering the problem also if I only include the basic ArduinoIoTCloud example of the library
Here is my platformio.ini (please consider the things which i already tried)
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
[env:mkr_wifi1010]
platform = atmelsam
board = mkrwifi1010
framework = arduino
lib_deps =
z3t0/IRremote@^4.4.0
arduino-libraries/ArduinoIoTCloud@^2.0.3
jandrassy/ArduinoOTA@^1.1.0
#arduino-libraries/ArduinoIoTCloudBearSSL@^1.1.2
#arduino-libraries/ArduinoECCX08@^1.3.8
#arduino-libraries/WiFiNINA@^1.8.0
arduino-libraries/Arduino_ConnectionHandler@^0.9.0
#Didnt work also with/without following lines
board_build.mcu = samd21g18a
board_build.f_cpu = 48000000L
upload_protocol = sam-ba
lib_extra_dirs = .pio/libdeps/mkr_wifi1010/ArduinoECCX08
lib_ignore = mkr_wifi1010, WiFi101,
lib_ldf_mode = deep
I've tried several things:
- all lib_ldf_modes (each mode is triggering different compiling errors)
- including different Wi-Fi libraries
- no include of extra Wi-Fi libraries
- The fault is gone if i remove the <ArduinoCloudIoT.h>