Yurik72/ESPHap

arduino_homekit_server.cpp error when compiling with platformIO

Opened this issue · 0 comments

Firstly, thanks for the publishing this awesome library.
I used your ESPHap_LED_Strip_RGBW example and its working perfectly with the Arduino IDE. But i need to implement this code my main project which i developed with platformio, and i did. But i can't compile it successfully. 'platformio.ini' and the logs are int he below. Can you help me to figure out this.

Logs:

CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp07s.html
PLATFORM: Espressif 8266 (3.2.0) > Espressif Generic ESP8266 ESP-07S
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 3.30002.0 (3.0.2)
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa 2.100300.210717 (10.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 42 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Firebase ESP8266 Client> 3.8.3
|   |-- <SD> 2.0.0
|   |   |-- <SDFS> 0.1.0
|   |   |   |-- <ESP8266SdFat> 2.0.2
|   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <SPI> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <lwIP_enc28j60> 1
|   |   |-- <SPI> 1.0
|   |-- <lwIP_w5500> 1
|   |   |-- <SPI> 1.0
|   |-- <lwIP_w5500> 1
|   |   |-- <SPI> 1.0
|   |-- <EspSoftwareSerial> 6.12.7
|   |-- <SPI> 1.0
|-- <ArduinoJson> 6.19.1
|-- <AceButton> 1.9.1
|-- <wolfssl> 4.7.1
|   |-- <wolfSSL>
|   |-- <Firebase ESP8266 Client> 3.8.3
|   |   |-- <SD> 2.0.0
|   |   |   |-- <SDFS> 0.1.0
|   |   |   |   |-- <ESP8266SdFat> 2.0.2
|   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |-- <SPI> 1.0
|   |   |-- <ESP8266WiFi> 1.0
|   |   |-- <lwIP_enc28j60> 1
|   |   |   |-- <SPI> 1.0
|   |   |-- <lwIP_w5500> 1
|   |   |   |-- <SPI> 1.0
|   |   |-- <lwIP_w5500> 1
|   |   |   |-- <SPI> 1.0
|   |   |-- <EspSoftwareSerial> 6.12.7
|   |   |-- <SPI> 1.0
|-- <ESPHap> 1.0.3
|   |-- <wolfssl> 4.7.1
|   |   |-- <wolfSSL>
|   |   |-- <Firebase ESP8266 Client> 3.8.3
|   |   |   |-- <SD> 2.0.0
|   |   |   |   |-- <SDFS> 0.1.0
|   |   |   |   |   |-- <ESP8266SdFat> 2.0.2
|   |   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <ESP8266WiFi> 1.0
|   |   |   |-- <lwIP_enc28j60> 1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <lwIP_w5500> 1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <lwIP_w5500> 1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <EspSoftwareSerial> 6.12.7
|   |   |   |-- <SPI> 1.0
|   |-- <ESP8266mDNS> 1.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <wolfSSL>
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <HomeKit-ESP8266> 1.2.0
|   |-- <ESP8266mDNS> 1.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ESPHap> 1.0.3
|   |   |-- <wolfssl> 4.7.1
|   |   |   |-- <wolfSSL>
|   |   |   |-- <Firebase ESP8266 Client> 3.8.3
|   |   |   |   |-- <SD> 2.0.0
|   |   |   |   |   |-- <SDFS> 0.1.0
|   |   |   |   |   |   |-- <ESP8266SdFat> 2.0.2
|   |   |   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |-- <ESP8266WiFi> 1.0
|   |   |   |   |-- <lwIP_enc28j60> 1
|   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |-- <lwIP_w5500> 1
|   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |-- <lwIP_w5500> 1
|   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |-- <EspSoftwareSerial> 6.12.7
|   |   |   |   |-- <SPI> 1.0
|   |   |-- <ESP8266mDNS> 1.2
|   |   |   |-- <ESP8266WiFi> 1.0
|   |   |-- <ESP8266WiFi> 1.0
|   |   |-- <wolfSSL>
|   |-- <wolfssl> 4.7.1
|   |   |-- <wolfSSL>
|   |   |-- <Firebase ESP8266 Client> 3.8.3
|   |   |   |-- <SD> 2.0.0
|   |   |   |   |-- <SDFS> 0.1.0
|   |   |   |   |   |-- <ESP8266SdFat> 2.0.2
|   |   |   |   |   |   |-- <SPI> 1.0
|   |   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <ESP8266WiFi> 1.0
|   |   |   |-- <lwIP_enc28j60> 1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <lwIP_w5500> 1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <lwIP_w5500> 1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |-- <EspSoftwareSerial> 6.12.7
|   |   |   |-- <SPI> 1.0
|   |-- <wolfSSL>
|-- <EEPROM> 1.0
Building in release mode
Compiling .pio\build\esp8266\lib06e\ESPHap\aa.c.o
Compiling .pio\build\esp8266\lib06e\ESPHap\accessories.c.o
Compiling .pio\build\esp8266\lib06e\ESPHap\arduino_homekit_server.cpp.o
Compiling .pio\build\esp8266\lib06e\ESPHap\bench.c.o
Compiling .pio\build\esp8266\lib06e\ESPHap\cJSON_Utils.c.o
Compiling .pio\build\esp8266\lib06e\ESPHap\cJSON_memory.c.o
Compiling .pio\build\esp8266\lib06e\ESPHap\cQueue.c.o
In file included from lib\wolfSSL/wolfssl.h:3,
                 from lib\ESPHap\aa.c:2:
lib\wolfSSL/wolfssl/ssl.h:1453:22: fatal error: sys/uio.h: No such file or directory
 1453 |             #include <sys/uio.h>
      |                      ^~~~~~~~~~~
compilation terminated.
Compiling .pio\build\esp8266\lib06e\ESPHap\crypto.c.o
lib\ESPHap\accessories.c: In function 'homekit_add_characteristic_to_service':
lib\ESPHap\accessories.c:157:8: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized]
  157 |   size += sizeof(homekit_characteristic_t*) * (i + 2);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\esp8266\lib06e\ESPHap\elgato.c.o
