Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-5493

Compilation failure on 32-bit platforms with 64-bit time_t

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.27.0, 1.26.1
    • Affects Version/s: None
    • Component/s: Logging
    • None
    • C Drivers

      The recent 64-bit time_t transition revealed that the C driver fails to compile on 32-bit architectures when time_t is 64-bits:

      cd /<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/libmongoc && /usr/bin/cc -DBSON_STATIC -DHAVE_STDARG_H -DHAVE_UNISTD_H -DKMS_MESSAGE_ENABLE_CRYPTO -DKMS_MESSAGE_ENABLE_CRYPTO_LIBCRYPTO -DKMS_MESSAGE_LITTLE_ENDIAN -DKMS_MSG_STATIC -DMCOMMON_NAME_PREFIX=_mongoc_mcommon -DMONGOC_COMPILATION -DMONGOC_STATIC -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -I/<<PKGBUILDDIR>>/src/libmongoc/../kms-message/src -I/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/libmongoc/src -I/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/libmongoc/src/mongoc -I/<<PKGBUILDDIR>>/src/libmongoc/src -I/<<PKGBUILDDIR>>/src/libmongoc/src/mongoc -I/<<PKGBUILDDIR>>/src/libmongoc/../../src/common -I/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/libmongoc/../../src -I/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/libmongoc/../../src/common -I/<<PKGBUILDDIR>>/src/libbson/src -I/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/libbson/src -I/<<PKGBUILDDIR>>/src/common -I/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/common -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=2 -std=c99 -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=discarded-qualifiers -Werror=uninitialized -Werror -pedantic -Wall -Wempty-body -Wexpansion-to-defined -Wformat -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-include-dirs -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wuninitialized -Wno-strict-aliasing -fPIC -DUTF8PROC_EXPORTS -MD -MT src/libmongoc/CMakeFiles/mongoc_static.dir/src/mongoc/mongoc-error.c.o -MF CMakeFiles/mongoc_static.dir/src/mongoc/mongoc-error.c.o.d -o CMakeFiles/mongoc_static.dir/src/mongoc/mongoc-error.c.o -c /<<PKGBUILDDIR>>/src/libmongoc/src/mongoc/mongoc-error.c
      /<<PKGBUILDDIR>>/src/libmongoc/src/mongoc/mongoc-log.c: In function ‘mongoc_log_default_handler’:
      /<<PKGBUILDDIR>>/src/libmongoc/src/mongoc/mongoc-log.c:215:21: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘__suseconds64_t’ {aka ‘long long int’} [-Werror=format=]
        215 |             "%s.%04ld: [%5d]: %8s: %12s: %s\n",
            |                 ~~~~^
            |                     |
            |                     long int
            |                 %04lld
        216 |             nowstr,
        217 |             tv.tv_usec / 1000L,
            |             ~~~~~~~~~~~~~~~~~~
            |                        |
            |                        __suseconds64_t {aka long long int}
      cc1: all warnings being treated as errors
      

      Complete build log here.

            Assignee:
            roberto.sanchez@mongodb.com Roberto Sanchez
            Reporter:
            roberto.sanchez@mongodb.com Roberto Sanchez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: