Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Default arduino Libs(BLE, WiFiClientSecure) giving error #6680

Closed
CodeOn-ArK opened this issue May 3, 2022 · 12 comments
Closed

Using Default arduino Libs(BLE, WiFiClientSecure) giving error #6680

CodeOn-ArK opened this issue May 3, 2022 · 12 comments
Labels
Area: ESP-IDF related ESP-IDF related issues Type: Question Only question

Comments

@CodeOn-ArK
Copy link

Board

ESP32 Dev Module

Device Description

ESP-WROOM 32 DevKitC

Hardware Configuration

NULL

Version

v2.0.0

IDE Name

IDF

Operating System

Linux

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

115200

Description

I am trying to use arduino libraries such as WIFIClientSecure.h in the IDF project. I am able to link IDF components with ease, but am unable to use arduino libraries such as BLE and WIFiClientSecure. It gives undefined reference error. Is there something else that needs to be done to use default arduino libs?

Sketch

The include header :

#include <WiFiClientSecure.h>

The variables :

WiFiClientSecure client;
MQTTPubSubClient mqtt;
String old,prev_state;

Just the inclusion of these give error as mentioned below



### Debug Message

```plain
[ 41%] Built target __idf_esp_phy
Consolidate compiler generated dependencies of target __idf_espcoredump
[ 41%] Built target __idf_espcoredump
Consolidate compiler generated dependencies of target __idf_esp_gdbstub
[ 42%] Built target __idf_esp_gdbstub
Consolidate compiler generated dependencies of target __idf_pthread
[ 43%] Built target __idf_pthread
Consolidate compiler generated dependencies of target __idf_nvs_flash
[ 44%] Built target __idf_nvs_flash
Consolidate compiler generated dependencies of target __idf_spi_flash
[ 46%] Built target __idf_spi_flash
Consolidate compiler generated dependencies of target __idf_bootloader_support
[ 48%] Built target __idf_bootloader_support
Consolidate compiler generated dependencies of target __idf_app_update
[ 49%] Built target __idf_app_update
Consolidate compiler generated dependencies of target mbedtls
[ 50%] Built target mbedtls
Consolidate compiler generated dependencies of target mbedx509
[ 51%] Built target mbedx509
Consolidate compiler generated dependencies of target mbedcrypto
[ 58%] Built target mbedcrypto
Consolidate compiler generated dependencies of target __idf_mbedtls
[ 59%] Built target __idf_mbedtls
Consolidate compiler generated dependencies of target __idf_esp_pm
[ 60%] Built target __idf_esp_pm
Consolidate compiler generated dependencies of target __idf_driver
[ 62%] Built target __idf_driver
Consolidate compiler generated dependencies of target __idf_esp_ipc
[ 62%] Built target __idf_esp_ipc
Consolidate compiler generated dependencies of target __idf_efuse
[ 63%] Built target __idf_efuse
Consolidate compiler generated dependencies of target __idf_esp_ringbuf
[ 63%] Built target __idf_esp_ringbuf
Consolidate compiler generated dependencies of target __idf_json
Consolidate compiler generated dependencies of target __idf_mdns
Consolidate compiler generated dependencies of target __idf_protobuf-c
Consolidate compiler generated dependencies of target __idf_esp_adc_cal
[ 63%] Built target __idf_protobuf-c
Consolidate compiler generated dependencies of target __idf_esp_hid
[ 64%] Built target __idf_json
[ 64%] Built target __idf_esp_adc_cal
Consolidate compiler generated dependencies of target __idf_wear_levelling
[ 64%] Built target __idf_mdns
[ 64%] Built target __idf_esp_hid
Consolidate compiler generated dependencies of target __idf_asio
Consolidate compiler generated dependencies of target __idf_spiffs
[ 65%] Built target __idf_spiffs
Consolidate compiler generated dependencies of target __idf_openssl
[ 66%] Built target __idf_wear_levelling
Consolidate compiler generated dependencies of target __idf_unity
[ 67%] Built target __idf_openssl
[ 67%] Built target __idf_asio
Consolidate compiler generated dependencies of target __idf_cbor
[ 67%] Built target __idf_unity
Consolidate compiler generated dependencies of target __idf_coap
Consolidate compiler generated dependencies of target __idf_esp_lcd
Consolidate compiler generated dependencies of target __idf_esp_websocket_client
[ 68%] Built target __idf_cbor
[ 68%] Built target __idf_esp_websocket_client
Consolidate compiler generated dependencies of target __idf_expat
[ 69%] Built target __idf_esp_lcd
[ 71%] Built target __idf_coap
Consolidate compiler generated dependencies of target __idf_freemodbus
[ 72%] Built target __idf_expat
Consolidate compiler generated dependencies of target __idf_jsmn
Consolidate compiler generated dependencies of target __idf_libsodium
Consolidate compiler generated dependencies of target __idf_mqtt
[ 72%] Built target __idf_jsmn
Consolidate compiler generated dependencies of target __idf_perfmon
[ 72%] Built target __idf_mqtt
[ 72%] Built target __idf_perfmon
[ 75%] Built target __idf_freemodbus
[ 84%] Built target __idf_libsodium
Consolidate compiler generated dependencies of target __idf_cmock
Consolidate compiler generated dependencies of target __idf_protocomm
[ 84%] Built target __idf_cmock
Consolidate compiler generated dependencies of target __idf_fatfs
[ 85%] Built target __idf_protocomm
Consolidate compiler generated dependencies of target __idf_wifi_provisioning
[ 86%] Built target __idf_fatfs
Consolidate compiler generated dependencies of target __idf_esp_local_ctrl
[ 86%] Built target __idf_esp_local_ctrl
[ 87%] Built target __idf_wifi_provisioning
Consolidate compiler generated dependencies of target __idf_arduino
[ 98%] Built target __idf_arduino
Consolidate compiler generated dependencies of target __idf_MQTTPubSubClient
[ 98%] Built target __idf_MQTTPubSubClient
Consolidate compiler generated dependencies of target __idf_main
[ 98%] Built target __idf_main
[ 99%] Built target __ldgen_output_sections.ld
Consolidate compiler generated dependencies of target hello.elf
[ 99%] Linking CXX executable hello.elf
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj):(.literal._ZN16WiFiClientSecure4stopEv+0x4): undefined reference to `stop_ssl_socket(sslclient_context*, char const*, char const*, char const*)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj):(.literal._ZN16WiFiClientSecure5writeEPKhj+0x0): undefined reference to `send_ssl_data(sslclient_context*, unsigned char const*, unsigned int)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj):(.literal._ZN16WiFiClientSecure4readEPhj+0x0): undefined reference to `get_ssl_receive(sslclient_context*, unsigned char*, int)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj):(.literal._ZN16WiFiClientSecure9availableEv+0x0): undefined reference to `data_to_read(sslclient_context*)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj):(.literal._ZN16WiFiClientSecureC2Ev+0x4): undefined reference to `ssl_init(sslclient_context*)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj):(.literal._ZN16WiFiClientSecure7connectEPKctS1_S1_S1_+0xc): undefined reference to `start_ssl_client(sslclient_context*, char const*, unsigned int, int, char const*, bool, char const*, char const*, char const*, char const*, bool, char const**)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj): in function `WiFiClientSecure::stop()':
/home/ubuntu/hello/components/arduino/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp:97: undefined reference to `stop_ssl_socket(sslclient_context*, char const*, char const*, char const*)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj): in function `WiFiClientSecure::write(unsigned char const*, unsigned int)':
/home/ubuntu/hello/components/arduino/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp:193: undefined reference to `send_ssl_data(sslclient_context*, unsigned char const*, unsigned int)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj): in function `WiFiClientSecure::read(unsigned char*, unsigned int)':
/home/ubuntu/hello/components/arduino/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp:223: undefined reference to `get_ssl_receive(sslclient_context*, unsigned char*, int)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj): in function `WiFiClientSecure::available()':
/home/ubuntu/hello/components/arduino/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp:237: undefined reference to `data_to_read(sslclient_context*)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj): in function `WiFiClientSecure::WiFiClientSecure()':
/home/ubuntu/hello/components/arduino/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp:36: undefined reference to `ssl_init(sslclient_context*)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj): in function `WiFiClientSecure::connect(char const*, unsigned short, char const*, char const*, char const*)':
/home/ubuntu/hello/components/arduino/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp:134: undefined reference to `start_ssl_client(sslclient_context*, char const*, unsigned int, int, char const*, bool, char const*, char const*, char const*, char const*, bool, char const**)'
/home/ubuntu/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/arduino/libarduino.a(WiFiClientSecure.cpp.obj): in function `WiFiClientSecure::connect(char const*, unsigned short, char const*, char const*)':
/home/ubuntu/hello/components/arduino/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp:154: undefined reference to `start_ssl_client(sslclient_context*, char const*, unsigned int, int, char const*, bool, char const*, char const*, char const*, char const*, bool, char const**)'
collect2: error: ld returned 1 exit status
CMakeFiles/hello.elf.dir/build.make:503: recipe for target 'hello.elf' failed
make[2]: *** [hello.elf] Error 1
CMakeFiles/Makefile2:2131: recipe for target 'CMakeFiles/hello.elf.dir/all' failed
make[1]: *** [CMakeFiles/hello.elf.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2
make failed with exit code 2



### Other Steps to Reproduce

_No response_

### I have checked existing issues, online documentation and the Troubleshooting Guide

- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@CodeOn-ArK CodeOn-ArK added the Status: Awaiting triage Issue is waiting for triage label May 3, 2022
@SuGlider
Copy link
Collaborator

SuGlider commented May 3, 2022

@CodeOn-ArK - Is this an IDF project?

Are you using Arduino as a Component?

@VojtechBartoska VojtechBartoska added Area: ESP-IDF related ESP-IDF related issues Resolution: Awaiting response Waiting for response of author and removed Status: Awaiting triage Issue is waiting for triage labels May 3, 2022
@SuGlider
Copy link
Collaborator

SuGlider commented May 3, 2022

@CodeOn-ArK - Please take a look at
https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html

@VojtechBartoska VojtechBartoska added the Type: Question Only question label May 3, 2022
@CodeOn-ArK
Copy link
Author

@CodeOn-ArK - Is this an IDF project?

Are you using Arduino as a Component?

Yes and yes

@CodeOn-ArK
Copy link
Author

CodeOn-ArK commented May 3, 2022

@CodeOn-ArK - Please take a look at
https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html

What does it do actually? The library builder

@CodeOn-ArK
Copy link
Author

why did this issue suddenly closed?

@SuGlider
Copy link
Collaborator

SuGlider commented May 4, 2022

why did this issue suddenly closed?

This issue has not closed. It is still open. I think that you are seeing the "closed label" from issue #1142

@SuGlider
Copy link
Collaborator

SuGlider commented May 4, 2022

@CodeOn-ArK - Please take a look at
https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html

What does it do actually? The library builder

Lib Builder is a set of scripts that will actually build all Arduino Libraries used folder:
https://github.com/espressif/arduino-esp32/tree/master/tools/sdk

Arduino uses IDF precompiled libraries.
Lib builder scripts will git clone all necessary resources and externals repositories.
It will compile Arduino as a Component into the tools/sdk, compile all together and create this repository.
It is used when IDF has changed and it is necessary to update all IDF libraries used by Arduino (precompiled IDF libs).

@VojtechBartoska
Copy link
Contributor

@CodeOn-ArK Do you still need help?

@CodeOn-ArK
Copy link
Author

No, got the thing resolved.

@VojtechBartoska VojtechBartoska removed the Resolution: Awaiting response Waiting for response of author label May 18, 2022
@AndruKrug
Copy link

same problem, how did you solve it?

@CodeOn-ArK
Copy link
Author

I really don't remember rn, but using the master works ig, and it's basic installation and setup mistake

@AndruKrug
Copy link

AndruKrug commented Apr 28, 2023

Solution:
It is necessary to change the parameters in the menuconfig according to the warning:
.../.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src/ssl_client.cpp:24:4: warning: #warning "Please call idf.py menuconfig then go to Component config -> mbedTLS
-> TLS Key Exchange Methods -> Enable pre-shared-key ciphersuites and then check Enable PSK based cyphersuite modes. Save and Quit." [-Wcpp]
_# warning "Please call idf.py menuconfig then go to Component config -> mbedTLS -> TLS Key Exchange Methods -> Enable pre-shared-key ciphersuites and then check Enable PSK based cyphersuite modes.
Save and Quit."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ESP-IDF related ESP-IDF related issues Type: Question Only question
Projects
None yet
Development

No branches or pull requests

4 participants