* Andreas Tille <andr...@an3as.eu>, 2014-10-25, 20:01:
Unfortunately it still fails on mips, mipsel and powerpc with | [ 97%] Building CXX object ext/gatb-core/tools/CMakeFiles/dbgh5.dir/dbgh5.cpp.o | Linking CXX executable ../bin/dbgh5 | ../lib/libgatbcore.a(Storage.cpp.o): In function `gatb::core::tools::storage::impl::BagHDF5<gatb::core::tools::math::NativeInt8>::insert(gatb::core::tools::math::NativeInt8 const*, unsigned int)': | /«BUILDDIR»/mapsembler2-2.2.3+dfsg/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp:102: undefined reference to `__sync_fetch_and_add_8'
IANA atomics expert, but GCC documentation describes the __sync_*[0] built-in functions as "legacy", and I hypothesize that the __atomic_*[1] built-in functions are more widely available. The attached patch let me build mapsembler2 on powerpc, although probably all the other __sync_* calls should be replaced by __atomic_*. I didn't test if the package still works after these changes.
[0] https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fsync-Builtins.html [1] https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fatomic-Builtins.html -- Jakub Wilk
diff -Nru mapsembler2-2.2.3+dfsg/debian/patches/atomics mapsembler2-2.2.3+dfsg/debian/patches/atomics --- mapsembler2-2.2.3+dfsg/debian/patches/atomics 1970-01-01 01:00:00.000000000 +0100 +++ mapsembler2-2.2.3+dfsg/debian/patches/atomics 2014-10-25 22:25:42.000000000 +0200 @@ -0,0 +1,22 @@ +--- a/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp ++++ b/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp +@@ -99,7 +99,7 @@ + /** We increase the number of inserted items. */ + _nbInserted += length; + +- __sync_fetch_and_add (&_nbItems, length); ++ __atomic_fetch_add (&_nbItems, length, __ATOMIC_SEQ_CST); + + /** Close resources. */ + status = H5Sclose (filespaceId); +--- a/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/kmer/impl/PartitionsCommand.cpp ++++ b/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/kmer/impl/PartitionsCommand.cpp +@@ -50,7 +50,7 @@ + + template<size_t span> + PartitionsCommand<span>::~PartitionsCommand() { +- __sync_fetch_and_add (&_totalKmerNbRef, _totalKmerNb); ++ __atomic_fetch_add (&_totalKmerNbRef, _totalKmerNb, __ATOMIC_SEQ_CST); + }; + + template<size_t span> diff -Nru mapsembler2-2.2.3+dfsg/debian/patches/series mapsembler2-2.2.3+dfsg/debian/patches/series --- mapsembler2-2.2.3+dfsg/debian/patches/series 2014-10-15 07:39:58.000000000 +0200 +++ mapsembler2-2.2.3+dfsg/debian/patches/series 2014-10-25 22:25:09.000000000 +0200 @@ -2,3 +2,4 @@ run_pipeline add_hardening skip_mphe +atomics diff -Nru mapsembler2-2.2.3+dfsg/debian/rules mapsembler2-2.2.3+dfsg/debian/rules --- mapsembler2-2.2.3+dfsg/debian/rules 2014-10-15 07:27:33.000000000 +0200 +++ mapsembler2-2.2.3+dfsg/debian/rules 2014-10-25 22:24:44.000000000 +0200 @@ -11,6 +11,7 @@ export DEB_CPPFLAGS_MAINT_APPEND := -I/usr/include/hdf5/serial export DEB_LDFLAGS_MAINT_APPEND := -Wl,-L/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial endif +DEB_LDFLAGS_MAINT_APPEND += -latomic CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)