thom311 / libnl

Netlink Library Suite
GNU Lesser General Public License v2.1
419 stars 311 forks source link

error: storage size of 'tm_buf' isn't known due to missing #include <time.h> #370

Closed OlekMazur closed 8 months ago

OlekMazur commented 8 months ago

Compilation error:

  CC       lib/xfrm/libnl_xfrm_3_la-ae.lo
lib/xfrm/ae.c: In function 'xfrm_ae_dump_line':
lib/xfrm/ae.c:340:29: error: storage size of 'tm_buf' isn't known
  340 |         struct tm           tm_buf;
      |                             ^~~~~~
lib/xfrm/ae.c:360:31: warning: implicit declaration of function 'gmtime_r' [-Wimplicit-function-declaration]
  360 |                 add_time_tm = gmtime_r (&add_time, &tm_buf);
      |                               ^~~~~~~~
lib/xfrm/ae.c:361:17: warning: implicit declaration of function 'strftime' [-Wimplicit-function-declaration]
  361 |                 strftime (flags, 128, "%Y-%m-%d %H-%M-%S", add_time_tm);
      |                 ^~~~~~~~
lib/xfrm/ae.c:138:1: note: include '<time.h>' or provide a declaration of 'strftime'
  137 | #include "nl-aux-xfrm/nl-xfrm.h"
  +++ |+#include <time.h>
  138 | 
lib/xfrm/ae.c:361:17: warning: incompatible implicit declaration of built-in function 'strftime' [-Wbuiltin-declaration-mismatch]
  361 |                 strftime (flags, 128, "%Y-%m-%d %H-%M-%S", add_time_tm);
      |                 ^~~~~~~~
lib/xfrm/ae.c:361:17: note: include '<time.h>' or provide a declaration of 'strftime'
lib/xfrm/ae.c:372:17: warning: incompatible implicit declaration of built-in function 'strftime' [-Wbuiltin-declaration-mismatch]
  372 |                 strftime (buf, 128, "%Y-%m-%d %H-%M-%S", use_time_tm);
      |                 ^~~~~~~~
lib/xfrm/ae.c:372:17: note: include '<time.h>' or provide a declaration of 'strftime'
lib/xfrm/ae.c:340:29: warning: unused variable 'tm_buf' [-Wunused-variable]
  340 |         struct tm           tm_buf;
      |                             ^~~~~~
make: *** [Makefile:5209: lib/xfrm/libnl_xfrm_3_la-ae.lo] Błąd 1
Command exited with non-zero status 2
0.14user 0.04system 0:00.24elapsed 79%CPU (0avgtext+0avgdata 25728maxresident)k
40472inputs+40outputs (226major+9158minor)pagefaults 0swaps

olek@mocarz:~/projekty/videorejestrator/intermediate/packages/libnl-3.9.0$ PATH=/usr/local/cross/bin:$PATH time make -k
  CC       lib/xfrm/libnl_xfrm_3_la-ae.lo
lib/xfrm/ae.c: In function 'xfrm_ae_dump_line':
lib/xfrm/ae.c:340:29: error: storage size of 'tm_buf' isn't known
  340 |         struct tm           tm_buf;
      |                             ^~~~~~
lib/xfrm/ae.c:360:31: warning: implicit declaration of function 'gmtime_r' [-Wimplicit-function-declaration]
  360 |                 add_time_tm = gmtime_r (&add_time, &tm_buf);
      |                               ^~~~~~~~
lib/xfrm/ae.c:361:17: warning: implicit declaration of function 'strftime' [-Wimplicit-function-declaration]
  361 |                 strftime (flags, 128, "%Y-%m-%d %H-%M-%S", add_time_tm);
      |                 ^~~~~~~~
lib/xfrm/ae.c:138:1: note: include '<time.h>' or provide a declaration of 'strftime'
  137 | #include "nl-aux-xfrm/nl-xfrm.h"
  +++ |+#include <time.h>
  138 | 
