Compilation Errors while Building PPPoS Client Library with Latest Espressif32 Version 6.4.0

Hello all,

I am currently facing challenges while attempting to build the PPPoS client library with the latest Espressif32 version 6.4.0. Below, I have outlined the platform and environment setup

Platform and Environment Configuration:

[env:esp32dev]
platform = espressif32
board = esp32dev
board_build.partitions = min_spiffs.csv
framework = arduino
monitor_speed = 115200
lib_deps =
   lib/PPPOSClient
build_flags =
	-DCONFIG_LWIP_PPP_SUPPORT=1
	-DCONFIG_LWIP_PPP_CHAP_SUPPORT=1

Error log :

c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o):(.literal.pppos_client_task+0xc): undefined reference to `pppos_input_tcpip'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o):(.literal.PPPOS_start+0x10): undefined reference to `pppapi_set_default'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o):(.literal.PPPOS_start+0x14): undefined reference to `pppapi_set_auth'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o):(.literal.PPPOS_start+0x18): undefined reference to `pppapi_connect'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o):(.literal.PPPOS_start+0x1c): undefined reference to `pppapi_pppos_create'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o):(.literal.PPPOS_stop+0x0): undefined reference to `pppapi_close'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o):(.literal.PPPOS_stop+0x8): undefined reference to `pppapi_free'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o): in function `pppos_client_task':
C:\Users\noush\OneDrive\Documents\PlatformIO\Projects\bolt_esp32_ocpp_V4/lib/PPPOSClient/src/PPPOS.c:171: undefined reference to `pppos_input_tcpip'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o): in function `PPPOS_start':
C:\Users\noush\OneDrive\Documents\PlatformIO\Projects\bolt_esp32_ocpp_V4/lib/PPPOSClient/src/PPPOS.c:215: undefined reference to `pppapi_set_default'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\noush\OneDrive\Documents\PlatformIO\Projects\bolt_esp32_ocpp_V4/lib/PPPOSClient/src/PPPOS.c:216: undefined reference to `pppapi_set_auth'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\noush\OneDrive\Documents\PlatformIO\Projects\bolt_esp32_ocpp_V4/lib/PPPOSClient/src/PPPOS.c:218: undefined reference to `pppapi_connect'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\noush\OneDrive\Documents\PlatformIO\Projects\bolt_esp32_ocpp_V4/lib/PPPOSClient/src/PPPOS.c:209: undefined reference to `pppapi_pppos_create'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libfe7/libPPPOSClient.a(PPPOS.c.o): in function `PPPOS_stop':
C:\Users\noush\OneDrive\Documents\PlatformIO\Projects\bolt_esp32_ocpp_V4/lib/PPPOSClient/src/PPPOS.c:229: undefined reference to `pppapi_close'
c:/users/noush/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\noush\OneDrive\Documents\PlatformIO\Projects\bolt_esp32_ocpp_V4/lib/PPPOSClient/src/PPPOS.c:232: undefined reference to `pppapi_free'
**collect2.exe: error: ld returned 1 exit status**
***** [.pio\build\esp32dev\firmware.elf] Error 1**

I had no issues integrating the library with Espressif32 version 4.0.0.
Any help or advice would be greatly appreciated.

Wut? Arduino-ESP32 (framework = arduino) has a precompiled ESP-IDF base, you can’t add config flags after the fact. It has no effect, nothing in LWIP or ESP-IDF is recompiled. For that it has to be an ESP-IDF project with Arduino-ESP32 as a ESP-IDF component (framework = arduino, espidf). Use platform-espressif32/examples/espidf-arduino-blink at develop · platformio/platform-espressif32 · GitHub as a starting point. Use menuconfig to add you needed config options, not build_flags.

Hello,

I’m currently working with Espressif32 (version 6.4.0) using the Arduino framework. In this version, I’ve included the flags CONFIG_PPP_SUPPORT and CONFIG_LWIP_PPP_SUPPORT, and the code compiles successfully. However, during the linking phase, there are issues as the linker cannot locate references to certain variables.

Undefiend reference is exactly what you get when you are changing the build flags so that it thinks certain function exist, but those aren’t actually in the precompiled ESP-IDF file. Again, using the method above will work for that.

Hi,

After removing all the flags I couldn’t even compile, the code got some undefined functions and variables.

And that happened with what platformio.ini and a clean blinky code?

I tried the espidf-arduino-blink code to build successfully in 3 environment, then I add pppos client dependency and got the following errors

without pppos client

with pppos client

