How-To: MariaDB 10.3.12 on FreeBSD 11.2

mmx

Verified User
Joined
May 8, 2005
Messages
130
Location
Montreal, QC
Here's a quick guide on how to fix the long-standing MariaDB 10.x on FreeBSD compilation issues when using CustomBuild. Credit goes to wattie for his previous thread on the matter.

Tested on:
  • FreeBSD 11.2 with latest patches (as of 2019-02-02)
  • DirectAdmin 1.55+ with FreeBSD 11.x beta binaries
  • Latest CustomBuild2

The issue:
When building MariaDB 10.x through CustomBuild, compilation will continuously fail. The underlying problem is using MariaDB's bundled zlib libraries instead of the base system ones when compiling. Disabling the TokuDB storage engine is not the correct solution, however we're still going to keep it off for the time being as other patches are necessary to make it work properly.

The fix:
A few CMAKE flags to override the one's from CB2 will permanently fix this annoying issue. These flags are straight from FreeBSD's databases/mariadb103-server port (source).

The solution:
What we're going to do is create a custom/cmake.mysql script which will then be used by CustomBuild automatically on subsequent builds.

Code:
cd /usr/local/directadmin/custombuild
mkdir -p custom/mysql
touch custom/mysql/cmake.mysql
chmod 700 custom/mysql/cmake.mysql
ee custom/mysql/cmake.mysql

Copy and paste the following into cmake.mysql:
Code:
#!/bin/sh
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_ZLIB=system \
-DWITH_EXTRA_CHARSETS=all \
-DPLUGIN_TOKUDB=NO \
-DWITH_JEMALLOC=system \
-DWITH_LIBWRAP=1 \
-DWITHOUT_TOKUDB=YES

Save and exit.

Now cross your fingers and run:
Code:
./build mariadb

CustomBuild will then take care of the rest for you, including running mysql_upgrade.

For reference, relevant options.conf values are as follows:
Code:
mariadb=10.3
mysql_inst=mariadb
mysql_force_compile=no
 
The last time I tried it was compiled with the flags from my post but then it didn't want to start at all. I will give it a try again soon :)
 
Suddenly with 10.4.8 it did not work again. MROONGA storage engine build failed.

Code:
[ 91%] Building CXX object storage/mroonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o
clang++: warning: -Wl,-z,relro,-z,now: 'linker' input unused [-Wunused-command-line-argument]
In file included from /usr/local/directadmin/custombuild/mariadb-10.4.8/storage/mroonga/ha_mroonga.cpp:23:
In file included from /usr/local/directadmin/custombuild/mariadb-10.4.8/storage/mroonga/mrn_mysql.h:24:
In file included from /usr/local/directadmin/custombuild/mariadb-10.4.8/include/my_global.h:320:
In file included from /usr/include/c++/v1/math.h:309:
In file included from /usr/include/c++/v1/type_traits:406:
In file included from /usr/include/c++/v1/cstddef:38:
/usr/local/directadmin/custombuild/mariadb-10.4.8/storage/mroonga/version:1:1: error: expected unqualified-id
7.07

I had to disable it with:

Code:
DWITHOUT_MROONGA=YES

It is maybe temporarily issue with CLang. Probably they'll fix it in the next release. Here is what I fount:

http://cgit.openembedded.org/meta-o.../clang_version_header_conflict.patch?h=master
 
Last edited:
Back
Top