Cannot compile bearssl with platformIO

When I try to compile Bearssl for the esp8266 platform I get the following error:

       /home/christian/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp: In function 'bool brssl::certificate_to_trust_anchor_inner(br_x509_trust_anchor*, const br_x509_certificate*)':
        /home/christian/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp:115:73: error: too many arguments to function 'void br_x509_decoder_init(br_x509_decoder_context*, void (*)(void*, const void*, size_t), void*)'
        br_x509_decoder_init(dc.get(), byte_vector_append, (void*)&vdn, 0, 0);
        ^
        In file included from .piolibdeps/ArduinoBearSSL_ID5571/src/bearssl/bearssl_ssl.h:36:0,
        from .piolibdeps/ArduinoBearSSL_ID5571/src/bearssl/bearssl.h:136,
        from /home/christian/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp:25:
        .piolibdeps/ArduinoBearSSL_ID5571/src/bearssl/bearssl_x509.h:987:6: note: declared here
        void br_x509_decoder_init(br_x509_decoder_context *ctx,
        ^
        Compiling .pioenvs/esp8266/lib75e/ESP8266WiFi/ESP8266WiFi.cpp.o

The BearSSLHelpers.cpp looks a bit strange to me on my systems _ have been replaced by spaces.

My platform.io ini looks like this:

    [env:esp8266]
    framework                 = arduino
    board                     = esp_wroom_02

    monitor_speed             = 115200
    upload_speed              = 921600
    upload_resetmethod        = nodemcu
    lib_deps                  = ArduinoBearSSL@1.3.0, ArduinoECCX08@1.3.2, SPI, Wire, ESP8266WiFi
    upload_port               = /dev/ttyUSB0
    platform                  = espressif8266@2.0.1
    build_flags               = -D NDEBUG
                                -mtarget-align
                                -DCLIENT_VERSION=V024
                                -Wl,-Map,firmware.map
                                -Wl,-Teagle.flash.2m512.ld
                                -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
                                -DVTABLES_IN_FLASH
                                -fno-exceptions

    board_build.flash_mode    = qio
    build_unflags             = -Wall
    build_unflags             = -Wall
    board_build.f_cpu         = 80000000L

Has anybody seen something similar?

Turns out the missing _ were due to vscode not displaying underscores in its terminal.

To answer my own post:
The issue seems to be that there is already a version of bearssl inside of the esp8266 arduino platform. These are incompatible.

Just remove the ArduinoBearSSL stuff and use the internal version here:

1 Like