Processing esp320 (board: esp320; platform: espressif32; framework: arduino, espidf)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp320.html
PLATFORM: Espressif 32 (6.4.0) > Electronic SweetPeas ESP320
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
 - framework-espidf @ 3.40405.230623 (4.4.5)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-ninja @ 1.9.0
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- PPPOSClient @ 1.0.0
Building in release mode
Compiling .pio\build\esp320\lib0b2\PPPOSClient\PPPOS.c.o
Compiling .pio\build\esp320\lib0b2\PPPOSClient\PPPOSClient.cpp.o
In file included from .pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:8:
C:/Users/noush/.platformio/packages/framework-espidf/components/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
 #warning "esp_event_loop.h is deprecated, please include esp_event.h instead"
  ^~~~~~~
In file included from .pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:14:
C:/Users/noush/.platformio/packages/framework-espidf/components/tcpip_adapter/include/tcpip_adapter.h:15:2: warning: #warning "This header is deprecated, please use new network related API in esp_netif.h" [-Wcpp]
 #warning "This header is deprecated, please use new network related API in esp_netif.h"
  ^~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:43:1: error: unknown type name 'ppp_pcb'
 ppp_pcb *ppp;
 ^~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:49:27: error: unknown type name 'ppp_pcb'
 static void ppp_status_cb(ppp_pcb *pcb, int err_code, void *ctx)
                           ^~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:149:34: error: unknown type name 'ppp_pcb'
 static u32_t ppp_output_callback(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx)
                                  ^~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c: In function 'pppos_client_task':
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:165:17: error: implicit declaration of function 'pppos_input_tcpip'; did you mean 'gpio_input_get'? [-Werror=implicit-function-declaration]
                 pppos_input_tcpip(ppp, (u8_t *)data, len);
                 ^~~~~~~~~~~~~~~~~
                 gpio_input_get
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c: In function 'PPPOS_init':
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:191:3: warning: 'tcpip_adapter_init' is deprecated [-Wdeprecated-declarations]
   tcpip_adapter_init();
   ^~~~~~~~~~~~~~~~~~
In file included from C:/Users/noush/.platformio/packages/framework-espidf/components/esp_netif/include/esp_netif.h:35,
                 from C:/Users/noush/.platformio/packages/framework-espidf/components/esp_event/include/esp_event_legacy.h:22,
                 from C:/Users/noush/.platformio/packages/framework-espidf/components/esp_event/include/esp_event.h:28,
                 from C:/Users/noush/.platformio/packages/framework-espidf/components/esp_wifi/include/esp_wifi.h:56,
                 from .pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:7:
C:/Users/noush/.platformio/packages/framework-espidf/components/tcpip_adapter/include/tcpip_adapter.h:34:6: note: declared here
 void tcpip_adapter_init(void)  __attribute__ ((deprecated));
      ^~~~~~~~~~~~~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c: In function 'PPPOS_start':
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:203:15: error: implicit declaration of function 'pppapi_pppos_create' [-Werror=implicit-function-declaration]
         ppp = pppapi_pppos_create(&ppp_netif, ppp_output_callback, ppp_status_cb, NULL);
               ^~~~~~~~~~~~~~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:203:47: error: 'ppp_output_callback' undeclared (first use in this function); did you mean 'dns_found_callback'?
         ppp = pppapi_pppos_create(&ppp_netif, ppp_output_callback, ppp_status_cb, NULL);
                                               ^~~~~~~~~~~~~~~~~~~
                                               dns_found_callback
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:203:47: note: each undeclared identifier is reported only once for each function it appears in
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:203:68: error: 'ppp_status_cb' undeclared (first use in this function); did you mean 'nvs_stats_t'?
         ppp = pppapi_pppos_create(&ppp_netif, ppp_output_callback, ppp_status_cb, NULL);
                                                                    ^~~~~~~~~~~~~
                                                                    nvs_stats_t
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:209:9: error: implicit declaration of function 'pppapi_set_default'; did you mean 'netif_set_default'? [-Werror=implicit-function-declaration]
         pppapi_set_default(ppp);
         ^~~~~~~~~~~~~~~~~~
         netif_set_default
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:210:9: error: implicit declaration of function 'pppapi_set_auth' [-Werror=implicit-function-declaration]
         pppapi_set_auth(ppp, PPPAUTHTYPE_PAP, PPP_User, PPP_Pass);
         ^~~~~~~~~~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:210:30: error: 'PPPAUTHTYPE_PAP' undeclared (first use in this function); did you mean 'IP_SET_TYPE_VAL'?
         pppapi_set_auth(ppp, PPPAUTHTYPE_PAP, PPP_User, PPP_Pass);
                              ^~~~~~~~~~~~~~~
                              IP_SET_TYPE_VAL
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:211:9: error: implicit declaration of function 'ppp_set_usepeerdns' [-Werror=implicit-function-declaration]
         ppp_set_usepeerdns(ppp, 1);
         ^~~~~~~~~~~~~~~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:212:9: error: implicit declaration of function 'pppapi_connect'; did you mean 'lwip_connect'? [-Werror=implicit-function-declaration]
         pppapi_connect(ppp, 0);
         ^~~~~~~~~~~~~~
         lwip_connect
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c: In function 'PPPOS_stop':
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:223:3: error: implicit declaration of function 'pppapi_close'; did you mean 'lwip_close'? [-Werror=implicit-function-declaration]    
   pppapi_close(ppp, 0);
   ^~~~~~~~~~~~
   lwip_close
