ESP8266 Arduino Core master problem

Dear Sirs,
I have everything updated and I use ESP8266 Arduino Core master from github.

When I trying to compile any sketch that has cpp #include <TimeLib.h> then I get errors.
Even the simple RTC sketch from sketch builder is not error free… See the sketch:

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  Blynk can provide your device with time data, like an RTC.
  Please note that the accuracy of this method is up to several seconds.

  App project setup:
    RTC widget (no pin required)
    Value Display widget on V1
    Value Display widget on V2

  WARNING :
  For this example you'll need Time keeping library:
    https://github.com/PaulStoffregen/Time

  This code is based on an example from the Time library:
    https://github.com/PaulStoffregen/Time/blob/master/examples/TimeSerial/TimeSerial.ino
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

BlynkTimer timer;

WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + " " + month() + " " + year();
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();

  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Begin synchronizing time
  rtc.begin();

  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more: http://www.pjrc.com/teensy/td_libs_Time.html

  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);
}

void loop()
{
  Blynk.run();
  timer.run();
}

I got the errors:
In file included from E:\ARDUINO_ESP_DEV\arduino-IDE\hardware\esp8266com\esp8266/tools/sdk/libc/xtensa-lx106-elf/include/string.h:163:0,

             from E:\ARDUINO_ESP_DEV\arduino-IDE\portable\sketchbook\libraries\Time\DateStrings.cpp:22:

E:\ARDUINO_ESP_DEV\arduino-IDE\hardware\esp8266com\esp8266/tools/sdk/libc/xtensa-lx106-elf/include/sys/string.h:32:0: warning: “strcpy_P” redefined [enabled by default]

#define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT)

^

E:\ARDUINO_ESP_DEV\arduino-IDE\portable\sketchbook\libraries\Time\DateStrings.cpp:20:0: note: this is the location of the previous definition

#define strcpy_P(dest, src) strcpy((dest), (src))

Why? Please try to sort this out…

Best Regards,
Mike Kranidis

@mikekgr it compiles fine with latest beta and Arduino IDE 1.8.8. Maybe ask the Arduino / ESP guys what they broke in their master if you can’t get it to compile.

Hello @Costas
can you try to compile it with the master branch and let me know?
By the way, I have Arduino 1.8.8 too but this is irrelevant I think.

Thanks and Best Regards,
Mike Kranidis

please make sure that are you using 2.5.0-beta2 because I did a test environment with 2.5.0-beta2 and the problem persisted…

beta2 is fine. Think you have broken your IDE.

I really don’t think so… when/if I switch back to 2.4.2 with all the rest environment the same then the problem disappears

If it compiles on my beta2 and it doesn’t on yours then yours is broken, OK? Do a fresh portable install to confirm.

ok I will do it right now and I will report back

=== NO DON’T READ THIS PROCEED TO THE BELLOW MESSAGES ===
it is very strange but in a very new installation of Arduino 1.8.8 with ESP8266 Arduino Core 2.5.0-beta2 and Blynk 0.5.4 only then it compiled without errors as you said…
I don’t know what is possible wrong with my “official” Arduino IDE installation, but I will leave it for today
Thanks for the help! Goodnight

NO! The problem is there, just to see it please activate Compiler warnings: from None ( that is the pre-set value ) to Default ( that is at the File -> Preferences Arduino Menu ). Then you will see/have the same error… If you don’t then quit Arduino IDE, re-run it load your test sketch and do verify…
Please check and let me know

Compiler warnings are not a failure to compile.

Yes I know, and for this reason we got binary file. Apart of this, did you read what the error ( warning ) said? There is a conflict between them and this doesn’t guarantee the correct execution of the code…

I am not at my PC. Are you saying you are getting warnings or that it fails to compile?

I am getting warnings, the compilation seems to have finished ok

That was what I was saying, it compiled for me too.

But with your original install it failed to compile or you got warnings?

in both cases I got the above mentioned warnings. I had a message from esp8266 Arduino Core dev see it at:

I have been following your posts on the core GitHub rep. Your OP in this thread states errors not warnings.

strictly speaking, a compiler warning is an error but not fatal. In addition, I copy paste the error ( warning level ) when I opened the issue so I think that someone interested to read, will have all the required info…

1 Like

I am getting this very similar message today - using BlynkTimer. It sounds like there needs to be #ifdefs around the definition of #define htons(x) lwip_htons(x)

The giithub issue was closed as a 3rd party problem.

In file included from C:\Users\ms\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2/tools/sdk/lwip2/include/lwip/ip_addr.h:41:0,

             from C:\Users\ms\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2/tools/sdk/include/user_interface.h:30,

             from C:\Users\ms\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:29,

             from C:\Users\ms\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,

             from C:\Ard\libraries\Blynk\src/BlynkSimpleEsp8266.h:27,

             from C:\Ard\ILOTemp\ILOTemp\ILOTemp.ino:3:

C:\Users\ms\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2/tools/sdk/lwip2/include/lwip/def.h:108:0: warning: “htons” redefined [enabled by default]

#define htons(x) lwip_htons(x)

^

In file included from C:\Ard\libraries\Blynk\src/Blynk/BlynkApi.h:19:0,

             from C:\Ard\libraries\Blynk\src/BlynkApiArduino.h:14,

             from C:\Ard\libraries\Blynk\src/BlynkSimpleEsp8266.h:24,

             from C:\Ard\ILOTemp\ILOTemp\ILOTemp.ino:3:

C:\Ard\libraries\Blynk\src/Blynk/BlynkProtocolDefs.h:98:0: note: this is the location of the previous definition

     #define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )

It does compile, but my heart skips a beat when I see red text come up every time…