Xtensa-lx106-elf-g++: error: unrecognized command line option '-std=gnu++17'

Hi.
I’m very new on PlatformIO, trying to move from Arduino IDE but at the moment just cone some projects.
At the first that project works fine but after a last platform upgrade ¿? that didn’t work.

That’s terminal output:

Compiling .pio\build\esp8266_d1mini\src\PacketRequestGenerator.cpp.o
xtensa-lx106-elf-g++: error: unrecognized command line option '-std=gnu++17'
xtensa-lx106-elf-g++: error: unrecognized command line option '-std=gnu++17'
xtensa-lx106-elf-g++: error: unrecognized command line option '-std=gnu++17'
*** [.pio\build\esp8266_d1mini\src\DIYBMSServer.cpp.o] Error 1
*** [.pio\build\esp8266_d1mini\src\PacketReceiveProcessor.cpp.o] Error 1
*** [.pio\build\esp8266_d1mini\src\HAL_ESP8266.cpp.o] Error 1
xtensa-lx106-elf-g++: error: unrecognized command line option '-std=gnu++17'
*** [.pio\build\esp8266_d1mini\src\PacketRequestGenerator.cpp.o] Error 1

Problems output:

No se encuentra "C:\Users\Alb\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include".

No se encuentra = Can’t find

and output:

[21/6/2021 23:44:21] Para los archivos de código fuente de C, cStandard se ha cambiado de "c17" a "c11" en función de los argumentos del compilador y de la consulta de compilerPath: "C:/Users/Alb/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gcc.exe"
[21/6/2021 23:44:21] Para los archivos de código fuente de C++, cppStandard se ha cambiado de "c++17" a "c++14" en función de los argumentos del compilador y de la consulta de compilerPath: "C:/Users/Alb/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gcc.exe"

that’s platform.io

[env:esp8266_d1mini]
; ESP8266 D1 MINI 4M bytes Flash buy from here https://amzn.to/3i1gPIz
; The MINI PRO version also works but is no longer required
; *** ESP8266 CORE for Arduino version 2.7.4

platform = espressif8266
board = d1_mini
upload_protocol = esptool
board_build.mcu = esp8266
board_build.f_cpu = 80000000L
upload_speed=250000
upload_port=COM4
board_build.filesystem = littlefs
platform_packages = 
        platformio/toolchain-xtensa@2.40802.200502
        platformio/framework-arduinoespressif8266

You’ will be help me for new files/printouts/procedures to find the problem. Good point of start will be to downgrade versions, but how?

Thanks!

No way can a GCC 4.8.2 compiler support C++17. That compiler was released 2013. You are attempting to use the latest framework version with an outdated compiler.

Remove the lines

and retry. You can also open a CLI and execute pio platform update espressif8266 to make sure you get the latest version.

 pio platform update espressif8266 
Platform espressif8266
--------
Updating platformio/espressif8266             3.0.0                              [Up-to-date]
Updating platformio/toolchain-xtensa          2.100200.0 @ ~2.100200.0           [Up-to-date]
Updating platformio/framework-arduinoespressif8266 3.30000.210519 @ ~3.30000.0        [Up-to-date]
Updating platformio/tool-esptool              1.413.0 @ <2                       [Up-to-date]
Updating platformio/tool-esptoolpy            1.30000.201119 @ ~1.30000.0        [Up-to-date]
Updating platformio/tool-mkspiffs             1.200.0 @ ~1.200.0                 [Up-to-date]
Updating platformio/tool-mklittlefs           1.203.210203 @ ~1.203.0            [Up-to-date]

Version looks fine.

If I remove platform lines I get a lot of code errors like:
.pio\libdeps\esp8266_d1mini\NtpClientLib\src/NtpClientLib.h:508:32: error: reference to ‘byte’ is ambiguous
.pio\libdeps\esp8266_d1mini\NtpClientLib\src/NtpClientLib.h:508:32: error: ‘byte’ has not been declared

and much more…

So can I try to get other frameworks changing these numbers: platformio/toolchain-xtensa@2.40802.200502 ? wich can I test?

The new 3.0.0 core release has indeed broken a lot of things (see e.g. here).

It might be better if you stay on the stable version before that to get running again, which would be platform version 2.6.3. So try the platformio.ini

[env:esp8266_d1mini]
; ESP8266 D1 MINI 4M bytes Flash buy from here https://amzn.to/3i1gPIz
; The MINI PRO version also works but is no longer required
; *** ESP8266 CORE for Arduino version 2.7.4

platform = espressif8266@2.6.3
board = d1_mini
upload_protocol = esptool
board_build.mcu = esp8266
board_build.f_cpu = 80000000L
upload_speed=250000
upload_port=COM4
board_build.filesystem = littlefs

(docs).

If that works you might want to look into getting up-to-date libraries and/or update the sketch code to work with the current 3.0.0 release.

1 Like

PS: This probably comes from the new C++ 17 standard also defining std::byte and someone somewhere probably does a using namespace std; which pulls this type into the global namespace and thus conflicting with Arduino’s byte type definition.

Thanks! this work for me:

platform = espressif8266@2.6.3
 ;platformio/toolchain-xtensa@2.40802.200502   ->delete or coment
 ;platformio/framework-arduinoespressif8266  -> delete or coment

:smiley: :smiley: :smiley: