Building from Source
import { Card, CardGrid } from ‘@astrojs/starlight/components’;
Build the Fluxbase server binary directly from source on macOS or Linux — no Docker required. This is useful for local development, custom builds, or platforms where the official Docker images don’t fit.
How Fluxbase builds
Section titled “How Fluxbase builds”Two media features are backed by C libraries and are compiled in via Go build tags:
| Feature | Build tag | C dependency | Go binding |
|---|---|---|---|
| OCR (scanned PDFs / images in knowledge bases) | ocr |
Tesseract + Leptonica | gosseract |
| Image transformations (resize / reformat / rotate) | vips |
libvips | govips |
Each feature has a stub that compiles in when its tag is absent. The stub self-disables the feature at runtime — the server starts normally and reports the capability as unavailable. So Fluxbase always builds and runs, with or without the C libraries; the tags only decide which media features work.
CGO is always required, regardless of which tags you pick. Fluxbase links
pg_query_go(a C-based SQL parser), so you cannot build withCGO_ENABLED=0. A C toolchain (clang/gcc) must be present on every platform.
This gives you three build modes:
make target |
Tags | Needs C media libs | Result |
|---|---|---|---|
make build (default) |
ocr |
Tesseract + Leptonica | OCR works; image transforms unavailable |
make build-full |
ocr vips |
Tesseract + Leptonica + libvips | OCR and image transforms work (matches the full Docker image) |
make build-lite |
(none) | none | No C media deps; OCR and transforms self-disable (matches the lite Docker image) |
Prerequisites
Section titled “Prerequisites”Install these regardless of which build mode you choose:
| Tool | Version | Why | Install |
|---|---|---|---|
| Go | 1.26+ | Build the server and CLI | brew install go / downloads |
| Bun (or Node.js 20+) | latest | Admin UI + embedded SDKs | brew install bun |
| Deno | latest | Edge functions runtime | brew install deno |
| PostgreSQL | 16+ with pgvector | Target database | brew install postgresql@16 |
| C toolchain | clang / gcc | CGO (pg_query_go) |
included with Xcode Command Line Tools / build-essential |
pkg-config |
any | CGO locates the C libraries | brew install pkg-config |
The server builds the TypeScript and React SDKs and the admin UI as part of
make build. If you only need the server binary and want to skip that, rungo build ./cmd/fluxbasedirectly after at least onemake build(or runmake cleanto install the placeholder admin UI).
System dependencies (C libraries)
Section titled “System dependencies (C libraries)”Only needed for the build tags you actually enable.
| Platform | For ocr (Tesseract + Leptonica) |
Add vips for image transforms |
Runtime extras |
|---|---|---|---|
| macOS (Homebrew) | brew install tesseract leptonica pkg-config |
add vips |
brew install poppler (PDF OCR), brew install tesseract-lang (non-English) |
| Debian / Ubuntu | sudo apt-get install -y libtesseract-dev libleptonica-dev pkg-config |
add libvips-dev |
sudo apt-get install -y poppler-utils tesseract-ocr tesseract-ocr-eng |
| Fedora / RHEL | sudo dnf install -y tesseract-devel leptonica-devel pkgconfig |
add vips-devel |
sudo dnf install -y poppler-utils tesseract tesseract-langpack-eng |
| Arch Linux | sudo pacman -S tesseract leptonica pkgconf |
add libvips |
sudo pacman -S poppler tesseract-data-eng |
About the macOS Homebrew quirk
Section titled “About the macOS Homebrew quirk”This is the root cause of the most common build error.
Homebrew installs leptonica and vips keg-only — their pkgconfig
files are not symlinked into the default search path. So on a fresh
terminal, pkg-config (and therefore CGO) cannot find them, and make build
fails with:
tessbridge.cpp:5:10: fatal error: 'leptonica/allheaders.h' file not foundThe Fluxbase Makefile handles this automatically. On macOS it detects Homebrew and wires up both ways the bindings discover the libraries:
- It prepends the keg
pkgconfigdirectories toPKG_CONFIG_PATH. This is whatgovips(thevipstag) needs, since it reads pkg-config. - It also sets
CGO_CPPFLAGS/CGO_CXXFLAGS/CGO_LDFLAGSto the keg include and library directories. This is required forgosseract(theocrtag), which does not use pkg-config — it hardcodes the Intel-Homebrew paths (/usr/local/...), and on Apple Silicon the kegs live under/opt/homebrew/opt/...instead.
As long as you build via make build, you do not need to set any
environment variables manually, and opening a new terminal won’t break the
build.
If you invoke go build directly (bypassing the Makefile), set the paths
yourself — see Manual environment setup
below.
1. macOS quick path
Section titled “1. macOS quick path”# 1. Install build toolsbrew install go bun deno postgresql@16 pkg-config
# 2. Install C libraries for the default OCR buildbrew install tesseract leptonica
# 3. Clone and buildgit clone https://github.com/nimbleflux/fluxbase.gitcd fluxbasemake build
# 4. Run./build/fluxbase-serverThat’s it — the Makefile takes care of the Homebrew keg paths, builds the
SDKs and admin UI, and produces build/fluxbase-server.
2. Pick a build mode
Section titled “2. Pick a build mode”# Default: OCR enabled, no image transformsmake build
# Full: OCR + libvips image transforms (matches the full Docker image)# — also `brew install vips` firstmake build-full
# Lite: no C media dependencies at all (matches the lite Docker image)make build-lite
# Override tags directly if you need something custommake build BUILD_TAGS="ocr vips"3. Linux quick path (Debian / Ubuntu)
Section titled “3. Linux quick path (Debian / Ubuntu)”sudo apt-get updatesudo apt-get install -y \ build-essential pkg-config \ libtesseract-dev libleptonica-dev libvips-dev \ poppler-utils tesseract-ocr tesseract-ocr-eng
git clone https://github.com/nimbleflux/fluxbase.gitcd fluxbasemake build-fullManual environment setup (macOS)
Section titled “Manual environment setup (macOS)”Only needed if you call go build directly instead of make build (the
Makefile does all of this for you automatically). The two media bindings
discover their libraries differently, so you may need both kinds of setup:
For OCR (gosseract, the ocr tag) — gosseract does not use
pkg-config; it hardcodes the Intel-Homebrew paths, so PKG_CONFIG_PATH has no
effect on it. Point CGO at the keg include/library directories directly (works
on Apple Silicon and Intel because it uses brew --prefix):
# ~/.zshrc or ~/.bashrcexport CGO_CPPFLAGS="-I$(brew --prefix leptonica)/include -I$(brew --prefix tesseract)/include"export CGO_CXXFLAGS="-I$(brew --prefix leptonica)/include -I$(brew --prefix tesseract)/include"export CGO_LDFLAGS="-L$(brew --prefix leptonica)/lib -L$(brew --prefix tesseract)/lib"
gosseractcompiles a C++ bridge (tessbridge.cpp), so the include flags must be inCGO_CPPFLAGS/CGO_CXXFLAGS— not onlyCGO_CFLAGS.
For image transforms (govips, the vips tag) — govips does use
pkg-config, so add the keg pkgconfig directory to the search path:
export PKG_CONFIG_PATH="$(brew --prefix vips)/lib/pkgconfig:$PKG_CONFIG_PATH"Verify CGO can see the libraries:
pkg-config --cflags --libs vips # should print -I and -L flags (vips tag)Troubleshooting
Section titled “Troubleshooting”'leptonica/allheaders.h' file not found
Section titled “'leptonica/allheaders.h' file not found”The ocr build tag is set but Leptonica’s headers aren’t on the search path.
- Building with
make build— make surebrew install tesseract leptonicasucceeded. The Makefile sets the CGO include/library paths for you, so this should just work — re-runmake build. - Building with
go builddirectly —gosseractignoresPKG_CONFIG_PATH, so you must setCGO_CPPFLAGS/CGO_CXXFLAGS/CGO_LDFLAGSyourself, as described in Manual environment setup. - Don’t need OCR? — build lite and skip the C libraries entirely:
make build-lite.
'tesseract/api/capi.h' file not found
Section titled “'tesseract/api/capi.h' file not found”Same class of problem, but for Tesseract rather than Leptonica. The fix is
identical: brew install tesseract (or the Linux equivalent) and ensure
PKG_CONFIG_PATH includes the Tesseract keg.
vips/Vips8.h file not found or duplicate-symbol errors
Section titled “vips/Vips8.h file not found or duplicate-symbol errors”You’re building with the vips tag but libvips isn’t installed. Either install
it (brew install vips / libvips-dev) or drop the vips tag — use the
default make build instead of make build-full.
pkg-config: not found
Section titled “pkg-config: not found”Install pkg-config (brew install pkg-config / apt-get install pkg-config).
CGO uses it to locate the C libraries.
OCR or transforms report “unavailable” at runtime
Section titled “OCR or transforms report “unavailable” at runtime”This means you built lite (or default, for transforms) — the feature’s stub compiled in. To enable:
- OCR → rebuild with the
ocrtag:make buildormake build-full. - Image transforms → rebuild with the
vipstag:make build-full.
You can check which capabilities a running server has via the knowledge-bases
capabilities endpoint (ocr_available) — see
Knowledge Bases.
What you lose without each feature
Section titled “What you lose without each feature”- Without
ocr— scanned PDFs and image-only files in AI knowledge bases are not text-extracted. See Knowledge Bases. - Without
vips— storage image transformations (resize, reformat, rotate) return an error. Digital-native files and OCR on text PDFs are unaffected. See Image Transformations. - Neither tag — the server is fully functional for everything except OCR ingestion and image transforms. This is exactly the lite Docker image.