Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Arduino CDT Windows for ESP8266: Problem with Time.h/time.h
Arduino CDT Windows for ESP8266: Problem with Time.h/time.h [message #1723298] Sat, 13 February 2016 18:12 Go to next message
Stephan Muehlstrasser is currently offline Stephan MuehlstrasserFriend
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 #1723307 is a reply to message #1723298] Sun, 14 February 2016 02:00 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Well, the compiler is complaining about the missing definition of the type size_t which is generally found in stddef.h

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.

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.
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 Go to previous messageGo to next message
Stephan Muehlstrasser is currently offline Stephan MuehlstrasserFriend
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:00
Well, 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 #1723339 is a reply to message #1723324] Sun, 14 February 2016 17:53 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You can verify that with a couple of gcc commands which will list the full path for includes. Of course you should use the proper gcc version.

This will give make dependencies which list absolute paths of include files but not the full program text. Not sure if they are listed in search order
gcc -M XXX.c ...
If you don't want the system includes (i.e. #include <something.h>), although in this case I think you do, then use
gcc -MM XXX.c ...

also
gcc -H ...

The following gives the program after preprocessing
gcc -E -dI ...

You can go here https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options for more information

Have you tried adding -I<path to time.h> before the
-I"C:/Users/stm/.arduinocdt/libraries/Time/1.5.0"?

You at least have a work around if all else fails.
Re: Arduino CDT Windows for ESP8266: Problem with Time.h/time.h [message #1723474 is a reply to message #1723339] Mon, 15 February 2016 21:12 Go to previous messageGo to next message
Stephan Muehlstrasser is currently offline Stephan MuehlstrasserFriend
Messages: 33
Registered: July 2009
Member
David Vavra wrote on Sun, 14 February 2016 12:53
You can verify that with a couple of gcc commands which will list the full path for includes. Of course you should use the proper gcc version.

This will give make dependencies which list absolute paths of include files but not the full program text. Not sure if they are listed in search order
gcc -M XXX.c ...
If you don't want the system includes (i.e. #include <something.h>), although in this case I think you do, then use
gcc -MM XXX.c ...

also
gcc -H ...

The following gives the program after preprocessing
gcc -E -dI ...

You can go here https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options for more information

Have you tried adding -I<path to time.h> before the
-I"C:/Users/stm/.arduinocdt/libraries/Time/1.5.0"?

You at least have a work around if all else fails.


It's not possible in a Arduino CDT project to tweak the include paths, at least not that I'm aware of it (there's no "C/C++ Build" section in the project properties). The Arduino CDT plugin manages all the include paths.
Re: Arduino CDT Windows for ESP8266: Problem with Time.h/time.h [message #1723605 is a reply to message #1723474] Tue, 16 February 2016 18:03 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You seem to be saying there is no fix possible other than your work around. Wouldn't this be better posted in a bug report somewhere?
Like here https://bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT
select: cdt-arduino as the component.

[Updated on: Tue, 16 February 2016 18:21]

Report message to a moderator

Re: Arduino CDT Windows for ESP8266: Problem with Time.h/time.h [message #1723618 is a reply to message #1723605] Tue, 16 February 2016 19:51 Go to previous messageGo to next message
Stephan Muehlstrasser is currently offline Stephan MuehlstrasserFriend
Messages: 33
Registered: July 2009
Member
David Vavra wrote on Tue, 16 February 2016 13:03
You seem to be saying there is no fix possible other than your work around. Wouldn't this be better posted in a bug report somewhere?
Like here https://bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT
select: cdt-arduino as the component.


I'm posting here because Doug Schaefer asked for feedback about the Arduino plugin in the forum. But sure, at the end of the day I'll file a bug report...
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 Go to previous message
David VavraFriend
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.



Previous Topic:Dynamic link
Next Topic:No rule to make target 'all'. Stop.
Goto Forum:
  


Current Time: Fri Apr 26 17:34:01 GMT 2024

Powered by FUDForum. Page generated in 0.03205 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top