MemoDocumentation
EN

CGO Flags

Memo requires CGO for SQLite via the mattn/go-sqlite3 driver. CGO must be enabled for all Go build, test, and run commands.

Mandatory CGO

CGO_ENABLED=1 go build .
CGO_ENABLED=1 go test ./...
CGO_ENABLED=1 go run . --port 8090

Without CGO_ENABLED=1, the SQLite driver will not compile and you will see linker errors.

sqlite-vec Extension

Memo uses the sqlite-vec extension for vector similarity search. This is a compiled shared library:

  • Linux: vec0.so placed next to the Memo binary
  • Windows: vec0.dll placed next to the Memo binary
  • macOS: vec0.dylib placed next to the Memo binary

Compilation

The extension is compiled separately from the main project. The binary must be built for the target platform:

# Linux
gcc -shared -fPIC -o vec0.so sqlite-vec.c -lm

# Windows (MSYS2/MinGW)
gcc -shared -o vec0.dll sqlite-vec.c -lm

# macOS
clang -shared -fPIC -o vec0.dylib sqlite-vec.c -lm

Placement

Place the compiled extension in the same directory as the Memo executable, or set the path via config:

memory:
  vec_extension_path: "/path/to/vec0.so"

Go Fallback Mode

If the sqlite-vec extension is not available, Memo falls back to pure Go brute-force cosine similarity search. This is functional but significantly slower for large memory stores (>1000 entries). A warning is emitted at startup when the extension is missing.

macOS Notes

On macOS, you may need to set additional linker flags for SQLite:

CGO_ENABLED=1 CGO_LDFLAGS="-L/usr/local/lib" go build .

The sqlite-vec dylib must be code-signed or Gatekeeper may block it on first run.

Windows Notes

On Windows, you need a C compiler in PATH. Install MSYS2 with mingw-w64-x86_64-gcc or use TDM-GCC. Make sure the compiler is available:

gcc --version

The vec0.dll must be accessible from the Memo binary's directory.