Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failures due to 64-bit time_t on 32-bit systems (seen on Ubuntu 24.04 32bit) #15881

Open
mwinter-osr opened this issue Apr 30, 2024 · 2 comments

Comments

@mwinter-osr
Copy link
Member

mwinter-osr commented Apr 30, 2024

FRR master @ 65c2593 (and most likely earlier versions)

Compiling fails with some errors:

In file included from lib/log.h:17,
                 from lib/vty.h:22,
                 from lib/command.h:11,
                 from lib/debug.h:11,
                 from lib/northbound_oper.c:13:
lib/northbound_oper.c: In function 'nb_op_yield':
./lib/zlog.h:109:34: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type '__suseconds64_t' {aka 'long long int'} [-Werror=format=]
  109 |                 zlog_ref(&_xref, (msg), ##__VA_ARGS__);                        \
      |                                  ^~~~~
./lib/zlog.h:116:26: note: in expansion of macro '_zlog_ecref'
  116 | #define zlog_debug(...)  _zlog_ecref(0, LOG_DEBUG, __VA_ARGS__)
      |                          ^~~~~~~~~~~
lib/debug.h:210:25: note: in expansion of macro 'zlog_debug'
  210 |                         zlog_##level(fmt, ##__VA_ARGS__);                      \
      |                         ^~~~~
lib/debug.h:218:32: note: in expansion of macro 'DEBUG'
  218 | #define DEBUGD(name, fmt, ...) DEBUG(debug, name, fmt, ##__VA_ARGS__)
      |                                ^~~~~
lib/northbound_oper.c:1559:9: note: in expansion of macro 'DEBUGD'
 1559 |         DEBUGD(&nb_dbg_events, "NB oper-state: yielding %s for %lus (should_batch %d)",
      |         ^~~~~~

and

bgpd/rfapi/rfapi_rib.c: In function ‘rfapiRibFTDFilterRecentPrefix’:
bgpd/rfapi/rfapi_rib.c:1797:23: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
 1797 |         prefix_time = (time_t)trn->info;
      |   
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10730: bgpd/rfapi/rfapi_rib.o] Error 1

Configure used:

./configure --enable-vtysh --enable-isisd --enable-ospfclient=yes --enable-ospfapi=yes --enable-multipath=0 \
--enable-rtadv --enable-user=root --enable-sharpd --enable-rpki --enable-fpm --enable-scripting --enable-pimd \
--enable-pim6d --enable-bfdd --enable-vrrpd --enable-werror --with-pkg-extra-version=-20240429-git.65c2593 \
--enable-watchfrr --prefix=/home/ci/cibuild.7624/frr-source/usr_local

Full compile log can be seen at https://ci1.netdef.org/download/FRR-FRR-U2404ARM7/build_logs/FRR-FRR-U2404ARM7-7624.log

@eqvinox eqvinox changed the title FRR build issue on latest Ubuntu 24.04 32 bit systems (seen on armhf arch) build failures due to 64-bit time_t on 32-bit systems (seen on Ubuntu 24.04 32bit) Apr 30, 2024
@eqvinox
Copy link
Contributor

eqvinox commented Apr 30, 2024

All of these are due to Debian/Ubuntu changing time_t from 32bit to 64bit on all platforms. This means two things:

  • time_t cannot be stored in a pointer, because it is larger than that
  • atomic operations on time_t need libatomic because several 32bit platforms do not support 64bit atomic ops in the CPU
  • time_t can never be printed directly with printf, because there is no format specifier for it. Both %ld and %lld are wrong. We could define a PRItime_t (like PRIu64) but honestly casting to (long long) and using %lld is simpler.

@eqvinox
Copy link
Contributor

eqvinox commented Apr 30, 2024

  • atomic operations on time_t need libatomic because several 32bit platforms do not support 64bit atomic ops in the CPU

NB: this also means these operations will be slow as f*ck because they're emulated with a global lock for all atomic ops across the entire process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants