Building zvec from Source on Bleeding-Edge Linux (GCC 15 / Python 3.14) #143
aashish-thapa
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am just documenting (what i did) on how to build zvec from source on systems with newer toolchains (e.g., Arch Linux with GCC 15 and Python 3.14) where the default
pip install .fails due to C++ compilation incompatibilities in third-party dependencies.The Problem
zvec officially supports Python 3.10-3.12 and its bundled C++ dependencies (RocksDB 8.1.1, antlr4, etc.) don't compile with GCC 15. You'll see errors like:
uint32_tvsint) intrace_record.h/trace_record.ccCMAKE_POLICY(SET ... OLD)rejected by newer CMake-Wno-unqualified-std-cast-callunrecognized warning flagPrerequisites
Step 1: Install pyenv and Python 3.12
Install pyenv
curl https://pyenv.run | bashAdd to your
~/.zshrc(or~/.bashrc):Reload your shell:
Install Python 3.12
The tkinter warning during installation is harmless and can be ignored.
Step 2: Patch antlr4 CMakeLists (Required)
Newer CMake versions reject
CMAKE_POLICY(SET ... OLD)directives. Editthirdparty/antlr/antlr4/runtime/Cpp/CMakeLists.txtand change the OLD policies to NEW:if(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR CMAKE_VERSION VERSION_GREATER "3.0.0") CMAKE_POLICY(SET CMP0026 NEW) - CMAKE_POLICY(SET CMP0054 OLD) - CMAKE_POLICY(SET CMP0045 OLD) - CMAKE_POLICY(SET CMP0042 OLD) + CMAKE_POLICY(SET CMP0054 NEW) + CMAKE_POLICY(SET CMP0045 NEW) + CMAKE_POLICY(SET CMP0042 NEW) endif() if(CMAKE_VERSION VERSION_EQUAL "3.3.0" OR CMAKE_VERSION VERSION_GREATER "3.3.0") - CMAKE_POLICY(SET CMP0059 OLD) - CMAKE_POLICY(SET CMP0054 OLD) + CMAKE_POLICY(SET CMP0059 NEW) + CMAKE_POLICY(SET CMP0054 NEW) endif()Step 3: Build the Wheel with Docker
Using Docker avoids all GCC 15 issues — the
python:3.12image ships with GCC 14 which compiles everything cleanly.Clean any previous build artifacts
Build the wheel
This will take several minutes (1098 compilation units). The resulting
.whlfile will be indist/.Fix file permissions
Docker creates files as root. Fix ownership:
Step 4: Install the Wheel
Create a Python 3.12 virtual environment and install:
Step 5: Verify
Expected output:
Alternative: Build Without Docker (GCC 13/14)
If you prefer not to use Docker, install an older GCC alongside your system GCC:
Your system GCC 15 remains the default —
gcc-13/g++-13are only used for this build.Troubleshooting
CMakeCache.txt directory ... is differentbuild/directorydubious ownership in repositorygit config --global --add safe.directory "*"inside containerzsh: command not found: pyenvpyenv initsyntaxpyenv init - zshhas a space beforezshnot a supported wheel on this platformpyenv installEnvironment Tested
Beta Was this translation helpful? Give feedback.
All reactions