From 7f6801cb1e3930a94f201acda7cfdcbe3de1ce27 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 27 Oct 2021 09:28:09 +0200 Subject: [PATCH] ue_sync: fix 32bit compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix printf format string on 32bit arches like ARMv7 FAILED: lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o /usr/bin/gcc -DASSERTS_ENABLED -DENABLE_TIMEPROF -DENABLE_TTCN3 -DHAVE_BACKWARD -DHAVE_MBEDTLS -DHAVE_PCSC -I/usr/include/PCSC -I/usr/include/SoapySDR -Ilib/include -I../lib/include -Wno-unused-but-set-variable -Wall -Wno-comment -Wno-write-strings -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -fno-strict-aliasing -D_GNU_SOURCE -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE -DIS_ARM -DHAVE_NEON -mfloat-abi=hard -mfpu=neon -fvisibility=hidden -fdiagnostics-color=always -Werror --param large-function-growth=1600 -O3 -DNDEBUG -fPIC -MD -MT lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o -MF lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o.d -o lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o -c ../lib/src/phy/ue/ue_sync.c In file included from ../lib/include/srsran/srsran.h:31, from ../lib/src/phy/ue/ue_sync.c:13: ../lib/src/phy/ue/ue_sync.c: In function ‘srsran_ue_sync_set_tti_from_timestamp’: ../lib/include/srsran/phy/utils/debug.h:59:23: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=] fprintf(stdout, "[DEBUG]: " _fmt "\n", ##__VA_ARGS__); \ ^~~~~~~~~~~ ../lib/src/phy/ue/ue_sync.c:1044:3: note: in expansion of macro ‘DEBUG’ DEBUG("rx time with 3gpp base in ms %lu\n", time_3gpp_msecs); ^~~~~ ../lib/src/phy/ue/ue_sync.c:1044:41: note: format string is defined here DEBUG("rx time with 3gpp base in ms %lu\n", time_3gpp_msecs); ~~^ %llu cc1: all warnings being treated as errors --- lib/src/phy/ue/ue_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/phy/ue/ue_sync.c b/lib/src/phy/ue/ue_sync.c index 020be7fa1..cd5e38fe2 100644 --- a/lib/src/phy/ue/ue_sync.c +++ b/lib/src/phy/ue/ue_sync.c @@ -1041,7 +1041,7 @@ int srsran_ue_sync_set_tti_from_timestamp(srsran_ue_sync_t* q, srsran_timestamp_ // convert to ms and add fractional part uint64_t time_3gpp_msecs = (time_3gpp_secs + rx_timestamp->frac_secs) * MSECS_PER_SEC; - DEBUG("rx time with 3gpp base in ms %lu\n", time_3gpp_msecs); + DEBUG("rx time with 3gpp base in ms %" PRIu64 "\n", time_3gpp_msecs); // calculate SFN and SF index according to TS 36.331 Sec. 5.10.14 q->frame_number = (uint32_t)(((uint64_t)floor(0.1 * (time_3gpp_msecs - q->sfn_offset))) % 1024);