Source: qpid-proton
Version: 0.14.0-4
Severity: important
Tags: patch

Hi,

qpid-proton FTBFS on mips and mipsel with the error:
> CMakeFiles/mt_broker.dir/mt/epoll_container.cpp.o: In function 
> `std::__atomic_base<unsigned long long>::operator++()':
> /usr/include/c++/6/bits/atomic_base.h:296: undefined reference to 
> `__atomic_fetch_add_8'
> /usr/include/c++/6/bits/atomic_base.h:296: undefined reference to 
> `__atomic_fetch_add_8'
> CMakeFiles/mt_broker.dir/mt/broker.cpp.o: In function 
> `std::__atomic_base<unsigned long long>::fetch_add(unsigned long long, 
> std::memory_order)':
> /usr/include/c++/6/bits/atomic_base.h:514: undefined reference to 
> `__atomic_fetch_add_8'
> /usr/include/c++/6/bits/atomic_base.h:514: undefined reference to 
> `__atomic_fetch_add_8'
> collect2: error: ld returned 1 exit status
> examples/cpp/CMakeFiles/mt_broker.dir/build.make:127: recipe for target 
> 'examples/cpp/mt_broker' failed

This error is due to the use of 8-byte atomics which are not natively
supported on 32-bit MIPS. To fix this you have to use GCC's libatomic
library which emulates the atomics using locks. I've attached a patch
which fixes this.

Thanks,
James
Description: Link mt_broker example with -latomic
 On MIPS (and probably other) platforms, 8-byte atomics are not supported on the
 hardware level. To allow 8-byte atomics to be used on these platforms, GCC
 provides the libatomic library which implements them using locks.
 .
 Since the mt_broker example uses 8-byte atomics, link it with -latomic to
 allow atomics to work on MIPS.
Author: James Cowgill <jcowg...@debian.org>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -71,7 +71,7 @@ if(HAS_CPP11)
     foreach(example
         broker)
       add_executable(mt_${example} mt/${example}.cpp ${container_src})
-      target_link_libraries(mt_${example} pthread)
+      target_link_libraries(mt_${example} pthread atomic)
     endforeach()
     add_cpp_test(cpp_mt_example_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v MtBrokerTest)
   endif()

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to