Installation Guide¶
This guide covers installing ZeroIPC for C++, C, and Python on various platforms.
System Requirements¶
Operating System¶
- Linux (Ubuntu 20.04+, Debian 10+, Fedora 33+, etc.)
- macOS 10.15+
- Any POSIX-compliant Unix system
- Windows via WSL2 or Cygwin
Compiler Requirements¶
| Language | Minimum Version | Recommended |
|---|---|---|
| C++ | GCC 12+ or Clang 15+ | GCC 13+ or Clang 17+ |
| C | GCC 9+ or Clang 10+ | GCC 11+ or Clang 14+ |
| Python | Python 3.8+ | Python 3.10+ |
C++23 Required
The C++ implementation requires C++23 support. Ensure your compiler is up-to-date.
Quick Install¶
Detailed Installation Instructions¶
C++ Installation¶
1. Install Dependencies¶
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew install cmake googletest llvm
# Use LLVM's clang (for C++23 support)
export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
2. Build ZeroIPC¶
# Clone the repository
git clone https://github.com/yourusername/zeroipc.git
cd zeroipc/cpp
# Configure CMake
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=23 \
-DBUILD_TESTS=ON \
.
# Build
cmake --build build -j$(nproc)
# Run tests to verify installation
cd build && ctest --output-on-failure
3. Install (Optional)¶
# Install to /usr/local
sudo cmake --install build
# Or install to custom location
cmake --install build --prefix /opt/zeroipc
4. Use in Your Project¶
ZeroIPC is header-only, so you can:
Option 1: Direct include
Option 2: CMake find_package
# In your CMakeLists.txt
find_package(zeroipc REQUIRED)
target_link_libraries(your_target PRIVATE zeroipc::zeroipc)
Option 3: CMake add_subdirectory
# In your CMakeLists.txt
add_subdirectory(external/zeroipc/cpp)
target_link_libraries(your_target PRIVATE zeroipc::zeroipc)
Python Installation¶
1. Install Python Dependencies¶
# Install NumPy
pip install numpy
# For development
pip install numpy pytest pytest-cov black mypy ruff
2. Install ZeroIPC¶
3. Verify Installation¶
import zeroipc
print(zeroipc.__version__)
from zeroipc import Memory, Array
# If no errors, installation successful!
C Installation¶
1. Build Static Library¶
git clone https://github.com/yourusername/zeroipc.git
cd zeroipc/c
# Build
make
# Run tests
make test
2. Install¶
This installs: - libzeroipc.a to $PREFIX/lib/ - Headers to $PREFIX/include/zeroipc/
3. Link in Your Project¶
Or in a Makefile:
CFLAGS = -std=c99 -Wall
LDFLAGS = -lzeroipc -lrt -lpthread
myapp: myapp.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
Building CLI Tools¶
The zeroipc CLI tool is built automatically with the C++ library:
cd cpp
cmake -B build .
cmake --build build
# The tool will be at build/tools/zeroipc
./build/tools/zeroipc --help
To install globally:
Verification¶
C++ Verification¶
Create a test file test_install.cpp:
#include <zeroipc/memory.h>
#include <zeroipc/array.h>
#include <iostream>
int main() {
zeroipc::Memory mem("/test", 1024*1024);
zeroipc::Array<int> arr(mem, "numbers", 10);
arr[0] = 42;
std::cout << "ZeroIPC works! Value: " << arr[0] << std::endl;
return 0;
}
Compile and run:
g++ -std=c++23 -o test_install test_install.cpp -lrt -lpthread
./test_install
# Output: ZeroIPC works! Value: 42
Python Verification¶
from zeroipc import Memory, Array
import numpy as np
mem = Memory("/test", 1024*1024)
arr = Array(mem, "numbers", dtype=np.int32, capacity=10)
arr[0] = 42
print(f"ZeroIPC works! Value: {arr[0]}")
# Output: ZeroIPC works! Value: 42
C Verification¶
Create test_install.c:
#include <zeroipc/memory.h>
#include <zeroipc/array.h>
#include <stdio.h>
int main() {
zipc_memory_t* mem = zipc_memory_create("/test", 1024*1024);
zipc_array_t* arr = zipc_array_create(mem, "numbers", sizeof(int), 10);
int value = 42;
zipc_array_set(arr, 0, &value);
int result;
zipc_array_get(arr, 0, &result);
printf("ZeroIPC works! Value: %d\n", result);
zipc_array_destroy(arr);
zipc_memory_destroy(mem);
return 0;
}
Compile and run:
gcc -std=c99 -o test_install test_install.c -lzeroipc -lrt -lpthread
./test_install
# Output: ZeroIPC works! Value: 42
Troubleshooting¶
Common Issues¶
Issue: "C++23 features not available"¶
Solution: Update your compiler:
# Ubuntu
sudo apt install g++-13
# macOS
brew install llvm
export CXX=/usr/local/opt/llvm/bin/clang++
Issue: "Cannot find -lrt"¶
Solution: The realtime library is not available. On most Linux systems:
On macOS, -lrt is not needed (POSIX shared memory is in libSystem).
Issue: "Permission denied when creating shared memory"¶
Solution: Check /dev/shm permissions:
Issue: "Python import fails"¶
Solution: Ensure NumPy is installed:
Getting Help¶
If you encounter issues:
- Check the FAQ
- Search GitHub Issues
- Create a new issue with:
- OS and version
- Compiler version
- Error message
- Minimal reproduction code
Next Steps¶
Installation complete! Now:
- Quick Start - Write your first program
- Tutorial - Learn all the features
- Examples - See real-world usage