forked from thijse/Arduino-Log
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I get a linker error on esp32-s3 board (arduino espressif 3.2.0, idf 5.4.0, cpp23)
ArduinoLog/src/ArduinoLog.h:427:(.text._ZN7Logging10printLevelIPKcEEvibT_z[_ZN7Logging10printLevelIPKcEEvibT_z]+0x30): undefined reference to `_ZN7Logging8writeLogIJPK19__FlashStringHelperEEEvDpT_'
/root/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: ArduinoLog/src/ArduinoLog.h:480:(.text._ZN7Logging10printLevelIPKcEEvibT_z[_ZN7Logging10printLevelIPKcEEvibT_z]+0xae): undefined reference to `_ZN7Logging8writeLogIJPKcEEEvDpT_'
/root/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: ArduinoLog/src/ArduinoLog.h:454:(.text._ZN7Logging10printLevelIPKcEEvibT_z[_ZN7Logging10printLevelIPKcEEvibT_z]+0xc3): undefined reference to `_ZN7Logging8writeLogIJcEEEvDpT_'
/root/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: ArduinoLog/src/ArduinoLog.h:455:(.text._ZN7Logging10printLevelIPKcEEvibT_z[_ZN7Logging10printLevelIPKcEEvibT_z]+0xce): undefined reference to `_ZN7Logging8writeLogIJPKcEEEvDpT_'
/root/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: ArduinoLog/src/ArduinoLog.h:475:(.text._ZN7Logging10printLevelIPKcEEvibT_z[_ZN7Logging10printLevelIPKcEEvibT_z]+0xea): undefined reference to `_ZN7Logging8writeLogIJPKcEEEvDpT_'
/root/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: ArduinoLog/src/ArduinoLog.h:433:(.text._ZN7Logging10printLevelIPKcEEvibT_z[_ZN7Logging10printLevelIPKcEEvibT_z]+0xfa): undefined reference to `_ZN7Logging8writeLogIJPKcEEEvDpT_'
/root/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: ArduinoLog/src/ArduinoLog.h:430:(.text._ZN7Logging10printLevelIPKcEEvibT_z[_ZN7Logging10printLevelIPKcEEvibT_z]+0x116): undefined reference to `_ZN7Logging8writeLogIJPKcEEEvDpT_'I think the issue is that for some reason the toolchain-riscv32-esp @ 14 links differently somhow and does not see the writeLog template definition in the cpp file.
// ArduinoLog.cpp
template<typename... Args> void Logging::writeLog(Args... args) {
for (int i = 0; i < _handlerCount; i++) {
if (_logOutputs[i]) {
_logOutputs[i]->print(args...);
}
}
}If I move the writeLog within the class in declaration file compilation works.
// ArduinoLog.h
// ...
private:
template<typename... Args>
void writeLog(Args... args) {
for (int i = 0; i < _handlerCount; i++) {
if (_logOutputs[i]) {
_logOutputs[i]->print(args...);
}
}
}
//...Metadata
Metadata
Assignees
Labels
No labels