Re: hdf5 error with cmake on a few platforms (including mips)

James Cowgill <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>
(I thought I sent this before but I think my mail client messed it up -
sorry if you receive it twice)

On Thu, 16 Oct 2014 12:54:16 +0200 Olivier Sallou wrote:
> I have FTBS errors with hdf5 using cmake on a few platforms (mips,
> powerpc, sparc).
> 
> The error is:
> 
> CMake Warning (dev) at thirdparty/gatb-core/CMakeLists.txt:201 (ADD_DEPENDENCIES):
>   Policy CMP0046 is not set: Error on non-existent dependency in
>   add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
>   Use the cmake_policy command to set the policy and suppress this warning.
> 
>   The dependency target "hdf5" of target "gatbcore-static" does not exist.
> This warning is for project developers.  Use -Wno-dev to suppress it

Hi,

That isn't the error causing the FTBFS (infact that warning appears on
all arches - you should look into that). The real error is:

> [ 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'
> ../lib/libgatbcore.a(SortingCountAlgorithmTemplates2.cpp.o): In function `gatb::core::tools::storage::impl::BagHDF5<gatb::core::tools::math::LargeInt<2> >::insert(gatb::core::tools::math::LargeInt<2> 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(SortingCountAlgorithmTemplates2.cpp.o): In function `gatb::core::tools::storage::impl::BagHDF5<gatb::core::kmer::impl::Kmer<64u>::Count>::insert(gatb::core::kmer::impl::Kmer<64u>::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(SortingCountAlgorithmTemplates2.cpp.o): In function `gatb::core::tools::storage::impl::BagHDF5<gatb::core::tools::misc::IHistogram::Entry>::insert(gatb::core::tools::misc::IHistogram::Entry 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(SortingCountAlgorithmTemplates2.cpp.o): In function `gatb::core::tools::storage::impl::BagHDF5<gatb::core::tools::math::NativeInt64>::insert(gatb::core::tools::math::NativeInt64 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(SortingCountAlgorithmTemplates1.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

MIPS 32-bit (and probably the other arches) have no hardware support for
8-byte atomic operations. Either you should remove / disable 8-byte
calls to __sync* functions on these arches, or you can use the __atomic
functions from libatomic which should work everywhere. 

https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fatomic-Builtins.html#_005f_005fatomic-Builtins

Also, the functions in stdatomic.h from C11 map almost exactly to gcc's
__atomic functions (requires gcc 4.9).

http://en.cppreference.com/w/c/atomic

You can use the most restrictive memory model __ATOMIC_SEQ_CST to get
the same behaviour as the __sync functions. You'll also need to link
with -latomic.

Thanks,
James
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.