Project

General

Profile

Support #491

Compiling and Installing MariaDB Galera Server on Raspbian

Added by Daniel Curtis over 7 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
-
Target version:
-
Start date:
12/10/2014
Due date:
% Done:

0%

Estimated time:
6.00 h

Description

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. So, how to install GCC 4.8? You can't use apt-get, so to build gcc from source there is what I did :

Dependencies installation

  • Add in /etc/apt/sources.list :
    deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free
    
  • Then install a few dependencies:
    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
    

Install GCC

  • Download the latest GCC 4.8
    wget https://ftp.gnu.org/gnu/gcc/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
    
  • Get and apply patches
    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 changes 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
    

Compile Galera

So, now you have GCC 4.8 with atomic 8 bits operation!
But there is a bug which prevent you to build Galera lib with GCC 4.8

So you must use Galera revision higher than 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=176 -O galera.tgz
    tar xf galera.tgz
    
  • Compilation
    cd \~codership/galera/2.x/
    scons boost_pool=0
    

We move the files later.

Install MariaDB

  • Dependencies installation
    sudo apt-get install cmake make g++ libncurses5-dev mysql-client
    
  • MariaDB Download
    http://ftp.osuosl.org/pub/mariadb/mariadb-galera-5.5.40/source/mariadb-galera-5.5.40.tar.gz
    tar xf mariadb-galera-5.5.40.tar.gz
    cd mariadb-5.5.40/
    
  • Compilation
    cmake -G "Unix Makefiles" -DWITH_WSREP=ON -DWITH_INNODB_DISALLOW_WRITES=1
    make
    sudo make install
    
  • Move Galera's need file to MariaDB repository
    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.

Resources

#1

Updated by Daniel Curtis over 7 years ago

  • Description updated (diff)
#2

Updated by Daniel Curtis over 7 years ago

  • Subject changed from Compiling and Installing MariaDB Galera Server on Raspberry Pi to Compiling and Installing MariaDB Galera Server on Raspbian
#3

Updated by Daniel Curtis over 7 years ago

  • Description updated (diff)
  • Status changed from New to In Progress
#4

Updated by Daniel Curtis about 5 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF