Skip to content

undefined reference to `MD5Update' in arduino as component #5925

Closed
@qt1

Description

@qt1

The compilation of a project referencing MD5Builder fails link with undefined reference to `MD5Update'

Creating a minimal project with this error:

  1. Latest ESP-IDF, install.sh and export.sh

  2. Create new project using

     idf.py create-project proj1
     cd proj1
    

At this point the project compiles.

  1. Add arduino-esp32 as in the docs

     mkdir -p components && \
     cd components && \
     git clone https://github.com/espressif/arduino-esp32.git arduino && \
     cd arduino && \
     git submodule update --init --recursive && \
     cd ../.. && \
     idf.py menuconfig
    
  2. Rename 'proj1.c' to 'proj1.cpp' and change in 'CMakeList.txt', content from docs. At this point the project still compiles

  3. Add reference to 'MD5Builder.h' like so: (based on the example in the docs)

     //file: proj1.cpp
     #include "Arduino.h"
     
     #include "MD5Builder.h"
     
     void setup(){
         Serial.begin(115200);
     
         MD5Builder hasher;
         hasher.add("hello");
         Serial.println( hasher.toString());
     }
     
     void loop(){
         Serial.println("loop");
         delay(1000);
     }
     
     extern "C" {
     void app_main(void)
     {
         setup();
         while(1)
             loop();
     }
     }
    

Now the compilation fails with linker error:

    ../components/arduino/cores/esp32/MD5Builder.cpp:37: undefined reference to `MD5Update'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    ninja failed with exit code 1

Please advise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions