Skip to content

Does v3.0.0 support std::variant and other RTTI-dependent features? #9370

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

Closed
1 task done
Zhu-jiatong opened this issue Mar 14, 2024 · 11 comments
Closed
1 task done
Assignees
Labels
Resolution: Wontfix Arduino ESP32 team will not fix the issue Type: Feature request Feature request for Arduino ESP32 Type: For reference Common questions & problems
Milestone

Comments

@Zhu-jiatong
Copy link

Related area

language features

Hardware specification

N/A

Is your feature request related to a problem?

I am making a JSON-related programme and would likely be using std::variant and other RTTI-related features. I would like to know if RTTI is enabled by default in v3.0.3. Thank you.

Describe the solution you'd like

Would be great of it is enabled by default.

Describe alternatives you've considered

No response

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@Zhu-jiatong Zhu-jiatong added the Type: Feature request Feature request for Arduino ESP32 label Mar 14, 2024
@VojtechBartoska
Copy link
Contributor

@me-no-dev Can you please help with triage? Thanks

@VojtechBartoska VojtechBartoska added the Status: Awaiting triage Issue is waiting for triage label Mar 14, 2024
@Jason2866
Copy link
Collaborator

No, it is not enabled by default. Can be seen here https://github.com/espressif/esp32-arduino-libs/blob/idf-release/v5.1/esp32/platformio-build.py
The file is used for Platformio but the settings are taken 1:1 from the build process with the Arduino Lib Builder when compiling the Arduino Libs.

@Zhu-jiatong
Copy link
Author

Zhu-jiatong commented Mar 14, 2024

So std::variant and std::any would be unusable?

@Jason2866
Copy link
Collaborator

yes, but you can enable rtti with-frtti by overwriting the default setting (-fno-rtti), at least with Platformio.
Idk if this is possible with ArduinoIDE.

@SuGlider
Copy link
Collaborator

For the Arduino IDE it would be necessary to change the platform.txt settings by using platform.local.txt
For more information: https://arduino.github.io/arduino-cli/0.35/platform-specification/

platform.local.txt can be placed in the same folder where a platform.txt already is.

  1. In the Arduino15_folder/packages/esp32/hardware/esp/<Core_Version>/platform.local.txt
  2. In the local cloned Arduino Core used as a board in sketchbook at sketchbook_folder/hardware/espressif/<Core_Version>/platform.local.txt

These are the default extra flags settings from ESP32 Arduino platform.txt.
It is possible to override anything from platform.txt, including recipes.

# These can be overridden in platform.local.txt
compiler.c.extra_flags=-MMD -c
compiler.cpp.extra_flags=-MMD -c
compiler.S.extra_flags=-MMD -c -x assembler-with-cpp
compiler.c.elf.extra_flags="-Wl,--Map={build.path}/{build.project_name}.map" "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-L{compiler.sdk.path}/{build.memory_type}" "-Wl,--wrap=esp_panic_handler"
compiler.ar.extra_flags=
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=
compiler.libraries.ldflags=

@SuGlider SuGlider added the Type: For reference Common questions & problems label Mar 14, 2024
@lucasssvaz lucasssvaz removed the Status: Awaiting triage Issue is waiting for triage label Mar 14, 2024
@Zhu-jiatong
Copy link
Author

Is there any reason as to why this feature is not supported by default?

@me-no-dev
Copy link
Member

There is no particular reason apart from not being enabled by default in IDF and you being the first to request it for the last 8 years :) we will assess any performance/size consequences of enabling it (there are some) and will enable it if everything is OK. Can not give you timeframe, because we need to improve our tooling a bit first

@Zhu-jiatong
Copy link
Author

Should a separate issue for adding default support of RTTI be opened? If so, should it be opened in the IDF repo or this repo?

@SuGlider
Copy link
Collaborator

Should a separate issue for adding default support of RTTI be opened? If so, should it be opened in the IDF repo or this repo?

This issue will be tracked for Arduino Core 3.0.1. All set.

@me-no-dev
Copy link
Member

Increases flash size with 2-7KB depending on chip and features.

@VojtechBartoska
Copy link
Contributor

Hello, after discussion we agreed that we will not implement this. Above mentioned PR have been closed, I am closing this ticket as wont do.

@VojtechBartoska VojtechBartoska closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
@github-project-automation github-project-automation bot moved this from Under investigation to Done in Arduino ESP32 Core Project Roadmap Jun 5, 2024
@VojtechBartoska VojtechBartoska added the Resolution: Wontfix Arduino ESP32 team will not fix the issue label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Wontfix Arduino ESP32 team will not fix the issue Type: Feature request Feature request for Arduino ESP32 Type: For reference Common questions & problems
Projects
6 participants