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

Debian package-build failure on MIPS (bson_atomic_int64_add)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0
    • Affects Version/s: 1.3.2
    • Component/s: Build, libbson, packaging
    • None

      See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832747

      Building on MIPS, libbson's Autotools build system detects that the GCC atomic __sync_add_and_fetch_8 isn't available so it compiles its own backfill function bson_atomic_int64_add, which then appears in the symbol table and breaks the build:

      >  dpkg-gensymbols: warning: some new symbols appeared in the symbols file: see diff output below
      >  dpkg-gensymbols: warning: debian/libbson-1.0-0/DEBIAN/symbols doesn't match completely debian/libbson-1.0-0.symbols
      >  --- debian/libbson-1.0-0.symbols (libbson-1.0-0_1.3.5-1_mipsel)
      >  +++ dpkg-gensymbolsWR4fxq    2016-05-17 18:25:54.650806227 +0000
      >  @@ -43,6 +43,7 @@
      >    bson_array_as_json@LIBBSON_1.0 1.2.1
      >    bson_as_json@LIBBSON_1.0 1.2.1
      >    bson_ascii_strtoll@LIBBSON_1.0 1.2.1
      >  + bson_atomic_int64_add@LIBBSON_1.0 1.3.5-1
      >    bson_bcon_magic@LIBBSON_1.0 1.2.1
      >    bson_bcone_magic@LIBBSON_1.0 1.2.1
      >    bson_check_version@LIBBSON_1.2 1.2.1
      
      The problem is in bson-atomic.h file, where bson_atomic_int64_add is defined.
      
      >  define bson_atomic_int64_add(p, v) __sync_add_and_fetch((volatile int64_t*)(p), (int64_t)(v))
      
      Mips platform does not have 64-bit __sync_* operations.
      To avoid this behaviour it is needed to use
      corresponding __atomic_* from libatomic library.
      
      Patch use-atomic-instead-sync.patch contains these changes
      of src/bson/bson-atomic.h and build/autotools/CheckAtomics.m4.
      
      The patch is tested on mips, mipsel, mips64el, amd64 and i386.
      With this patch, package builds successfully.
      
      Regards,
      Radovan
      

      The Debian developer who reported this has offered a patch. We'll add it to our patch stack in the "debian" branch of libbson and re-upload to Debian along with libbson 1.4.0.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: