Building MariaDB (ABANDONED)
NOTE: While this is abandoned, I have kept the toolchain file here, in case we need to build something else with cmake.
Download MariaDB 10.3.16 from
downloads.mariadb.org.
Install the prerequisites:
Code: Select all
sudo apt install cmake libevent-dev git libssl-dev
MariaDB uses the cmake system. In order to cross compile with cmake, a toolchain file needs to be created. You can download this as an attachment.
Build helper tools
You need to make a build directory for these tools. Make the build directory
outside the source directory!
Code: Select all
mkdir -p mariadb/native
cd mariadb/native
These need to be built first, and for the host architecture. Create them with the following commands:
Code: Select all
cmake ../../mariadb-10.3.16 -DWITH_SSL=system
make import_executables -j <num_of_cpu_cores>
cd ..
Build MariaDB for target
You need another temporary directory for this, outside the MariaDB source directory, as before:
Run these commands to configure the build:
Code: Select all
CFLAGS="-I/home/wmt/nas-sysroot/include -I/home/wmt/nas-sysroot/usr/local/include -I/home/wmt/nas-sysroot/usr/local/include/ncurses" CXXFLAGS="-I/home/wmt/nas-sysroot/include -I/home/wmt/nas-sysroot/usr/local/include -I/home/wmt/nas-sysroot/usr/local/include/ncurses" LDFLAGS="-L/home/wmt/nas-sysroot/lib -L/home/wmt/nas-sysroot/usr/local/lib" CXXLDFLAGS="-L/home/wmt/nas-sysroot/lib -L/home/wmt/nas-sysroot/usr/local/lib" cmake ../../mariadb-10.3.16 -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_C_COMPILER=arm-unknown-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-unknown-linux-gnueabi-g++ -DIMPORT_EXECUTABLES=/home/wmt/Downloads/mariadb/native/import_executables.cmake -DCMAKE_FIND_ROOT_PATH=/home/wmt/nas-sysroot/
To make, run:
- make -j <num_of_cpu_cores>
The -j option is recommended, because this is slow to compile.
To install, run:
Code: Select all
sudo PATH="/home/wmt/x-tools/arm-unknown-linux-gnueabi/bin:$PATH" make DESTDIR=/home/wmt/nas-sysroot install
NOTE: Currently fails to execute: A newer kernel is required to run this binary.