Compiling .pio\build\esp8266\lib06e\ESPHap\esphap_base64.c.o
Compiling .pio\build\esp8266\lib06e\ESPHap\esphap_cJSON.c.o
*** [.pio\build\esp8266\lib06e\ESPHap\aa.c.o] Error 1
Compiling .pio\build\esp8266\lib06e\ESPHap\esphap_debug.c.o
lib\ESPHap\cJSON_memory.c: In function 'internal_buffered_malloc':
lib\ESPHap\cJSON_memory.c:54:38: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
   54 |   void *b = (void*)(allocator.buffer + allocator.offset);
      |                                      ^
lib\ESPHap\cJSON_memory.c: In function 'internal_buffered_free':
lib\ESPHap\cJSON_memory.c:74:66: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
   74 |  if (pointer >= allocator.buffer && pointer <= (allocator.buffer + allocator.buffer_size)) {
      |                                                                  ^
lib\ESPHap\cJSON_memory.c:75:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   75 |   if (pointer == allocator.buffer)
      |   ^~
lib\ESPHap\cJSON_memory.c:77:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   77 |    return;
      |    ^~~~~~
lib\ESPHap\cJSON_memory.c: In function 'internal_buffered_realloc':
lib\ESPHap\cJSON_memory.c:87:66: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
   87 |  if (pointer >= allocator.buffer && pointer <= (allocator.buffer + allocator.buffer_size)) {
      |                                                                  ^
lib\ESPHap\cJSON_memory.c:94:73: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
   94 |   if (newpointer >= allocator.buffer && newpointer <= (allocator.buffer + allocator.buffer_size)) {
      |                                                                         ^
In file included from lib\wolfSSL/wolfssl.h:3,
                 from lib\ESPHap\crypto.c:6:
lib\wolfSSL/wolfssl/ssl.h:1453:22: fatal error: sys/uio.h: No such file or directory
 1453 |             #include <sys/uio.h>
      |                      ^~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp8266\lib06e\ESPHap\crypto.c.o] Error 1
In file included from lib\ESPHap\arduino_homekit_server.cpp:30:
lib\ESPHap\esphap_debug.h:27: warning: "INFO" redefined
   27 | #define INFO(message, ...) printf_P(PSTR(">>> HomeKit: " message "\n"), ##__VA_ARGS__)
      |
In file included from .pio\libdeps\esp8266\HomeKit-ESP8266\src/user_settings.h:16,
                 from .pio\libdeps\esp8266\HomeKit-ESP8266\src/wolfssl/wolfcrypt/settings.h:171,
                 from .pio\libdeps\esp8266\HomeKit-ESP8266\src/wolfssl/wolfcrypt/types.h:27,
                 from .pio\libdeps\esp8266\HomeKit-ESP8266\src/wolfssl/wolfcrypt/hash.h:26,
                 from lib\ESPHap\arduino_homekit_server.cpp:19:
.pio\libdeps\esp8266\HomeKit-ESP8266\src/homekit_debug.h:35: note: this is the location of the previous definition
   35 | #define INFO(message, ...) HOMEKIT_PRINTF(">>> [%7d] HomeKit: " message "\n", millis(), ##__VA_ARGS__)
      |
In file included from lib\ESPHap\arduino_homekit_server.cpp:30:
lib\ESPHap\esphap_debug.h:28: warning: "ERROR" redefined
   28 | #define ERROR(message, ...) printf_P(PSTR("!!! HomeKit: " message "\n"), ##__VA_ARGS__)
      |
In file included from .pio\libdeps\esp8266\HomeKit-ESP8266\src/user_settings.h:16,
                 from .pio\libdeps\esp8266\HomeKit-ESP8266\src/wolfssl/wolfcrypt/settings.h:171,
                 from .pio\libdeps\esp8266\HomeKit-ESP8266\src/wolfssl/wolfcrypt/types.h:27,
                 from .pio\libdeps\esp8266\HomeKit-ESP8266\src/wolfssl/wolfcrypt/hash.h:26,
                 from lib\ESPHap\arduino_homekit_server.cpp:19:
.pio\libdeps\esp8266\HomeKit-ESP8266\src/homekit_debug.h:36: note: this is the location of the previous definition
   36 | #define ERROR(message, ...) HOMEKIT_PRINTF("!!! [%7d] HomeKit: " message "\n", millis(), ##__VA_ARGS__)
      |
In file included from lib\ESPHap\arduino_homekit_server.cpp:38:
lib\ESPHap\arduino_homekit_server.h:11:2: warning: #warning "You have selected lower memory for lwIP Variant, this can cause a problem, Please seelct v2 Higher Bandwidth with TCP_MSS =1460 " [-Wcpp]       
   11 | #warning "You have selected lower memory for lwIP Variant, this can cause a problem, Please seelct v2 Higher Bandwidth with TCP_MSS =1460 "
      |  ^~~~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'void client_context_free(client_context_t*)':
lib\ESPHap\arduino_homekit_server.cpp:467:27: warning: unused variable 'event' [-Wunused-variable]
  467 |   characteristic_event_t *event = NULL;
      |                           ^~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'int client_send_encrypted_(client_context_t*, byte*, size_t)':
lib\ESPHap\arduino_homekit_server.cpp:869:24: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Wsign-compare]
  869 |  while (payload_offset < size) {
      |         ~~~~~~~~~~~~~~~^~~~~~
lib\ESPHap\arduino_homekit_server.cpp:874:31: warning: narrowing conversion of '(chunk_size % 256)' from 'size_t' {aka 'unsigned int'} to 'byte' {aka 'unsigned char'} [-Wnarrowing]
  874 |   byte aead[2] = { chunk_size % 256, chunk_size / 256 };
      |                    ~~~~~~~~~~~^~~~~
lib\ESPHap\arduino_homekit_server.cpp:874:49: warning: narrowing conversion of '(chunk_size / 256)' from 'size_t' {aka 'unsigned int'} to 'byte' {aka 'unsigned char'} [-Wnarrowing]
  874 |   byte aead[2] = { chunk_size % 256, chunk_size / 256 };
      |                                      ~~~~~~~~~~~^~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'int client_decrypt_(client_context_t*, byte*, size_t, byte*, size_t*)':
lib\ESPHap\arduino_homekit_server.cpp:924:24: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Wsign-compare]
  924 |  while (payload_offset < payload_size) {
      |         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'void send_tlv_response(client_context_t*, tlv_values_t*)':
lib\ESPHap\arduino_homekit_server.cpp:1113:30: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
 1113 |  static char *http_headers = "HTTP/1.1 200 OK\r\n"
      |                              ^~~~~~~~~~~~~~~~~~~~~
 1114 |   "Content-Type: application/pairing+tlv8\r\n"
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1115 |   "Content-Length: %d\r\n"
      |   ~~~~~~~~~~~~~~~~~~~~~~~~
 1116 |   "Connection: keep-alive\r\n\r\n";
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp:1126:35: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Wsign-compare]
 1126 |  if (response_size - response_len < payload_size + 1) {
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'void send_json_response(client_context_t*, int, byte*, size_t)':
lib\ESPHap\arduino_homekit_server.cpp:1157:30: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
 1157 |  static char *http_headers = "HTTP/1.1 %d %s\r\n"
      |                              ^~~~~~~~~~~~~~~~~~~~
 1158 |   "Content-Type: application/hap+json\r\n"
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1159 |   "Content-Length: %d\r\n"
      |   ~~~~~~~~~~~~~~~~~~~~~~~~    
 1160 |   "Connection: keep-alive\r\n\r\n";
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp:1198:35: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Wsign-compare]
 1198 |  if (response_size - response_len < payload_size + 1) {
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'HAPStatus process_characteristics_update(const cJSON*, client_context_t*)':
lib\ESPHap\arduino_homekit_server.cpp:2650:22: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
 2650 |    if (strlen(value) > max_len) {
      |        ~~~~~~~~~~~~~~^~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp:2677:18: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
 2677 |    if (value_len > max_len) {
      |        ~~~~~~~~~~^~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp:2730:18: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
 2730 |    if (value_len > max_len) {
      |        ~~~~~~~~~~^~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp:2773:28: warning: enum constant in boolean context [-Wint-in-bool-context]
 2773 |   if (!(ch->permissions && homekit_permissions_notify)) {
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'void homekit_server_close_client(homekit_server_t*, client_context_t*)':
lib\ESPHap\arduino_homekit_server.cpp:3559:48: warning: comparison of integer expressions of different signedness: 'long int' and 'long unsigned int' [-Wsign-compare]
 3559 |  if (context->socket && context->disconnect_ms > millis()) {
      |                         ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'void homekit_mdns_init(homekit_server_t*)':
lib\ESPHap\arduino_homekit_server.cpp:3954:10: warning: unused variable 'len' [-Wunused-variable]
 3954 |   word32 len = sizeof(encodedHash);
      |          ^~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'int homekit_get_accessory_id(char*, size_t)':
lib\ESPHap\arduino_homekit_server.cpp:4201:6: error: control reaches end of non-void function [-Werror=return-type]
 4201 |  free(accessory_id);
      |  ~~~~^~~~~~~~~~~~~~
lib\ESPHap\arduino_homekit_server.cpp: In function 'homekit_value_t HOMEKIT_DEFAULT_CPP()':
lib\ESPHap\arduino_homekit_server.cpp:173:9: warning: 'homekit_value' is used uninitialized in this function [-Wuninitialized]
  173 |  return homekit_value;
      |         ^~~~~~~~~~~~~
cc1plus.exe: some warnings being treated as errors
*** [.pio\build\esp8266\lib06e\ESPHap\arduino_homekit_server.cpp.o] Error 1

platformio.ini file:

; 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

[common_env_data]
lib_deps_external = 
	mobizt/Firebase ESP8266 Client@^3.7.5
	bblanchon/ArduinoJson@^6.19.0
	bxparks/AceButton@^1.9.1
lib_deps_internal = 
	wolfSSL
	ESPHap

[env:esp8266]
platform = espressif8266
board = esp07s
framework = arduino
debug_tool = esp-prog
upload_port = COM9
debug_init_break = tbreak setup
lib_deps = 
	${common_env_data.lib_deps_external}
	${common_env_data.lib_deps_internal}
extra_scripts = pre:apply_patches.py