Search code examples
linuxgccatomicconnectorbuilt-in

Native atomic support not found on Raspberry


I'm trying to install the mysql-connector to use odb ( http://www.codesynthesis.com/products/odb ). When I do the command sudo make on my Raspberry, it starts but he gave me an error when he search the atomic support on gcc.

This is the error:

In file included form /home/pi/odb/mysql-connector-c-6.1.5-src/include/lf.h:19:0,
from /home/pi/odb/mysql-connector-c-6.1.5-src/mysys/lf_alloc-pin.c:101:0:
/home/pi/odb/mysql-connector-c-6.1.5-src/include/my_atomic.h:62:4: error: 
#error Native atomics support not found!

In my_atomic.h there is this code:

#if defined(_MSC_VER)
#  include "atomic/generic-msvc.h"
#elif defined(HAVE_SOLARIS_ATOMIC)
#  include "atomic/solaris.h"
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#  include "atomic/gcc_builtins.h"
#else
#  error Native atomics support not found!
#endif

so I think there isn't the builtin of atomic in my GCC. The gcc --version returns 4.6.3 so theorycally it must support it ( https://gcc.gnu.org/projects/cxx0x.html -> Atomic operations N2427 GCC 4.4).

How can I install the atomic builtin on my gcc?

Thank you all, Luca


Solution

  • C++11 atomics are not the same with GCC atomic builtins. Correct GCC atomic builtins for Raspberry Pi (which is ARM board) implemented from 4.8 as outlined on gcc wiki

    ARM supports 8 byte atomics with cmpxchg64 kernel helper with gcc-4.8 + Linux 3.1 (or Linux 2.6.30 w/ armv6k+)

    So, just upgrade your GCC and everything should pass.