Arduino CDT Windows for ESP8266: Problem with Time.h/time.h [message #1723298] |
Sat, 13 February 2016 18:12 |
Stephan Muehlstrasser Messages: 33 Registered: July 2009 |
Member |
|
|
Hi,
I'm not sure whether this is a bug of Arduino CDT. The problem can be reproduced like this (I have also attached the Arduino project):
- Create a new Arduino project for ESP8266
- Add the "Time: Timekeeping functionality for Arduino" library
- Modify the main module of the project like this:
#include <Arduino.h>
#include <Time.h>
void setup() {
}
void loop() {
}
- Run the build. The build fails when compiling the ".../esp8266/time.c" time module:
"C:/Users/stm/.arduinocdt/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-ar" cru "generic/arduino.ar" "generic/platform/cores/esp8266/StreamString.cpp.o"
"C:/Users/stm/.arduinocdt/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\stm\.arduinocdt\packages\esp8266\hardware\esp8266\esp8266\2.0.0/tools/sdk/include" -c -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections -DF_CPU=80000000L -DARDUINO=10607 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266 -I"C:/Users/stm/.arduinocdt/packages/esp8266/hardware/esp8266/esp8266/2.0.0/cores/esp8266" -I"C:/Users/stm/.arduinocdt/packages/esp8266/hardware/esp8266/esp8266/2.0.0/variants/generic" -I"C:/Users/stm/.arduinocdt/libraries/Time/1.5.0" "C:/Users/stm/.arduinocdt/packages/esp8266/hardware/esp8266/esp8266/2.0.0/cores/esp8266/time.c" -o "generic/platform/cores/esp8266/time.c.o"
In file included from C:\Users\stm\.arduinocdt\packages\esp8266\hardware\esp8266\esp8266\2.0.0/tools/sdk/include/os_type.h:10:0,
from C:\Users\stm\.arduinocdt\packages\esp8266\hardware\esp8266\esp8266\2.0.0/tools/sdk/include/sntp.h:4,
from C:/Users/stm/.arduinocdt/packages/esp8266/hardware/esp8266/esp8266/2.0.0/cores/esp8266/time.c:20:
C:\Users\stm\.arduinocdt\packages\esp8266\hardware\esp8266\esp8266\2.0.0/tools/sdk/include/ets_sys.h:148:20: error: unknown type name 'size_t'
void *pvPortMalloc(size_t xWantedSize) __attribute__((malloc, alloc_size(1)));
^
C:\Users\stm\.arduinocdt\packages\esp8266\hardware\esp8266\esp8266\2.0.0/tools/sdk/include/ets_sys.h:149:32: error: unknown type name 'size_t'
void *pvPortRealloc(void* ptr, size_t xWantedSize) __attribute__((alloc_size(2)));
^
...
If I understand it correctly, the problem is that because of the case insensitivity on Windows the compiler finds the "Time.h" header of the Arduino "Time" library instead of the "time.h" system header of the ESP8266 compiler, because the -I"C:/Users/stm/.arduinocdt/libraries/Time/1.5.0" include path is present when compiling the system module "time.c".
The question is, why are the library include paths present on the compiler command line when the system modules are compiled? It should be enough to have them for the modules of the user's project.
--
Stephan
-
Attachment: timetest.zip
(Size: 985.34KB, Downloaded 246 times)
|
|
|
|
Re: Arduino CDT Windows for ESP8266: Problem with Time.h/time.h [message #1723324 is a reply to message #1723307] |
Sun, 14 February 2016 10:02 |
Stephan Muehlstrasser Messages: 33 Registered: July 2009 |
Member |
|
|
Hi David,
thanks for the analysis, but it appears to me that you are assuming that I did set up the cross compiler myself in the CDT project. This is not the case, the Arduino CDT plugin did set up all the include paths, I did not do any manual configuration myself.
David Vavra wrote on Sat, 13 February 2016 21:00Well, the compiler is complaining about the missing definition of the type size_t which is generally found in stddef.h
Apparently the missing definition of size_t is an indirect effect of getting the wrong time.h header.
Quote:If you think the compiler is trying to drag in the includes for your build machine (vs. the target), go to Project ==> Properties ==> C/C++ General ==> Preprocessor, Include Paths , Macros, etc.. Look at the Providers tab and select and enable the one for the cross compiler (likely the one for the GCC cross compiler). Disable the non-cross compiler builtin providers. You can check them using the Entries tab. The entries on this tab will be searched from top to bottom.
The compiler is not pulling includes for my build machine, it's getting a wrong header from the Arduino "Time" library which is used in the Arduino CDT project.
Quote:However, I don't think it's possible to have GCC (if that's what you are using) search non-builtins first without totally disabling them.
You didn't include the compiler command from the build log that I can see. However, it does appear to be using the esp8266 headers. Maybe you just need to manually specify stddef.h. If you are letting Eclipse build your makefile you can put additional includes on the command line in tool settings. You may also need to clear your INC_PATH environment variable.
The compiler command for compiling the "time.c" module from the ESP8266 C library was included in the build log, I repeat it here:
"C:/Users/stm/.arduinocdt/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\stm\.arduinocdt\packages\esp8266\hardware\esp8266\esp8266\2.0.0/tools/sdk/include" -c -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections -DF_CPU=80000000L -DARDUINO=10607 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266 -I"C:/Users/stm/.arduinocdt/packages/esp8266/hardware/esp8266/esp8266/2.0.0/cores/esp8266" -I"C:/Users/stm/.arduinocdt/packages/esp8266/hardware/esp8266/esp8266/2.0.0/variants/generic" -I"C:/Users/stm/.arduinocdt/libraries/Time/1.5.0" "C:/Users/stm/.arduinocdt/packages/esp8266/hardware/esp8266/esp8266/2.0.0/cores/esp8266/time.c" -o "generic/platform/cores/esp8266/time.c.o"
Note the include path -I"C:/Users/stm/.arduinocdt/libraries/Time/1.5.0", which is added through the inclusion of the Arduino "Time" library in the Arduino CDT project. If I run the above command line from a command window, I can reproduce the error. If I leave out the -I"C:/Users/stm/.arduinocdt/libraries/Time/1.5.0" include path, the module is built successfully.
My current workaround is to copy the files of the Arduino "Time" library into my Arduino CDT project, and to not configure the "Time" library in the Arduino CDT project properties.
|
|
|
|
|
|
|
Re: Arduino CDT Windows for ESP8266: Problem with Time.h/time.h [message #1723629 is a reply to message #1723618] |
Tue, 16 February 2016 21:17 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
Well excuse me for trying. In general, people come here for help and not to place bug reports.. You apparently were doing just that and not asking a question. Many people ask questions tacitly through statements. Maybe they shouldn't but they do.
Odd that someone released a product that restricts to the point of disallowing specification of external libraries including your own. Even more odd is that anyone would want to use it. More of an automated recipe than a developer's tool. But that's me.
Doug is apparently aware of this limitation. https://www.eclipse.org/forums/index.php?t=msg&th=1074310&goto=1721917&#msg_1721917 I wouldn't think it necessary to tell him about the problem (or any others for that matter) more than once and in two places no less.
|
|
|
Powered by
FUDForum. Page generated in 0.03205 seconds