Supported Environment
v2019 supports building on ubuntu 18.04+ (including WSL), and OSX latest, Windows on MSYS2/mingw64.
Compilers: FluffOS v2019 uses C++17 and C11, which requires at least GCC 7+ or LLVM clang 4+.
System Library Requirement (Must install):
- Libevent 2.0+.
- ICU: FluffOS uses ICU for UTF-8 and transcoding support.
- jemalloc: Release build use JEMALLOC by default, and is highly recommended in production.
- OpenSSL (if PACAKGE_CRYPTO enabled)
- PCRE (if PACKGAGE_PCRE enabled)
- MysqlClient (if PACKAGE_DB enabled)
Bundled thirdparty library (no need to install):
- libtelnet: telnet protocol support
- libwebsocket: websocket support.
- ghc filesystem: polyfill for std::filesystem
- backward-cpp: stacktrace
- utf8_decoder_dfa: fast utf8 validation.
- widecharwidth: wcwidth with unicode 11
Ubuntu 18.04 LTS
This is the best linux distro to build & run FluffOS, support for other distro is best effort only.
Installing Dependencies
# Install all libs
$ sudo apt update
$ sudo apt install build-essential bison libevent-dev libmysqlclient-dev libpcre3-dev libpq-dev \
libsqlite3-dev libssl-dev libz-dev libjemalloc-dev libicu-dev
Build Steps
- checkout git repo
$ git clone https://github.com/fluffos/fluffos.git $ cd fluffos $ git checkout master #(or an release tag)
- Upgrade your cmake
$ sudo pip install --upgrade cmake
- Build
$ mkdir build $ cd build $ cmake .. $ make -j4 install
- Find binary files and support files in ./bin/
MacOS
Require OSX 10.15.
-
Install Homebrew, goto https://brew.sh/ and follow instructions!
- install libraries (checkout https://github.com/fluffos/fluffos/blob/master/.github/workflows/ci-osx.yml if you
have issue)
$ brew install cmake pkg-config mysql pcre libgcrypt libevent openssl jemalloc icu4c
- build same as under linux, you will need to pass two environment variables
$ mkdir build && cd build $ OPENSSL_ROOT_DIR="/usr/local/opt/openssl" ICU_ROOT="/usr/local/opt/icu4c" cmake .. $ make install
Windows
Supported Environment: Windows 10 + MSYS2, the binary produced can run on Windows 7+.
see https://forum.fluffos.info/t/compiling-fluffos-v2019-under-osx-windows-msys2-mingw64/601
checkout https://github.com/fluffos/fluffos/blob/master/.github/workflows/ci-windows.yml if you have issue.
Packages
By default driver have an default list of builtin packages to build.
If you want to turn off an package, run cmake .. -DPACKAGE_XX=OFF -DPACAGE_YY=OFF
CPU compatibility
By default driver built in release mode will optimize for running on current system CPU only. Copying driver to another machine to run will generally not work!
if you need portable drivers, turn off MARCH_NATIVE as following.
$ cmake .. -DMARCH_NATIVE=OFF
Static linking
you can pass -DSTATIC=ON to force driver to link staticly for all libraries, this will only work in a specialized environment like alpine linux and Windows.
Alpine Linux
Installing Dependencies
# Install all libs
$ apk add linux-headers gcc g++ clang-dev make cmake python2 bash \
mariadb-dev mariadb-static postgresql-dev sqlite-dev sqlite-static\
libevent-dev libevent-static libexecinfo-dev libexecinfo-static \
openssl-dev openssl-libs-static zlib-dev zlib-static icu-dev icu-static \
pcre-dev bison
Installing jemalloc
$ wget -O - https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2 | tar -xj && \
cd jemalloc-5.2.1 && \
./configure --prefix=/usr && \
make && \
make install
Build Steps
$ git clone https://github.com/fluffos/fluffos.git
$ cd fluffos
$ mkdir build && cd build
$ cmake .. -DMARCH_NATIVE=OFF -DSTATIC=ON
$ make install
Check the result file to make sure it is an static file.
$ ldd bin/driver
not a dynamic executable