Re: Can't launch cluster - undefined symbol: __sync_fetch_and_add_8

446 views
Skip to first unread message

Olivier NORTURE

unread,
Sep 11, 2013, 11:27:21 AM9/11/13
to codersh...@googlegroups.com

So, after few days i found the solution. I just missed to post it here.

I hope this can help somebody :-)

 

 

First you MUST use GCC >= 4.8

By default, on my Raspbian version : 2013-05-25-wheezy-raspbian, gcc is on version 4.7.2 and it's why this error append.

I don't remember exactly why, but in my memorie it's because gcc <= 4.8 don't implemented 8 bits atomic operation on ARM.

 

So, how to install GCC 4.8 ?

You can't use apt-get :(

So to build gcc from source there is what i do :

Dependencies installation

 

Add in /etc/apt/sources.list :

Deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free

 

$ sudo apt-get update

 

$ sudo apt-get install lsb-release debhelper bison flex libmpfr-dev libmpc-dev zlib1g-dev libgmp3-dev

$ sudo apt-get build-dep gcc-4.7 autoconf2.64

 

 

Download GCC

 

$ wget ftp://ftp.uvsq.fr/pub/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.gz -O gcc-4.8.1.tar.gz

$ tar xf gcc-4.8.1.tar.gz

 

 

Use Patchs

 

$ wget http://anonscm.debian.org/viewvc/gcccvs/branches/sid/gcc-4.7/debian/patches/armhf-triplet.diff?view=co -O armhf-triplet.diff

$ wget http://anonscm.debian.org/viewvc/gcccvs/branches/sid/gcc-4.7/debian/patches/gcc-multiarch-trunk.diff?view=co -O gcc-multiarch-trunk.diff

 

$cd gcc-4.8.1

$ patch -p2 -i ../armhf-triplet.diff

$ patch -p2 -i ../gcc-multiarch-trunk.diff

 

$ cd gcc

$ autoconf2.64

$ cd ../libjava

$ autoconf2.64

$ cd ..

 

 

GCC configuration

 

$ cd ..

$ mkdir obj

$ cd obj

$ ../gcc-4.8.1/configure --prefix=/opt/gdc --enable-shared --enable-linker-build-id --with-system-zlib --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-checking=yes --disable-bootstrap --enable-languages=c,c++

 

 

Compilation

 

$ make 2>&1 | tee build.log

 

 

Installation

 

$ sudo make install

 

 

Change symbolic links

 

This change your currents gcc and g++ commands to use gcc 4.8

 

$ sudo ln -s /opt/gdc/bin/gcc /usr/bin/gcc

$ sudo ln -s /opt/gdc/bin/g++ /usr/bin/g++

 

Verification

 

Commands should return GCC version 4.8

$ gcc -v

$ g++ -v

 

So, now you have GCC 4.8 with atomic 8 bits operation !

But there is a bug which prevent you to build Galera lib withGCC 4.8 ... (lol)

https://bugs.launchpad.net/galera/+bug/1164992

 

So you must use Galera revision > 149

(At this time i used 152, but i think you safely use the latest version now)

 

Download Galera (>149, in this case 152)

 

$ wget http://bazaar.launchpad.net/~codership/galera/2.x/tarball/152?start_revid=152 -O galera.tgz

$ tar xf galera.tgz

 

Compilation

 

$ cd \~codership/galera/2.x/

$ scons boost_pool=0

 

We move files later.

 

And now just install the database (Maria DB in my case) :

 

Dependencies installation

 

$ sudo apt-get install cmake make g++ libncurses5-dev mysql-client

 

MariaDB Download

 

$ wget http://ftp.igh.cnrs.fr/pub/mariadb/mariadb-galera-5.5.29/kvm-tarbake-jaunty-x86/mariadb-galera-5.5.29.tar.gz

$ tar xf mariadb-galera-5.5.29.tar.gz

$  cd mariadb-5.5.29/

 

 

Compilation

 

$ cmake -G "Unix Makefiles" -DWITH_WSREP=ON -DWITH_INNODB_DISALLOW_WRITES=1

$ make

$ sudo make install

 

 

Move Galera's need file to MariaDB repositorie

 

$ sudo cp garb/garbd /usr/local/mysql/bin/

$ sudo cp libgalera_smm.so /usr/local/mysql/lib/plugin/

 

Now just configure your database with Wsrep configuration and use it :)

 

I hope this help somebody.

Best Regards.

Alexey Yurchenko

unread,
Sep 11, 2013, 2:07:54 PM9/11/13
to codersh...@googlegroups.com
Wow, thanks for posting. That's a somewhat unexpected solution. I would not expect GCC to be a culprit.

Reply all
Reply to author
Forward
0 new messages