cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.2k stars 472 forks source link

FTBFS on x32 architecture #566

Closed bigon closed 2 years ago

bigon commented 2 years ago

Hello,

On x32, libsrtp currently the code FTBFS with the following error:

gcc -DHAVE_CONFIG_H -Icrypto/include -I./include -I./crypto/include -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -O4 -fexpensive-optimizations -funroll-loops -fPIC -I/usr/include/nss -I/usr/include/nspr -L. -Wl,-z,relro -o test/rtp_decoder test/rtp_decoder.c test/rtp.c test/util.c test/getopt_s.c crypto/math/datatypes.c libsrtp2.a -lpcap -lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4  -lsrtp2
test/rtp_decoder.c: In function ‘rtp_decoder_handle_pkt’:
test/rtp_decoder.c:767:26: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘__time_t’ {aka ‘long long int’} [-Wformat=]
  767 |     fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60,
      |                      ~~~~^                 ~~~~~~~~~~~~~~~~~
      |                          |                              |
      |                          long int                       __time_t {aka long long int}
      |                      %02lld
test/rtp_decoder.c:767:32: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘__time_t’ {aka ‘long long int’} [-Wformat=]
  767 |     fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60,
      |                            ~~~~^                              ~~~~~~~~~~~~~~~~~
      |                                |                                           |
      |                                long int                                    __time_t {aka long long int}
      |                            %02lld

Full log: https://buildd.debian.org/status/fetch.php?pkg=libsrtp2&arch=x32&ver=2.4.1-1&stamp=1631572353&raw=0

pabuhler commented 2 years ago

Hi, thanks for the report, do you have a patch ? If not then I will try to fix this. By the way this is a kind of test tool and not part of the library, are you sure you want to be building it ?

bigon commented 2 years ago

Hello,

No I don't have a patch ATM for this

The tool seems to be built by default and run in the test suite, so that's why it's built as part of the debian pkg buildprocess

bigon commented 2 years ago

Note that in this debian bug, the following fix if proposed:

-     fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60,
+     fprintf(stdout, "%02ld:%02d.%06ld\n", (long)(delta.tv_sec / 60), (int)(delta.tv_sec % 60),
pabuhler commented 2 years ago

@bigon , I have made a PR based on that link. Would be great if you can confirm this works and then we can see what others think.