PlatformIO Community

Get erro when building

Hi,

I need help!

I’m working in telemetry project based on a Arduino ESP32. When I’m trying to build the project, I get the erro:

c:/users/breno/.platformio/packages/toolchain-xtensa-esp32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\src\dataserver.cpp.o:(.data.urlHandlerList+0x14): undefined reference to `handlerControl(UrlHandlerParam*)’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1

I put all sources of my project on Github: Freematics/firmware_v5/telelogger at master · stanleyhuangyc/Freematics · GitHub

Heres all the log when building

Processing esp32dev (platform: https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream; board: esp32dev; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------
* Adding toolchain toolchain-riscv32-esp with version 8.4.0+2021r2
* Adding toolchain toolchain-xtensa-esp32 with version 8.4.0+2021r2
* Adding toolchain toolchain-xtensa-esp32s2 with version 8.4.0+2021r2
* Adding toolchain toolchain-riscv32-esp with version 8.4.0+2021r2
* Adding toolchain toolchain-xtensa-esp32 with version 8.4.0+2021r2
* Adding toolchain toolchain-xtensa-esp32s2 with version 8.4.0+2021r2
Verbose mode can be enabled via `-v, --verbose` option
* Adding toolchain toolchain-riscv32-esp with version 8.4.0+2021r2
* Adding toolchain toolchain-xtensa-esp32 with version 8.4.0+2021r2
* Adding toolchain toolchain-xtensa-esp32s2 with version 8.4.0+2021r2
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.3.1+sha.3784198) > Espressif ESP32 Dev Module
HARDWARE: ESP32 160MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (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 @ 0.0.0+sha.caef400 
 - tool-esptoolpy @ 1.30100.210531 (3.1.0)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2
Converting telelogger.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 36 compatible libraries
Scanning dependencies...
Dependency Graph
|-- FreematicsPlus
|   |-- WiFi @ 2.0.0
|   |-- SPI @ 2.0.0
|-- FS @ 2.0.0
|-- httpd
|-- SD @ 2.0.0
|   |-- FS @ 2.0.0
|   |-- SPI @ 2.0.0
|-- SPI @ 2.0.0
|-- SPIFFS @ 2.0.0
|   |-- FS @ 2.0.0
|-- WiFi @ 2.0.0
|-- FreematicsOLED
|   |-- Wire @ 2.0.0
Building in release mode
Compiling .pio\build\esp32dev\src\dataserver.cpp.o
Compiling .pio\build\esp32dev\src\teleclient.cpp.o
Compiling .pio\build\esp32dev\src\telelogger.ino.cpp.o
Compiling .pio\build\esp32dev\src\telemesh.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFi.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiAP.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiClient.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiGeneric.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiMulti.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiSTA.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiScan.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiServer.cpp.o
Compiling .pio\build\esp32dev\libc77\WiFi\WiFiUdp.cpp.o
Compiling .pio\build\esp32dev\libf81\SPI\SPI.cpp.o
Compiling .pio\build\esp32dev\libd89\FreematicsPlus\FreematicsGPS.cpp.o
Compiling .pio\build\esp32dev\libd89\FreematicsPlus\FreematicsMEMS.cpp.o
Archiving .pio\build\esp32dev\libf81\libSPI.a
Compiling .pio\build\esp32dev\libd89\FreematicsPlus\FreematicsNetwork.cpp.o
Compiling .pio\build\esp32dev\libd89\FreematicsPlus\FreematicsOBD.cpp.o
Compiling .pio\build\esp32dev\libd89\FreematicsPlus\FreematicsPlus.cpp.o
Compiling .pio\build\esp32dev\libd89\FreematicsPlus\utility\ICM_20948_C.c.o
Compiling .pio\build\esp32dev\libd89\FreematicsPlus\utility\ble_spp_server.c.o
Archiving .pio\build\esp32dev\libc77\libWiFi.a
Compiling .pio\build\esp32dev\lib9b9\FS\FS.cpp.o
Compiling .pio\build\esp32dev\lib9b9\FS\vfs_api.cpp.o
Compiling .pio\build\esp32dev\lib2a0\httpd\httpd.c.o
Compiling .pio\build\esp32dev\lib2a0\httpd\httpjson.c.o
Compiling .pio\build\esp32dev\lib2a0\httpd\httppil.c.o
Compiling .pio\build\esp32dev\lib508\SD\SD.cpp.o
C:/Users/breno/Downloads/Freematics-master/libraries/httpd/httpd.c:107:23: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 char* defaultPages[]={"index.htm","index.html","default.htm","main.xul"};
                       ^~~~~~~~~~~
C:/Users/breno/Downloads/Freematics-master/libraries/httpd/httpd.c:107:35: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 char* defaultPages[]={"index.htm","index.html","default.htm","main.xul"};
                                   ^~~~~~~~~~~~
C:/Users/breno/Downloads/Freematics-master/libraries/httpd/httpd.c:107:48: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 char* defaultPages[]={"index.htm","index.html","default.htm","main.xul"};
                                                ^~~~~~~~~~~~~
C:/Users/breno/Downloads/Freematics-master/libraries/httpd/httpd.c:107:62: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 char* defaultPages[]={"index.htm","index.html","default.htm","main.xul"};
                                                              ^~~~~~~~~~
Compiling .pio\build\esp32dev\lib508\SD\sd_diskio.cpp.o
Compiling .pio\build\esp32dev\lib508\SD\sd_diskio_crc.c.o
Compiling .pio\build\esp32dev\lib5d2\SPIFFS\SPIFFS.cpp.o
Compiling .pio\build\esp32dev\liba0f\Wire\Wire.cpp.o
Compiling .pio\build\esp32dev\lib531\FreematicsOLED\FreematicsOLED.cpp.o
Archiving .pio\build\esp32dev\lib9b9\libFS.a
Archiving .pio\build\esp32dev\libd89\libFreematicsPlus.a
Archiving .pio\build\esp32dev\lib2a0\libhttpd.a
Archiving .pio\build\esp32dev\lib508\libSD.a
Archiving .pio\build\esp32dev\liba0f\libWire.a
Archiving .pio\build\esp32dev\lib5d2\libSPIFFS.a
Archiving .pio\build\esp32dev\lib531\libFreematicsOLED.a
Linking .pio\build\esp32dev\firmware.elf
c:/users/breno/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\src\dataserver.cpp.o:(.data.urlHandlerList+0x14): undefined reference to `handlerControl(UrlHandlerParam*)'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1

