libretiny icon indicating copy to clipboard operation
libretiny copied to clipboard

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

Open shilga opened this issue 1 year ago • 2 comments

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

shilga avatar Jun 02 '24 14:06 shilga

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.

kuba2k2 avatar Jun 02 '24 18:06 kuba2k2

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

shilga avatar Jun 02 '24 20:06 shilga

@kuba2k2 Could you please merge this into master?

prokoma avatar Dec 17 '24 07:12 prokoma

This PR was closed already so I cherry-picked the commit and pushed it to master now.

kuba2k2 avatar Dec 17 '24 10:12 kuba2k2