Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker problem with typeinfo for fs::FileImpl in version 5.3.0 & arduino core 2.0.6 #987

Closed
rvbc1 opened this issue Dec 30, 2022 · 14 comments

Comments

@rvbc1
Copy link

rvbc1 commented Dec 30, 2022

All files are compiling ok, but linker returns error as below
.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: build/local/esp-idf/framework-arduinoespressif32/libframework-arduinoespressif32.a(vfs_api.o):(.rodata._ZTI11VFSFileImpl[typeinfo for VFSFileImpl]+0x8): undefined reference to typeinfo for fs::FileImpl'`
On Version 5.2.0 & Arduino core 2.0.5 code is compiling ok

@Jason2866
Copy link
Contributor

Example Sketch? There are code changes in Arduino for this part. You probably have to adopt your code.

@alex-code
Copy link

I just updated to 5.3 and get this error too on code that previously compiled ok.

Googling for solutions I found mention of RTTI.
I'm using build_unflags = -fno-rtti as there's use of dynamic_cast

Possibly related espressif/arduino-esp32#7585

@Jason2866
Copy link
Contributor

@alex-code The toolchains (compiler) does not support rtti. You cant do build_unflags = -fno-rtti

@alex-code
Copy link

@alex-code The toolchains (compiler) does not support rtti. You cant do build_unflags = -fno-rtti

Been working for me before 5.3

This compiles on 5.2

; Condensed
platform = [email protected]
build_flags =
	-std=gnu++17
build_unflags =
	-std=gnu++11
	-fno-rtti

This fails on 5.3

; Condensed
platform = [email protected]
build_flags =
	-std=gnu++17
build_unflags =
	-std=gnu++11
	-fno-rtti

c:/users/me/.platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/firebeetle2/lib0e2/libFS.a(vfs_api.cpp.o):(.rodata._ZTI11VFSFileImpl[_ZTI11VFSFileImpl]+0x8): undefined reference to typeinfo for fs::FileImpl'

@Jason2866
Copy link
Contributor

Jason2866 commented Jan 5, 2023

Exactly, toolchains changed from 5.2.0 to 5.3.0 from patch3 to patch5.
rtti was never supported correctly in the toolchains. Espressif fixed this and removed the faulty rtti support in patch5 tool chains.
Anyways this is not a platformio issue, since Arduino IDE behaviour is the same.
There is a reason why -fno-rtti is set as default ;-)

@valeros
Copy link
Member

valeros commented Jan 6, 2023

Thanks @Jason2866 for clarifying. Indeed seems like the issue is caused by updated toolchains which is out of our control. Anyone who's experiencing the same issue please update your project configuration as described above.

@valeros valeros closed this as completed Jan 6, 2023
@LK-Simon
Copy link

LK-Simon commented Feb 8, 2024

This is not resolved, and is indeed a serious problem!

Just because your library doesn't use RTTI, doesn't mean there aren't plenty of us with code that DOES reliably and with necessity use RTTI.

@Jason2866
Copy link
Contributor

@LK-Simon At the end the issue was something different ;-).
The fix espressif/arduino-esp32#8768

Currently not in any released core. Fix will be included in core 3.0.0 and the fix is backported in bug fix core 2.0.15. Whenever both core will be released. As long this is not happened you have to do the change locally.

@LK-Simon
Copy link

LK-Simon commented Feb 9, 2024

@LK-Simon At the end the issue was something different ;-). The fix espressif/arduino-esp32#8768

Currently not in any released core. Fix will be included in core 3.0.0 and the fix is backported in bug fix core 2.0.15. Whenever both core will be released. As long this is not happened you have to do the change locally.

Hi @Jason2866, how do I get Platformio to use the fixed version of the core? :) This has been driving me nuts because my Event Engine absolutely requires RTTI, and I have other issues that make using an older version of the ESP lib untenable.

@Jason2866
Copy link
Contributor

@LK-Simon This should work:

platform = espressif32 @ 6.5.0
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#release/v2.x

@LK-Simon
Copy link

@LK-Simon This should work:

platform = espressif32 @ 6.5.0
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#release/v2.x

You, sir, are a life-saver!

@MatersM
Copy link

MatersM commented Feb 29, 2024

Exactly run into the same issue.... it works now, great @Jason2866

@mathemaphysics
Copy link

This is an error on their part. I've overridden the build options to use -frtti everywhere. It works. Their compiler does not find this single typeinfo. This is the only one. Just libFS.a can't find fs::FileImpl's typeinfo. That's it. Nothing else.

This looks to be a compiler issue.

@Jason2866
Copy link
Contributor

@mathemaphysics you have to add this change in your framework https://github.com/espressif/arduino-esp32/pull/8768/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants