Package: idba
Version: 1.1.1-1
Tags: sid patch
Severity: important
Justification: FTBFS
User: debian-mips-dev-disc...@lists.alioth.debian.org
Usertags: mips-patch
Package idba FTBFS for mips and mipsel, powerpc and sparc with an error:
> g++ -Wall -O3 -fopenmp -pthread -g -O2 -Wformat -Werror=format-security
> -fopenmp -pthread -Wl,-z,relro -o idba_hybrid idba_hybrid.o
> ../lib/libassembly.a
> idba_hybrid.o: In function `AtomicInteger<unsigned long
> long>::operator+=(unsigned long long)':
> /«PKGBUILDDIR»/bin/../src/basic/atomic_integer.h:38: undefined reference to
> `__sync_add_and_fetch_8'
> ../lib/libassembly.a(hash_graph.o): In function `AtomicInteger<unsigned long
> long>::operator+=(unsigned long long)':
> /«PKGBUILDDIR»/lib/../src/basic/atomic_integer.h:38: undefined reference to
> `__sync_add_and_fetch_8'
> collect2: error: ld returned 1 exit status
Mips platform does not have 64-bit __sync_* operations.
To avoid this behaviuor it is needed to use
corresponding __atomic_* from libatomic library.
Patch use-atomic-for-mips.patch contains these changes
of src/basic/atomic_integer.h for mips.
Patch add-libatomic-to-LIBS.patch
adds libatomic in LIBS, and as-needed in LDFLAGS into debian/rules.
I believe that this fix could be used for
sparc and powerpc, but unfortunately I
could not test it so I can not guarantee that.
More info you can find at:
https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/_005f_005fatomic-Builtins.html#_005f_005fatomic-Builtins
https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins
Could you please consider including this patch?
Best regards,
Dejan
diff -uNr idba-1.1.1.orig/bin/Makefile.in idba-1.1.1/bin/Makefile.in
--- idba-1.1.1.orig/bin/Makefile.in 2013-07-23 18:41:33.000000000 +0000
+++ idba-1.1.1/bin/Makefile.in 2014-05-20 17:31:36.000000000 +0000
@@ -283,7 +283,7 @@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
-LIBS = $(top_srcdir)/lib/libassembly.a
+LIBS = $(top_srcdir)/lib/libassembly.a @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
diff -uNr idba-1.1.1.orig/src/basic/atomic_integer.h idba-1.1.1/src/basic/atomic_integer.h
--- idba-1.1.1.orig/src/basic/atomic_integer.h 2013-07-23 18:27:57.000000000 +0000
+++ idba-1.1.1/src/basic/atomic_integer.h 2014-05-20 15:12:28.000000000 +0000
@@ -35,19 +35,40 @@
bool operator ==(const AtomicInteger<T> &x) const { return value_ == x.value_; }
bool operator !=(const AtomicInteger<T> &x) const { return value_ != x.value_; }
- T operator += (T x) { return __sync_add_and_fetch(&value_, x); }
- T operator -= (T x) { return __sync_sub_and_fetch(&value_, x); }
- T operator |= (T x) { return __sync_or_and_fetch(&value_, x); }
- T operator &= (T x) { return __sync_and_and_fetch(&value_, x); }
- T operator ^= (T x) { return __sync_xor_and_fetch(&value_, x); }
-
- T operator ++() { return __sync_add_and_fetch(&value_, 1); }
- T operator ++(int) { return __sync_fetch_and_add(&value_, 1); }
- T operator --() { return __sync_sub_and_fetch(&value_, 1); }
- T operator --(int) { return __sync_fetch_and_sub(&value_, 1); }
- bool CompareAndSet(T old_value, T new_value)
- { return __sync_bool_compare_and_swap(&value_, old_value, new_value); }
+# if defined(__mips__) && !defined(__mips64)
+
+ T operator += (T x) { return __atomic_add_fetch(&value_, x,__ATOMIC_SEQ_CST); }
+ T operator -= (T x) { return __atomic_sub_fetch(&value_, x, __ATOMIC_SEQ_CST); }
+ T operator |= (T x) { return __atomic_or_fetch(&value_, x, __ATOMIC_SEQ_CST); }
+ T operator &= (T x) { return __atomic_and_fetch(&value_, x, __ATOMIC_SEQ_CST); }
+ T operator ^= (T x) { return __atomic_xor_fetch(&value_, x, __ATOMIC_SEQ_CST); }
+
+ T operator ++() { return __atomic_add_fetch(&value_, 1, __ATOMIC_SEQ_CST); }
+ T operator ++(int) { return __atomic_fetch_add(&value_, 1, __ATOMIC_SEQ_CST); }
+ T operator --() { return __atomic_sub_fetch(&value_, 1, __ATOMIC_SEQ_CST); }
+ T operator --(int) { return __atomic_fetch_sub(&value_, 1, __ATOMIC_SEQ_CST); }
+
+ bool CompareAndSet(T old_value, T new_value)
+ { return __atomic_compare_exchange(&value_, &old_value, &new_value, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+
+# else
+
+ T operator += (T x) { return __sync_add_and_fetch(&value_, x); }
+ T operator -= (T x) { return __sync_sub_and_fetch(&value_, x); }
+ T operator |= (T x) { return __sync_or_and_fetch(&value_, x); }
+ T operator &= (T x) { return __sync_and_and_fetch(&value_, x); }
+ T operator ^= (T x) { return __sync_xor_and_fetch(&value_, x); }
+
+ T operator ++() { return __sync_add_and_fetch(&value_, 1); }
+ T operator ++(int) { return __sync_fetch_and_add(&value_, 1); }
+ T operator --() { return __sync_sub_and_fetch(&value_, 1); }
+ T operator --(int) { return __sync_fetch_and_sub(&value_, 1); }
+
+ bool CompareAndSet(T old_value, T new_value)
+ { return __sync_bool_compare_and_swap(&value_, old_value, new_value); }
+
+# endif
void swap(AtomicInteger &x)
{ if (this != &x) std::swap(value_, x.value_); }
--- idba-1.1.1.orig/debian/rules 2014-02-13 14:08:07.000000000 +0000
+++ idba-1.1.1/debian/rules 2014-05-20 17:13:03.000000000 +0000
@@ -7,6 +7,9 @@
%:
dh $@
+override_dh_auto_configure:
+ dh_auto_configure -- LDFLAGS="$(LDFLAGS) -Wl,--as-needed" LIBS="$(LIBS) -latomic"
+
override_dh_install:
dh_install
# for the moment the role of these scripts is totally unknown but they do not seem to be necessary