Skip to content

NetworkClientSecure errors (multiple) #11170

@Admsher

Description

@Admsher

Board

ESP32 CHIP as specified by ESP-IDF v5.3

Device Description

ESP32 One board : https://www.waveshare.com/wiki/ESP32_One

Hardware Configuration

ESP32 One has multiple connections with an FPC Connector and also SD Card slot. It also has GPIO connections to rspberry pi which can be seen in the link given.

Version

latest master (checkout manually)

IDE Name

ESP IDF

Operating System

Ubuntu 24.04

Flash frequency

40 Mhz

PSRAM enabled

yes

Upload speed

115200

Description

The issue comes for ssl_client.cpp file , it seems it doesn't get compiled and then eventually we get this error

when did further digging got to this error:
ssl_client.cpp:9:10: fatal error: Arduino.h: No such file or directory
9 | #include "Arduino.h"
| ^~~~~~~~~~~
compilation terminated.

Sketch

#include "SD.h"
#include "AudioTools.h"
#include "AudioTools/AudioLibs/A2DPStream.h"
#include "AudioTools/Disk/AudioSourceSDFAT.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
#include <base64.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
#include "esp_camera.h"
#include "FS.h"
#include "SPI.h"
#include <fstream>
#include <ArduinoJson.h>


#define CAMERA_MODEL_ESP_EYE 
#include "camera_pins.h"

const char *ssid = "";
const char *password = "";
URLStream url(ssid, password); // Music Stream
StreamCopy copier; //(i2s, music, 1024); // copy music to i2s
File file; // final output stream

const char *startFilePath="/";
const char* ext="mp3";
AudioSourceSDFAT source(startFilePath, ext,15); // , PIN_AUDIO_KIT_SD_CARD_CS);
A2DPStream out;
MP3DecoderHelix decoder;
AudioPlayer player(source, out, decoder);


const char* name = "LE-Flawless";        
AudioInfo info(44100, 2, 16);
SineWaveGenerator<int16_t> sineWave(32000);               // subclass of SoundGenerator with max amplitude of 32000
GeneratedSoundStream<int16_t> in(sineWave);               // Stream generated from sine wave
                                    
StreamCopy copymusic(out, in); // copy in to out



unsigned long lastCaptureTime = 0; // Last shooting time
int imageCount = 1;                // File Counter
bool camera_sign = false;          // Check camera status
bool sd_sign = false;              // Check sd status


// Name of the server we want to connect to
const char kHostname[] = "HOST_IP";
const int kPort = 443;

// Path to download (this is the bit after the hostname in the URL
// that you want to download
const char kPath[] = "/upload1";
const char kPath1[] = "/esp32";

int pictureNumber = 0;

uint8_t *fb_buf;
size_t fb_len;



void send_photo() {
    WiFiClient client;
    
    // Capture photo from camera
    camera_fb_t *fb = esp_camera_fb_get();
    if (!fb) {
        Serial.println("Camera capture failed");
        return;
    }

    // Encode image to Base64
    String encoded = base64::encode(fb->buf, fb->len);
    
    esp_camera_fb_return(fb);  // Release frame buffer

    // Send encoded image over WiFi
    if (client.connect(kHostname,kPort)) {
        Serial.println("Connected to server, sending data...");

        client.println("POST /upload1 HTTP/1.1");
        client.println("Host: HOST_IP");
        client.println("Content-Type: application/x-www-form-urlencoded");
        client.println("Content-Length: " + String(encoded.length()));
        client.println();
        client.println(encoded);
        client.println();
        
        Serial.println("Photo sent successfully");
    } else {
        Serial.println("Connection to server failed");
    }

    client.stop();  // Close connection
}


void receivedata(void) {
    // intialize SD
    if(!SD.begin()){   
        LOGE("SD failed");
        return;
    }
    Serial.println("Fetching..");
    // open music stream
    url.begin("https://HOST_IP:443/esp32/audio.mp3");
    Serial.println("Received");
    // copy file
    file = SD.open("audio.mp3", FILE_WRITE);
    file.seek(0); // overwrite from beginning
    copier.begin(file, url);
    copier.copyAll();
    // file.close();
   
}


