Error when building PlatformIO project with ILI9488_t3 package.

Demiurg

New member
So I wanted to play around with a LCD screen using the ILI9488 chip.
I'm using the teensy toolchain for the Teensy 4.0 from the PlatformIO plugin for CLion.
When I try to build the project while including the ILI9488_t3 library im getting the following error message:
Code:
/home/ubuntu/.platformio/packages/toolchain-gccarmnoneeabi-teensy/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/teensy40/libFrameworkArduino.a(new.cpp.o): in function `operator delete(void*)':
new.cpp:(.text._ZdlPv+0x0): multiple definition of `operator delete(void*)'; /home/ubuntu/.platformio/packages/toolchain-gccarmnoneeabi-teensy/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+dp/hard/libstdc++.a(del_op.o):(.text._ZdlPv+0x0): first defined here
/home/ubuntu/.platformio/packages/toolchain-gccarmnoneeabi-teensy/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/teensy40/libFrameworkArduino.a(new.cpp.o): in function `operator delete(void*, unsigned int)':
new.cpp:(.text._ZdlPvj+0x0): multiple definition of `operator delete(void*, unsigned int)'; /home/ubuntu/.platformio/packages/toolchain-gccarmnoneeabi-teensy/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+dp/hard/libstdc++.a(del_ops.o):(.text._ZdlPvj+0x0): first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/teensy40/firmware.elf] Error 1
The error only occurs when I include the package. When using CLion, PlatformIO and the teensy4.0 toolchain on other projects without the package, everything works just fine.
My code looks like this:
C++:
#include <Arduino.h>
#include "ILI9488_t3.h"

#define RST_PIN 22
#define DC_PIN 23
#define CS_PIN 10
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13

ILI9488_t3 screen = *new ILI9488_t3(CS_PIN, DC_PIN, RST_PIN, MOSI_PIN, SCK_PIN, MISO_PIN);

void setup() {
screen.begin();
}

void loop() {
}
Also, I don't know whether it's something with my ini file (mostly concerning dependencies). Anyways, here is the result of my attempts to solve my problem with the ini file:
Code:
[env:teensy40]
platform = teensy
board = teensy40
framework = arduino

; Build options
build_flags =
    -fno-exceptions

; Lib option
lib_deps_builtin =
    SPI
    DMAChannel

lib_deps =
;    https://github.com/PaulStoffregen/ILI9488_t3.git
    ILI9488_t3
Has anyone an idea what might be the problem and how to solve that?
Many thanks in advance!
 
What happens if you change:
Code:
ILI9488_t3 screen = *new ILI9488_t3(CS_PIN, DC_PIN, RST_PIN, MOSI_PIN, SCK_PIN, MISO_PIN);

to simply:
Code:
ILI9488_t3 screen(CS_PIN, DC_PIN, RST_PIN, MOSI_PIN, SCK_PIN, MISO_PIN);

And not create it using the new operator...
 
Well, that seems to do the trick. Thank you very much!
Why exactly does this error occurs. I mean what goes wrong internally when using the new operator in this situation?
 
Well, that seems to do the trick. Thank you very much!
Why exactly does this error occurs. I mean what goes wrong internally when using the new operator in this situation?
This has come up a few times recently with PlatformIO. It seems the toolchain they include (specifically the libstdc++ library) isn't built properly to work with Teensyduino overriding the default new/delete functions.

Edit: Actually, I remember what the actual issue is with this: the Teensyduino libraries have to be passed to the linker before libstdc++. That way the del_op object won't be pulled in, avoiding the multiple definitions.
 
Last edited:
Back
Top