Compiling ProxySQL on FreeBSD

Compiling ProxySQL 1.4.6 on FreeBSD 11.1


FreeBSD is the operating system of choice for many MySQL installations and a topic that often comes up in the ProxySQL Google Forums as well as the ProxySQL Github Issue Tracker is related to ProxySQL on FreeBSD. An official package for FreeBSD (and BSD in general) is not available in the ProxySQL releases however it is in fact possible to compile ProxySQL on FreeBSD.

In this blog article we outline the steps in order to compile ProxySQL 1.4.6 on FreeBSD 11.1.

Firstly, you'll need a copy of FreeBSD 11.1 available here (the amd64 Virtual Machine Image was used to prepare this article). Once you've installed the operating system you'll need to install the following pre-requisite packages in order to compile (this can be done either with ports or the pkg package manager):

pkg install automake bzip2 cmake gmake gcc git libiconv openssl-devel patch

At this point we'll also need to download the source code for ProxySQL from Github and make sure we're using the branch we'd like to build:

$  git clone
Cloning into 'proxysql'...
remote: Counting objects: 13354, done.
remote: Compressing objects: 100% (117/117), done.
remote: Total 13354 (delta 124), reused 137 (delta 88), pack-reused 13147
Receiving objects: 100% (13354/13354), 41.95 MiB | 2.37 MiB/s, done.
Resolving deltas: 100% (9624/9624), done.
$  cd proxysql
$  git branch
* v1.4.6

Finally we'll need to pass suitable compiler options in order for the correct lib paths to be used during compilation and run gmake in a bash shell:

CC=gcc CXX=g++ LIBS="-L/usr/local/lib -I/usr/local/includes -Wl,-rpath=/usr/local/lib/gcc6 -liconv" gmake 

Once this completes you'll have the compiled binary in the /src directory and you can install with sudo gmake install or just start the binary directly in the background specifying the datadir e.g. proxysql -D .. Please keep in mind that you might manually need to create the /var/lib directory before running install in case it is not present and you'll also have to add you own FreeBSD compatible rc.d startup script if needed.

Authored by: Nick Vyzas



TEL/電話+86 13764045638
QQ 47079569