libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
382 stars 55 forks source link

use extern "C" for sys_now() to fix compile/linking errors #286

Open shilga opened 1 month ago

shilga commented 1 month ago

fixes compiling/linking errors in esphome. I was using esphome 2024.5.4

kuba2k2 commented 1 month ago

Can you show where the linking error is and what component uses the sys_now? I don't remember having such an issue in ESPHome.

shilga commented 1 month ago

sure

Compiling .pioenvs/klarstein-kraftwerk/libc11/AsyncTCP-esphome/AsyncTCP.cpp.o
Compiling .pioenvs/klarstein-kraftwerk/libf53/ESPAsyncWebServer-esphome/AsyncEventSource.cpp.o
In file included from /data/cache/platformio/packages/library-lwip/src/include/lwip/timeouts.h:44,
                 from /data/cache/platformio/packages/library-lwip/src/include/lwip/tcpip.h:45,
                 from /data/cache/platformio/packages/library-lwip/src/include/lwip/priv/tcpip_priv.h:44,
                 from .piolibdeps/klarstein-kraftwerk/AsyncTCP-esphome/src/AsyncTCP.cpp:369:
/data/cache/platformio/packages/library-lwip/src/include/lwip/sys.h:447:7: error: conflicting declaration of 'u32_t sys_now()' with 'C' linkage
  447 | u32_t sys_now(void);
      |       ^~~~~~~
In file included from /data/cache/platformio/packages/library-lwip/src/include/lwip/opt.h:51,
                 from /data/cache/platformio/packages/library-lwip/src/include/lwip/ip_addr.h:40,
                 from .piolibdeps/klarstein-kraftwerk/AsyncTCP-esphome/src/AsyncTCP.h:28,
                 from .piolibdeps/klarstein-kraftwerk/AsyncTCP-esphome/src/AsyncTCP.cpp:24:
/data/cache/platformio/platforms/libretiny@src-91da51c6060519855d39a90bec721fde/cores/realtek-ambz2/base/config/lwipopts.h:10:22: note: previous declaration with 'C++' linkage
   10 | extern unsigned long sys_now(void);
      |                      ^~~~~~~
*** [.pioenvs/klarstein-kraftwerk/libc11/AsyncTCP-esphome/AsyncTCP.cpp.o] Error 1

See also full log in attachment logs_klarstein-kraftwerk_compile.txt