[CDRIVER-1456] Debian package-build failure on MIPS (bson_atomic_int64_add) Created: 07/Aug/16  Updated: 17/Apr/17  Resolved: 13/Aug/16

Status: Closed
Project: C Driver
Component/s: Build, libbson, packaging
Affects Version/s: 1.3.2
Fix Version/s: 1.4.0

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-2127 libbson FTBFS on mips/mipsel: undefin... Closed
related to CDRIVER-1468 Try to use libatomic if GCC atomics n... Closed

 Description   

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.


Generated at Wed Feb 07 21:12:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.