# building galera on FreeBSD



## crazed (Jul 11, 2010)

Hello,

I've been wanting to use synchronous InnoDB multi-master replication (MySQL) on FreeBSD, and I see that there's a Linux option called Galera. This looks extremely promising, and I think those of us on FreeBSD should get a taste of it. I've downloaded the source and attempted to build, but it looks like I've gotten to a point that I can't get passed on my own.

While trying to build libgalerautils, I initially solved a problem by adding an #include <unistd.h> line to gu_mem.h, but now I'm getting the following when trying to compile:


```
# gmake
gmake  all-recursive
gmake[1]: Entering directory `/opt/galera-source-0.7.3/libgalerautils-0.3.6'
Making all in src
gmake[2]: Entering directory `/opt/galera-source-0.7.3/libgalerautils-0.3.6/src'
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -DDEBUG_ASSERT -D_FORTIFY_SOURCE=1 -D_XOPEN_SOURCE=600  -O1 -g -fno-
inline -Wall -Werror -Wno-unused-parameter -pedantic -std=c99 -fno-strict-aliasing  -MT gu_mutex.lo -MD -MP -MF .deps/gu_mutex.Tpo -c -o 
gu_mutex.lo gu_mutex.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DDEBUG_ASSERT -D_FORTIFY_SOURCE=1 -D_XOPEN_SOURCE=600 -O1 -g -fno-inline -Wall -Werror -Wno-
unused-parameter -pedantic -std=c99 -fno-strict-aliasing -MT gu_mutex.lo -MD -MP -MF .deps/gu_mutex.Tpo -c gu_mutex.c  -fPIC -DPIC -o 
.libs/gu_mutex.o
In file included from galerautils.h:14,
                 from gu_mutex.c:11:
gu_byteswap.h:13:49: error: endian.h: No such file or directory
gu_byteswap.h:14:68: error: byteswap.h: No such file or directory
In file included from galerautils.h:15,
                 from gu_mutex.c:11:
gu_time.h: In function 'gu_time_process_cputime':
gu_time.h:96: error: 'CLOCK_PROCESS_CPUTIME_ID' undeclared (first use in this function)
gu_time.h:96: error: (Each undeclared identifier is reported only once
gu_time.h:96: error: for each function it appears in.)
gmake[2]: *** [gu_mutex.lo] Error 1
gmake[2]: Leaving directory `/opt/galera-source-0.7.3/libgalerautils-0.3.6/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/opt/galera-source-0.7.3/libgalerautils-0.3.6'
gmake: *** [all] Error 2
```

I've installed gnulib from ports as it looks like byteswap.h is part of this, however, it is still not on my system.


```
# find / -name endian.h -o -name byteswap.h
/usr/include/machine/endian.h
/usr/include/netatalk/endian.h
/usr/include/sys/endian.h
/usr/ports/emulators/darcnes/files/endian.h
```

Unless this is included somewhere that I'm not aware of, I don't see this being an easy task to get compiled and running. Any tips or suggestions are welcome, I've also submitted something to the Galera mailing list, hoping to get some help from a developer (if possible).


----------



## expl (Jul 16, 2010)

byteswap.h Is i386-linux specific and is not portable due to low level nature of it.


----------



## Ben (Apr 23, 2013)

Has anybody tried to get Galera Cluster (with MariaDB maybe) up and running on FreeBSD? Or is the mentioned limitation still the reason for no success?

Thanks for the feedback.


----------



## qalit (Jan 3, 2014)

Salam,

Hi all, I tried downloading and compiling MariaDB Galera, and success. *H*ere is a simple logbook about my instal*l*ation of MariaDB Galera: https://gist.github.com/qalit/8239057

*I* wr*o*te this in the *I*ndonesian lang_uage_, you can translate it. *S*orry, my *E*nglish is not so good.


----------