At top level:
.pio/libdeps/esp320/PPPOSClient/src/PPPOS.c:40:20: warning: 'TAG' defined but not used [-Wunused-variable]
 static const char *TAG = "status";
                    ^~~
cc1.exe: some warnings being treated as errors
*** [.pio\build\esp320\lib0b2\PPPOSClient\PPPOS.c.o] Error 1
In file included from C:/Users/noush/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:80,
                 from C:/Users/noush/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:36,
                 from .pio/libdeps/esp320/PPPOSClient/src/PPPOSClient.h:10,
                 from .pio/libdeps/esp320/PPPOSClient/src/PPPOSClient.cpp:1:
.pio/libdeps/esp320/PPPOSClient/src/PPPOSClient.cpp: In member function 'virtual size_t PPPOSClient::write(const uint8_t*, size_t)':
.pio/libdeps/esp320/PPPOSClient/src/PPPOSClient.cpp:159:59: error: 'fd' was not declared in this scope
                 log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno));
                                                           ^~
.pio/libdeps/esp320/PPPOSClient/src/PPPOSClient.cpp:159:17: note: in expansion of macro 'log_e'
                 log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno));
                 ^~~~~
.pio/libdeps/esp320/PPPOSClient/src/PPPOSClient.cpp:159:59: note: suggested alternative: 'find'
                 log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno));
                                                           ^~
.pio/libdeps/esp320/PPPOSClient/src/PPPOSClient.cpp:159:17: note: in expansion of macro 'log_e'
                 log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno));
                 ^~~~~
*** [.pio\build\esp320\lib0b2\PPPOSClient\PPPOSClient.cpp.o] Error 1
========================================================================== [FAILED] Took 11.74 seconds ==========================================================================

Environment    Status    Duration
-------------  --------  ------------
esp32dev       FAILED    00:00:13.303
espea32        FAILED    00:00:11.063
esp320         FAILED    00:00:11.737
===================================================================== 3 failed, 0 succeeded in 00:00:36.104 =====================================================================

Environment setup
[env]

platform = espressif32

framework = arduino, espidf

build_flags =

-D CONFIG_BLINK_GPIO=2

monitor_speed = 115200

lib_deps = levkovigor/PPPOSClient@^1.0

[env:esp32dev]

board = esp32dev

[env:espea32]

board = espea32

[env:esp320]

board = esp320

  1. Seems like you’re running into https://github.com/levkovigor/ppposclient/issues/8 which technically is the responsibility of the library author

Did you use menuconfig to activate PPP / PPPOS support? That function is only visible if

Hi,
After activating ppp/pppos via menuconfig, I can build the espidf-arduino-blink code successfully.


But I am working on a project written only in arduino framework, I think it doesn’t have menuconfig option, then how can I enable ppp/pppos?. I tried via build flag but got some errors like undefined references .Is there any other method to fix this?
my project environment

[env:esp32dev]
platform = espressif32
board = esp32dev
board_build.partitions = min_spiffs.csv
framework = arduino
monitor_speed = 115200
lib_deps = 
	https://github.com/tzapu/WiFiManager.git
	https://github.com/anupamsaikia/ArduinoOcpp.git
	fastled/FastLED@^3.5.0
	xoseperez/HLW8012@^1.1.2
	lib/PPPOSClient
build_flags =
    -D AO_DBG_LEVEL=AO_DL_INFO ; flood the serial monitor with information about the internal state
    -DAO_TRAFFIC_OUT   ; print the OCPP communication to the serial monitor
	
1 Like

Well, at least what I found is that I get the least amount of errors and warnings using actually Arduino-ESP 1.0.6 (and not 2.0.0 as the project described) and fixing what seems to be a bug (fd()socketfiledescriptor). I’ve forked the library from an also more advanced fork and can successfully compile the original example code with just

[env:esp32dev]
; will use Arduino-ESP32 1.0.6 at that platform version
platform = espressif32@^3.0.0
board = esp32dev
framework = arduino
lib_deps =
  knolleary/PubSubClient@^2.8
  https://github.com/maxgerhardt/ppposclient/archive/refs/heads/main.zip

Ultimately: It’s the library authors responsbility to make sure they Arduino library works with the latest framework.

Hello,
I am looking for a PPPoS client library compatible with the latest Arduino framework(Espressif32 v-6.4.0). Our project requires integration of GSM with PPPoS. Your help is greatly appreciated.

Thanks.