customizable clang based tool to extract c++ code for input to language binding generators
docker build -t llvm-runtime .Key components for secure container execution:
--user $(id -u):$(id -g)- Preserves host system permissions by running as current user-v /tmp/llvm1:/app- Maps local storage to container for persistent data
--security-opt=no-new-privileges- Prevents privilege escalation within container--cap-drop=ALL- Removes all Linux kernel capabilities, minimizing attack surface
-it- Enables interactive terminal access (combines stdin and TTY allocation)
mkdir -p /tmp/llvm1
docker run -it --user $(id -u):$(id -g) -v /tmp/llvm1:/app --security-opt=no-new-privileges --cap-drop=ALL llvm-runtime --install /app
export PATH=$PATH:/tmp/llvm1/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/llvm1/lib
# You should now be be able to run clang and llvm tools# Generate python bindings
# enter llvm-runtime container
# cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/app
# ninja installAfter building the Python bindings, you can test the package installation:
- Create a virtual environment:
python -m venv venv
source venv/bin/activate- Install the package in development mode:
pip install -e .- Test importing the module:
import cppglue
# Your module should now be available- To build a wheel for distribution:
python -m buildThe wheel file will be created in the dist/ directory.