lib/xfrm/ae.c:361:17: warning: incompatible implicit declaration of built-in function 'strftime' [-Wbuiltin-declaration-mismatch]
  361 |                 strftime (flags, 128, "%Y-%m-%d %H-%M-%S", add_time_tm);
      |                 ^~~~~~~~
lib/xfrm/ae.c:361:17: note: include '<time.h>' or provide a declaration of 'strftime'
lib/xfrm/ae.c:372:17: warning: incompatible implicit declaration of built-in function 'strftime' [-Wbuiltin-declaration-mismatch]
  372 |                 strftime (buf, 128, "%Y-%m-%d %H-%M-%S", use_time_tm);
      |                 ^~~~~~~~
lib/xfrm/ae.c:372:17: note: include '<time.h>' or provide a declaration of 'strftime'
lib/xfrm/ae.c:340:29: warning: unused variable 'tm_buf' [-Wunused-variable]
  340 |         struct tm           tm_buf;
      |                             ^~~~~~
make: *** [Makefile:5209: lib/xfrm/libnl_xfrm_3_la-ae.lo] Błąd 1
  CC       lib/xfrm/libnl_xfrm_3_la-sp.lo
lib/xfrm/sp.c: In function 'xfrm_sp_dump_line':
lib/xfrm/sp.c:362:29: error: storage size of 'tm_buf' isn't known
  362 |         struct tm           tm_buf;
      |                             ^~~~~~
lib/xfrm/sp.c:423:31: warning: implicit declaration of function 'gmtime_r' [-Wimplicit-function-declaration]
  423 |                 add_time_tm = gmtime_r (&add_time, &tm_buf);
      |                               ^~~~~~~~
lib/xfrm/sp.c:424:17: warning: implicit declaration of function 'strftime' [-Wimplicit-function-declaration]
  424 |                 strftime (dst, INET6_ADDRSTRLEN+5, "%Y-%m-%d %H-%M-%S", add_time_tm);
      |                 ^~~~~~~~
lib/xfrm/sp.c:58:1: note: include '<time.h>' or provide a declaration of 'strftime'
   57 | #include "nl-aux-xfrm/nl-xfrm.h"
  +++ |+#include <time.h>
   58 | 
lib/xfrm/sp.c:424:17: warning: incompatible implicit declaration of built-in function 'strftime' [-Wbuiltin-declaration-mismatch]
  424 |                 strftime (dst, INET6_ADDRSTRLEN+5, "%Y-%m-%d %H-%M-%S", add_time_tm);
      |                 ^~~~~~~~
lib/xfrm/sp.c:424:17: note: include '<time.h>' or provide a declaration of 'strftime'
lib/xfrm/sp.c:435:17: warning: incompatible implicit declaration of built-in function 'strftime' [-Wbuiltin-declaration-mismatch]
  435 |                 strftime (src, INET6_ADDRSTRLEN+5, "%Y-%m-%d %H-%M-%S", use_time_tm);
      |                 ^~~~~~~~
lib/xfrm/sp.c:435:17: note: include '<time.h>' or provide a declaration of 'strftime'
lib/xfrm/sp.c:362:29: warning: unused variable 'tm_buf' [-Wunused-variable]
  362 |         struct tm           tm_buf;
      |                             ^~~~~~
make: *** [Makefile:5237: lib/xfrm/libnl_xfrm_3_la-sp.lo] Błąd 1
make: Obiekt 'all' nie został ponownie wykonany z powodu błędów.
Command exited with non-zero status 2

From config.log:

It was created by libnl configure 3.9.0, which was
generated by GNU Autoconf 2.71.  Invocation command line was
  $ ./configure --host=i686-buildroot-linux-uclibc --prefix=/usr --enable-silent-rules --disable-static --enable-shared --disable-debug --disable-pthreads --enable-cli=no

cross-compiling with i686-linux-gcc.br_real (Buildroot 2022.05-1002-g1500b7d5c8) 12.1.0, uClibc-ng-1.0.45

thom311 commented 8 months ago

fixed by https://github.com/thom311/libnl/pull/371. Thank you.