Thanks

Big red flag: I would not recommend using this outdated branch at all – it seems you have that from an old recommendation on how to use Arduino-ESP32 2.x.x when offical support wasn’t yet out. This “upstream” branch is 140 commits behind master. Set platform = espressif32 and use pio platform update espressif32 in the CLI accordingly to get the 2.0.3 core.

In regards to the actual

undefined reference to `handlerControl(UrlHandlerParam*)’

error: Looking at Search · handlerControl · GitHub I see that function is implemented in the projects ESPRIT/garden_controller and ESPRIT/gps_logger, but in the projects firmware_v5/telelogger and firmware_v5/datalogger the function is only referenced but never implemented.

Continuing the discussion from Get erro when building:

Thanks.

But, an error show when I am trying to upload.

Linking .pio\build\esp32dev\firmware.elf
c:/users/breno/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libFrameworkArduino.a(main.cpp.o):(.literal._Z8loopTaskPv+0x8): undefined reference to `setup()'
c:/users/breno/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libFrameworkArduino.a(main.cpp.o):(.literal._Z8loopTaskPv+0xc): undefined reference to `loop()'
c:/users/breno/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libFrameworkArduino.a(main.cpp.o): in function `loopTask(void*)':
C:/Users/breno/.platformio/packages/framework-arduinoespressif32@src-afacabbe58d012c05a6ee24950dc6ba1/cores/esp32/main.cpp:42: undefined reference to `setup()'
c:/users/breno/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:/Users/breno/.platformio/packages/framework-arduinoespressif32@src-afacabbe58d012c05a6ee24950dc6ba1/cores/esp32/main.cpp:48: undefined reference to `loop()'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1

Can you update the repo with the newest files so I can check against that?

I am a newbie at this. So, I don’t know if the information bellow help.

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.2
;build_flags = -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
board=esp32dev
board_build.f_cpu = 160000000L
framework = arduino
monitor_speed = 115200

[platformio]
src_dir=.

[env]
lib_extra_dirs=../../libraries

Well for faithfull reproduction I’d need all the files. I meant that Freematics/firmware_v5/telelogger at master · stanleyhuangyc/Freematics · GitHub is still not updated.

Sorry for the delay in replying.

The docs are here (telelogger_brtostes/telelogger at main · brtostes/telelogger_brtostes · GitHub).