Skip to content

Build from source fails with GCC 15 and newer CMake #144

@aashish-thapa

Description

@aashish-thapa

Summary

Building zvec from source fails on systems with GCC 15 and CMake 3.31+ (e.g., Arch Linux). Two separate issues in bundled third-party dependencies prevent compilation.

Environment

  • OS: Arch Linux (kernel 6.18.6)
  • GCC: 15.2.1
  • CMake: 3.31.10
  • Python: 3.14.2 (system), 3.12.12 (via pyenv)

Issue 1: antlr4 — CMAKE_POLICY(SET ... OLD) rejected by CMake 3.31+

thirdparty/antlr/antlr4/runtime/Cpp/CMakeLists.txt sets several policies to OLD:

CMAKE_POLICY(SET CMP0054 OLD)
CMAKE_POLICY(SET CMP0045 OLD)
CMAKE_POLICY(SET CMP0042 OLD)
CMAKE_POLICY(SET CMP0059 OLD)

CMake 3.31+ has removed support for the OLD behavior of these policies, causing a hard configuration error:

CMake Error at thirdparty/antlr/antlr4/runtime/Cpp/CMakeLists.txt:31 (CMAKE_POLICY):
CMake Error at thirdparty/antlr/antlr4/runtime/Cpp/CMakeLists.txt:32 (CMAKE_POLICY):
CMake Error at thirdparty/antlr/antlr4/runtime/Cpp/CMakeLists.txt:33 (CMAKE_POLICY):
CMake Error at thirdparty/antlr/antlr4/runtime/Cpp/CMakeLists.txt:38 (CMAKE_POLICY):
CMake Error at thirdparty/antlr/antlr4/runtime/Cpp/CMakeLists.txt:39 (CMAKE_POLICY):
-- Configuring incomplete, errors occurred!

Fix: Change OLD to NEW on lines 31-33 and 38-39.

Issue 2: RocksDB 8.1.1 — Type mismatches with GCC 15

RocksDB 8.1.1's trace_record.h and trace_record.cc have declaration mismatches under GCC 15. The compiler reports uint32_t/uint64_t resolving to int, causing errors like:

trace_replay/trace_record.cc:115:1: error: no declaration matches
  'rocksdb::IteratorSeekQueryTraceRecord::IteratorSeekQueryTraceRecord(SeekType, uint32_t, const std::string&, uint64_t)'

note: candidates are: '...(SeekType, int, const std::string&, int)'

This affects multiple classes: IteratorSeekQueryTraceRecord, MultiGetQueryTraceRecord, and their member functions.

Workaround

Building inside Docker with python:3.12 (which ships GCC 14) works after applying the antlr4 fix:

# 1. Patch antlr4 CMakeLists.txt (change OLD -> NEW on lines 31-33, 38-39)
# 2. Clean build dir
rm -rf build/ dist/

# 3. Build wheel in Docker
docker run --rm -v $(pwd):/src -w /src python:3.12 bash -c '
  git config --global --add safe.directory "*"
  pip wheel . -w /src/dist/ -v
'

# 4. Install in a Python 3.12 venv
~/.pyenv/versions/3.12.12/bin/python3.12 -m venv .venv
source .venv/bin/activate
pip install dist/zvec-*.whl

Suggestions

  1. Update the antlr4 CMAKE_POLICY calls from OLD to NEW
  2. Consider upgrading RocksDB to a version that compiles with GCC 15 (8.9+ or 9.x)
  3. Update the build docs to specify supported compiler versions (GCC <= 14) rather than just "C++17 compatible compiler"
  4. Consider adding Python 3.13+ to the supported versions or explicitly noting it's unsupported

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions