-
Notifications
You must be signed in to change notification settings - Fork 13.3k
strptime dissapeared on 3.0.0 #8122
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
Comments
As requested in the template you deleted, please provide an MCVE so we can reproduce. Otherwise there's not much we can do. FWIW,
|
#3522
In
always defines __GNU_VISIBLE to 0, thereby disabling |
It builds fine with release 2.7.4 |
@asturcon3 I can repro with the example @dok-net , but you don't need to write your own version. Just add this line to your code:
Basically, the code is there in the library, but the defines in the new build seem to disable the prototype from being parsed. This is most likely related to the Newlib 4.0.0 release (about 5 years newer than the on in 2.7.4), and needs some digging. The above prototype will get you goin in the meantime. |
not sure if it's related but adding this to my sketch solved the issue: extern "C" void *memrchr (const void *__restrict, int __restrict, size_t __restrict); |
It seems that defining diff --git a/platform.txt b/platform.txt
index 5b4a1442..88d9c82b 100644
--- a/platform.txt
+++ b/platform.txt
@@ -56,7 +56,7 @@ compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
compiler.sdk.path={runtime.platform.path}/tools/sdk
compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf
-compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core"
+compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core"
compiler.c.cmd=xtensa-lx106-elf-gcc
compiler.c.flags=-c {compiler.warning_flags} -std=gnu17 {build.stacksmash_flags} -Os -g -free -fipa-pta -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.mmuflags} {build.non32xferflags} diff --git a/tools/platformio-build.py b/tools/platformio-build.py
index d8a97982..35a88fe4 100644
--- a/tools/platformio-build.py
+++ b/tools/platformio-build.py
@@ -73,6 +73,7 @@ env.Append(
"-mtext-section-literals",
"-falign-functions=4",
"-U__STRICT_ANSI__",
+ "-D_GNU_SOURCE",
"-ffunction-sections",
"-fdata-sections",
"-Wall", |
Fixes esp8266#8122 Newlib 4.0 doesn't enable the GNU extension functions by default, so add the appropriate flag to the build process. Thanks to @d-a-v for debugging!
@tobozo @asturcon3 @dok-net can you please give #8147 a try and report back? Simple tests look good to me w/it. |
https://stackoverflow.com/questions/5582211/what-does-define-gnu-source-imply makes me seriously doubt that this is such a good idea for an embedded platform. Lots of function prototypes that make no sense at all on the ESPs are then available... Perhaps this needs a little more investigation. For instance, |
And as a case in point, the above mentioned |
Furthermore, |
@earlephilhower adding a gnu flag to the platform.txt has the same positive effect as adding the extern C signature in my sketch. @dok-net I've compared binary size and dynamic memory size at the end of compilation between the two tests, although compiling with the gnu flag takes a little more time, both builds produce similar results. I tried |
@earlephilhower @tobozo I didn't think I would have to provide the full solution instead of a few hints :-) Here it is anyway, PR #8150 is based on and supersedes the one by d-a-v #8147 |
@dok-net thanks for the link, I'm still getting this at compilation even after adding
It's still fixed by using |
Nobody is making people use the extended functionality, so this won't actively hurt folks or make sketches bigger. If authors do need to do what |
Arduino last IDE, esp8266 just updated to 3.0.0, and I'm getting undefined error for strptime. After playing with and without XSI_VISIBLE, searching the includes, trying with and without time.h and timelib.h, I'm doing a workaround (parsing the old way) and letting you know.
The text was updated successfully, but these errors were encountered: