sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
228 stars 121 forks source link

Undefined reference to `SINRICPRO_2_9_12::signMessage #252

Closed eos1d3 closed 2 years ago

eos1d3 commented 2 years ago

Using Smart Light example with VS Code. Device is ESP32 Dev board. After complied, there is error message after linking:

Linking .pio/build/esp32dev/firmware.elf
.pio/build/esp32dev/src/main.cpp.o:(.literal._ZN16SINRICPRO_2_9_1714SinricProClass15handleSendQueueEv+0x0): undefined reference to `SINRICPRO_2_9_17::signMessage(String, ArduinoJson6115_000001::JsonDocument&)'
.pio/build/esp32dev/src/main.cpp.o: In function `SINRICPRO_2_9_17::SinricProClass::handleSendQueue()':
/Users/andy/Documents/PlatformIO/Projects/SinricPro Smart Light/.pio/libdeps/esp32dev/SinricPro/src/SinricPro.h:260: undefined reference to `SINRICPRO_2_9_17::signMessage(String, ArduinoJson6115_000001::JsonDocument&)'
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1

platformio.ini :

[env:esp32dev] platform = espressif32 board = esp32dev framework = arduino lib_deps = sinricpro/SinricPro @ ^2.9.17 ArduinoJson@~6.11 WebSockets fastled/FastLED @ ^3.5.0

Tried with 2.9.12 - 2.9.17, both has same error.

sivar2311 commented 2 years ago

Please clean the build directory (PlatformIO: clean) and try again.

eos1d3 commented 2 years ago

Thank a lot for prompt reply.

I did many times to clean it, and even delete the whole .pio folder. But the problem is still the same.

Running latest version of PIO on Mac Big Sur. All other ESP IDF, Arduino projects run fine.

sivar2311 commented 2 years ago

There must be some build artifacts somewhere. I cannot reproduce this. Everything is compiling fine here.

Do you have the same issue using one of the example sketches?

eos1d3 commented 2 years ago

I have a lot other Arduino projects, all run fine. I just tried to delete the project and create another one, same problem.

I do find SinricProSignature.h and SinricProSignature.cpp files. And they are used during compilation.

I have just create another project AGAIN, I got the same error.

kakopappa commented 2 years ago

image


;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]
; ============================================================
; chose environment:
; ESP8266
; ESP32
; ============================================================
default_envs = esp32dev
;default_envs = ESP32

[env]
; ============================================================
; Serial configuration
; choose upload speed, serial-monitor speed
; ============================================================
upload_speed = 921600
;upload_port = COM11
monitor_speed = 9600
;monitor_port = COM11

lib_deps =
  bblanchon/ArduinoJson@^6.19.1
  links2004/WebSockets@^2.3.6
  sinricpro/SinricPro@^2.9.17

build_flags =
; set your debug output (default=Serial)
 -D DEBUG_ESP_PORT=Serial
; comment the folowing line to enable Websockets debugging
 -D NODEBUG_WEBSOCKETS
; comment the folowing line to enable WiFi debugging
 -D NDEBUG
; comment the following line to enable SinricPro debugging
 -D NODEBUG_SINRIC

[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

I can compile in Ubuntu VM just fine.

sivar2311 commented 2 years ago

I do find SinricProSignature.h and SinricProSignature.cpp files. This is correct.

Please check if you have any global installations of SinricPro library. In PlatformIO you can isntall libraries to a global scope and/or to every project itself.

I guess there might be some leftovers from a global installed library.

sivar2311 commented 2 years ago

I can compile in Ubuntu VM just fine.

This reinforces my opinion that something is wrong with the build environment (leftovers etc).

eos1d3 commented 2 years ago

With your example above, I found I am using older ArduinoJson version.

After changing to ArduinoJson@^6.19.1, it works now!

Thanks a lot!

sivar2311 commented 2 years ago

Good that it is working for you :) @kakopappa thanks for the assistance 👍

Usually the library dependencies are installed automatically and there should no necessary to set a specific version in the project's platformio.ini. See here: https://github.com/sinricpro/esp8266-esp32-sdk/blob/bed36f1b3ef662cf78581bbe0c3b4bae381364ac/library.json#L22-L31

Do you have a specific ArduinoJson version set in your platformio.ini? (Then this could lead to an incompatibility)

eos1d3 commented 2 years ago

Hi, the root cause is from here:

https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/examples/platformio/platformio.ini

You better change this setting to stop people using the wrong one again. I just copied it without checking it is old version.

sivar2311 commented 2 years ago

Thanks for the info 👍 I will change the provided platformio.ini file in the examples.

sivar2311 commented 2 years ago

platformio.ini is now fixed in 2.9.17] (master branch, not released yet)

Thank you for your contribution!