Bug#765285: Problem building mapsembler2 on several architectures: xmmintrin.h: No such file or directory

2014-10-25 Thread Andreas Tille
Hi,

even the new version of mapsembler2 fails on some architectures:

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::BagHDF5gatb::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'
| ../lib/libgatbcore.a(BranchingAlgorithm.cpp.o): In function 
`gatb::core::tools::storage::impl::BagHDF5gatb::core::kmer::impl::Kmer64u::Count::insert(gatb::core::kmer::impl::Kmer64u::Count
 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'
| ../lib/libgatbcore.a(BranchingAlgorithm.cpp.o): In function 
`gatb::core::tools::storage::impl::BagHDF5gatb::core::kmer::impl::Kmer96u::Count::insert(gatb::core::kmer::impl::Kmer96u::Count
 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'
| ../lib/libgatbcore.a(BranchingAlgorithm.cpp.o): In function 
`gatb::core::tools::storage::impl::BagHDF5gatb::core::kmer::impl::Kmer128u::Count::insert(gatb::core::kmer::impl::Kmer128u::Count
 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'
| ../lib/libgatbcore.a(BranchingAlgorithm.cpp.o): In function 
`gatb::core::tools::storage::impl::BagHDF5gatb::core::kmer::impl::Kmer32u::Count::insert(gatb::core::kmer::impl::Kmer32u::Count
 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'
| 
../lib/libgatbcore.a(DebloomAlgorithm.cpp.o):/«BUILDDIR»/mapsembler2-2.2.3+dfsg/mapsembler2_extremities/thirdparty/gatb-core/src/gatb/tools/storage/impl/CollectionHDF5.hpp:102:
 more undefined references to `__sync_fetch_and_add_8' follow
| collect2: error: ld returned 1 exit status


Can anybody give some hint or should we remove mapsembler2 from these
architectures to fix the problem?

Kind regards

  Andreas.

-- 
http://fam-tille.de


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#765285: Problem building mapsembler2 on several architectures: xmmintrin.h: No such file or directory

2014-10-25 Thread Jakub Wilk

* 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::BagHDF5gatb::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.0 +0100
+++ mapsembler2-2.2.3+dfsg/debian/patches/atomics	2014-10-25 22:25:42.0 +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 @@
+ 
+ templatesize_t span
+ PartitionsCommandspan::~PartitionsCommand()  {
+-__sync_fetch_and_add (_totalKmerNbRef, _totalKmerNb);
++__atomic_fetch_add (_totalKmerNbRef, _totalKmerNb, __ATOMIC_SEQ_CST);
+ };
+ 
+ templatesize_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.0 +0200
+++ mapsembler2-2.2.3+dfsg/debian/patches/series	2014-10-25 22:25:09.0 +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.0 +0200
+++ mapsembler2-2.2.3+dfsg/debian/rules	2014-10-25 22:24:44.0 +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)