Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

Build errors xtensa-lx106-elf-gcc: error: unrecognized command line option '-std=c17'

Open TD-er opened this issue 6 years ago • 13 comments

Basic Infos

  • [x] This issue complies with the issue POLICY doc.
  • [x] I have read the documentation at readthedocs and the issue is not addressed there.
  • [x] I have tested that the issue is present in current master branch (aka latest git).
  • [x] I have searched the issue tracker for a similar issue.
  • [x] If there is a stack dump, I have decoded it.
  • [x] I have filled out all fields below.

Platform

  • Hardware: [ESP-12]
  • Core Version: [latest git hash or date]
  • Development Env: [Platformio]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Generic ESP8266 Module]
  • Flash Mode: [dio]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory|Higher Bandwidth]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [OTA|SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

Trying to build the 'staging' version of the esp8266/Arduino code and my compiler keeps complaining about not recognizing the -std=c17 flag.

xtensa-lx106-elf-gcc: error: unrecognized command line option '-std=c17'

Tried in PlatformIO several things, like changing the platform version.

The current version I'm having (which is not working):

platform                  = [email protected]
platform_packages         =
	framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git
build_flags               = ${esp82xx_2_6_x.build_flags}
                            -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191122
                            -Wno-deprecated-declarations
                            -std=gnu99	
                            -std=c++11
build_unflags             = -std=c17	
                            -std=gnu++17

So my question is, what should be done to make it compile in Windows? By the way, tried it in Linux and without any extras installed (not tested any) it will also not compile there.

TD-er avatar Jul 23 '20 08:07 TD-er

That would mean its using the wrong compiler. You probably have other releases installed and its finding that compiler first.

MarkusAD avatar Jul 23 '20 12:07 MarkusAD

Any idea how to fix that? My assumption is that it would be included in the toolset that is installed by PlatformIO, as I never installed a compiler specifically. Also it should be possible to run several compiler versions on the same build machine as I don't want to break anything using the older core lib versions.

TD-er avatar Jul 23 '20 12:07 TD-er

On linux I had remnants of an old arduino-ide install left over in ~/.arduino15 and ~/.arduino15/packages. rm'ing them solved it.

MarkusAD avatar Jul 23 '20 12:07 MarkusAD

Well I'm not using Arduino IDE, but PlatformIO, which usually does a good job in separating things per build env declared in the platformio.ini file.

TD-er avatar Jul 23 '20 12:07 TD-er

And Makefiles do that even better for me, Find your conflicting compiler and youll solve your problem

MarkusAD avatar Jul 23 '20 12:07 MarkusAD

Strictly speaking, you may be right, but the problem is that it is all installed "automagically" by PlatformIO and even though I may be able to fix it for my specific build environment. But that's going to cause dozens of reported issues of users of my project that are unable to compile it out of the box. So I want it to be fixed in the toolchain, hence this issue.

TD-er avatar Jul 23 '20 12:07 TD-er

That would indicate a platformIO issue then. Maybe ask there since the latest git master and releases here are working fine and have nothing to do with any "staging" releases.

MarkusAD avatar Jul 23 '20 12:07 MarkusAD

Well something has changed here, as it was working well and some merge to the "master" branch included some build flags what made it cause to no longer build.

It could very well be PlatformIO related, but I am simply not sure. So as it got "broken" by some changes here, that's where I first start.

TD-er avatar Jul 23 '20 12:07 TD-er

The merge was switching to gcc-10 here, which works fine if you use the correct compiler.

MarkusAD avatar Jul 23 '20 12:07 MarkusAD

Guess you got pointed in the right direction eh?

MarkusAD avatar Jul 23 '20 12:07 MarkusAD

Not sure, I opened an issue at the PlatformIO repo: https://github.com/platformio/platform-espressif8266/issues/224

So we'll see if I got redirected again to the right repo as that happens quite often with these kind of issues. :(

TD-er avatar Jul 23 '20 12:07 TD-er

Sounds to me like platformIO just needs gcc-10 installed. Hope it works out.

MarkusAD avatar Jul 23 '20 12:07 MarkusAD

After deleting the esp8266 board package using the Board manager there were still files in my folder C:\Users<me>\AppData\Local\Arduino15\packages. After deleting these files the compiler warning disappeared.

mathertel avatar Sep 11 '20 15:09 mathertel