Project

General

Profile

Support #491

Updated by Daniel Curtis over 9 years ago

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 : 

 h2. Dependencies installation 

 * Add in @/etc/apt/sources.list@ : 
 <pre> 
 deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free 
 </pre> 

 * Then install a few dependencies: 
 <pre> 
 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 
 </pre> 

 h2. Install GCC 

 * Download the latest GCC 4.8 
 <pre> 
 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 
 </pre> 

 * Get and apply patches 
 <pre> 
 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 .. 
 </pre> 

 * GCC configuration 
 <pre> 
 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++ 
 </pre> 

 * Compilation 
 <pre> 
 make 2>&1 | tee build.log 
 </pre> 

 * Installation 
 <pre> 
 sudo make install 
 </pre> 

 * Change symbolic links, this changes your currents gcc and g++ commands to use gcc 4.8 
 <pre> 
 sudo ln -s /opt/gdc/bin/gcc /usr/bin/gcc 
 sudo ln -s /opt/gdc/bin/g++ /usr/bin/g++ 
 </pre> 

 h3. Verification 

 * Commands should return GCC version 4.8 
 <pre> 
 gcc -v 
 g++ -v 
 </pre> 

 h2. 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":https://bugs.launchpad.net/galera/+bug/1164992 

 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) 
 <pre> 
 wget http://bazaar.launchpad.net/~codership/galera/2.x/tarball/152?start_revid=176 http://bazaar.launchpad.net/~codership/galera/2.x/tarball/152?start_revid=152 -O galera.tgz 
 tar xf galera.tgz 
 </pre> 

 * Compilation 
 <pre> 
 cd \~codership/galera/2.x/ 
 scons boost_pool=0 
 </pre> 
 
 We move the files later. 

 h2. Install MariaDB 

 * Dependencies installation 
 <pre> 
 sudo apt-get install cmake make g++ libncurses5-dev mysql-client 
 </pre> 

 * MariaDB Download 
 <pre> 
 http://ftp.osuosl.org/pub/mariadb/mariadb-galera-5.5.40/source/mariadb-galera-5.5.40.tar.gz 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.40.tar.gz mariadb-galera-5.5.29.tar.gz 
 cd mariadb-5.5.40/ mariadb-5.5.29/ 
 </pre> 

 * Compilation 
 <pre> 
 cmake -G "Unix Makefiles" -DWITH_WSREP=ON -DWITH_INNODB_DISALLOW_WRITES=1 
 make 
 sudo make install 
 </pre> 

 * Move Galera's need file to MariaDB repository 
 <pre> 
 sudo cp garb/garbd /usr/local/mysql/bin/ 
 sudo cp libgalera_smm.so /usr/local/mysql/lib/plugin/ 
 </pre> 

 Now just configure your database with Wsrep configuration and use it. 

 h2. Resources 

 * https://groups.google.com/d/msg/codership-team/AzKmEJz7vTQ/JP8D4HXP-IYJ

Back