void setup(){
    initArduino();  // Required to initialize Arduino framework
    Serial.begin(115200);

    AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
 

    camera_config_t config;
    config.ledc_channel = LEDC_CHANNEL_0;
    config.ledc_timer = LEDC_TIMER_0;
    config.pin_d0 = Y2_GPIO_NUM;
    config.pin_d1 = Y3_GPIO_NUM;
    config.pin_d2 = Y4_GPIO_NUM;
    config.pin_d3 = Y5_GPIO_NUM;
    config.pin_d4 = Y6_GPIO_NUM;
    config.pin_d5 = Y7_GPIO_NUM;
    config.pin_d6 = Y8_GPIO_NUM;
    config.pin_d7 = Y9_GPIO_NUM;
    config.pin_xclk = XCLK_GPIO_NUM;
    config.pin_pclk = PCLK_GPIO_NUM;
    config.pin_vsync = VSYNC_GPIO_NUM;
    config.pin_href = HREF_GPIO_NUM;
    config.pin_sccb_sda = SIOD_GPIO_NUM;
    config.pin_sccb_scl = SIOC_GPIO_NUM;
    config.pin_pwdn = PWDN_GPIO_NUM;
    config.pin_reset = RESET_GPIO_NUM;
    config.xclk_freq_hz = 20000000;
    config.frame_size = FRAMESIZE_UXGA;
    config.pixel_format = PIXFORMAT_JPEG;  // for streaming
    //config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
    config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
    config.fb_location = CAMERA_FB_IN_PSRAM;
    config.jpeg_quality = 12;
    config.fb_count = 1;

    // if PSRAM IC present, init with UXGA resolution and higher JPEG quality
    //                      for larger pre-allocated frame buffer.
    if (config.pixel_format == PIXFORMAT_JPEG) {
        if (psramFound()) {
        config.jpeg_quality = 10;
        config.fb_count = 2;
        config.grab_mode = CAMERA_GRAB_LATEST;
        } else {
        // Limit the frame size when PSRAM is not available
        config.frame_size = FRAMESIZE_SVGA;
        config.fb_location = CAMERA_FB_IN_DRAM;
        }
    } 

    // camera init
    esp_err_t err = esp_camera_init(&config);
    if (err != ESP_OK) {
        Serial.printf("Camera init failed with error 0x%x", err);
        return;
    }
    
    camera_sign = true; // Camera initialization check passes



    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
        delay(1000);
        Serial.println("Connecting to WiFi..");
        Serial.println(WiFi.status());

    }
    Serial.println("Connected to WiFi!");


    SPI.begin(14,12,13,15);

    if(!SD.begin(15)){
        Serial.println("Card Mount Failed");
        return;
        }
        uint8_t cardType = SD.cardType();

        // Determine if the type of SD card is available
        if(cardType == CARD_NONE){
        Serial.println("No SD card attached");
        return;
        }

        Serial.print("SD Card Type: ");
        if(cardType == CARD_MMC){
        Serial.println("MMC");
        } else if(cardType == CARD_SD){
        Serial.println("SDSC");
        } else if(cardType == CARD_SDHC){
        Serial.println("SDHC");
        } else {
        Serial.println("UNKNOWN");
        }


    sd_sign = true; // sd initialization check passes
    



    // setup player
    // Setting up SPI if necessary with the right SD pins by calling 
    SPI.begin(14,12,13,15);
    player.setVolume(0.8);
    player.begin();

    // setup output - We send the test signal via A2DP - so we conect to a Bluetooth Speaker
    auto cfg = out.defaultConfig(TX_MODE);
    cfg.silence_on_nodata = true; // prevent disconnect when there is no audio data
    cfg.name = "LE-FLawless";  // set the device here. Otherwise the first available device is used for output
    //cfg.auto_reconnect = true;  // if this is use we just quickly connect to the last device ignoring cfg.name
    out.begin(cfg);





}


void loop(){
    // take a photo every 24 seconds
    unsigned long now = millis();
    if ((now - lastCaptureTime) >= 24000) {
        char filename[32];
        send_photo();
        receivedata();
        // player.copy();
        
        Serial.println("Photos will begin in one 24 seconds, please be ready.");
        imageCount++;
        lastCaptureTime = now;
    }
}

Debug Message

/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure4stopEv+0x0): undefined reference to `_Z15stop_ssl_socketP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure5writeEPKhj+0xc): undefined reference to `_Z13send_net_dataP17sslclient_contextPKhj'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure5writeEPKhj+0x10): undefined reference to `_Z13send_ssl_dataP17sslclient_contextPKhj'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure4readEPhj+0x8): undefined reference to `_Z15get_net_receiveP17sslclient_contextPhi'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure4readEPhj+0xc): undefined reference to `_Z15get_ssl_receiveP17sslclient_contextPhi'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure9availableEv+0xc): undefined reference to `_Z16peek_net_receiveP17sslclient_contexti'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure9availableEv+0x10): undefined reference to `_Z12data_to_readP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure7connectE9IPAddresstPKcS2_S2_S2_+0x8): undefined reference to `_Z16start_ssl_clientP17sslclient_contextRK9IPAddressmPKciS5_bS5_S5_S5_S5_bPS5_'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecure7connectE9IPAddresstPKcS2_S2_S2_+0xc): undefined reference to `_Z22ssl_starttls_handshakeP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj):(.literal._ZN19NetworkClientSecureC2Ev+0x8): undefined reference to `_Z8ssl_initP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZN19NetworkClientSecure4stopEv':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:102:(.text._ZN19NetworkClientSecure4stopEv+0x6): undefined reference to `_Z15stop_ssl_socketP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZZN19NetworkClientSecureC4EvENKUlP17sslclient_contextE_clES1_':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:36:(.text._ZZN19NetworkClientSecureC4EvENKUlP17sslclient_contextE_clES1_+0x6): undefined reference to `_Z15stop_ssl_socketP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZN19NetworkClientSecure5writeEPKhj':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:231:(.text._ZN19NetworkClientSecure5writeEPKhj+0x16): undefined reference to `_Z13send_net_dataP17sslclient_contextPKhj'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:239:(.text._ZN19NetworkClientSecure5writeEPKhj+0x74): undefined reference to `_Z13send_ssl_dataP17sslclient_contextPKhj'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZN19NetworkClientSecure4readEPhj':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:253:(.text._ZN19NetworkClientSecure4readEPhj+0x10): undefined reference to `_Z15get_net_receiveP17sslclient_contextPhi'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:286:(.text._ZN19NetworkClientSecure4readEPhj+0xdc): undefined reference to `_Z15get_ssl_receiveP17sslclient_contextPhi'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZN19NetworkClientSecure9availableEv':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:298:(.text._ZN19NetworkClientSecure9availableEv+0xe): undefined reference to `_Z16peek_net_receiveP17sslclient_contexti'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:302:(.text._ZN19NetworkClientSecure9availableEv+0x2e): undefined reference to `_Z12data_to_readP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZN19NetworkClientSecure7connectE9IPAddresstPKcS2_S2_S2_':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:148:(.text._ZN19NetworkClientSecure7connectE9IPAddresstPKcS2_S2_S2_+0x2c): undefined reference to `_Z16start_ssl_clientP17sslclient_contextRK9IPAddressmPKciS5_bS5_S5_S5_S5_bPS5_'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:151:(.text._ZN19NetworkClientSecure7connectE9IPAddresstPKcS2_S2_S2_+0x3f): undefined reference to `_Z22ssl_starttls_handshakeP17sslclient_context'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZN19NetworkClientSecure7connectEPKctS1_S1_':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:196:(.text._ZN19NetworkClientSecure7connectEPKctS1_S1_+0x3f): undefined reference to `_Z16start_ssl_clientP17sslclient_contextRK9IPAddressmPKciS5_bS5_S5_S5_S5_bPS5_'
/home/admsher/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/arduino/libarduino.a(NetworkClientSecure.cpp.obj): in function `_ZN19NetworkClientSecureC2Ev':
/home/admsher/esp32-new/components/arduino/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp:35:(.text._ZN19NetworkClientSecureC2Ev+0x33): undefined reference to `_Z8ssl_initP17sslclient_context'
collect2: error: ld returned 1 exit status

Other Steps to Reproduce

No response

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

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions