Skip to content

whaiman/remote-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RGCC - Remote GCC Compiler System

RGCC is a robust, distributed compilation utility designed for remote building of C/C++ projects. Engineered with a zero-bloat architecture, it securely offloads the compilation compute from resource-constrained developer environments (e.g., lightweight laptops, Raspberry Pi, or Android/Termux) to a dedicated, high-performance remote build server.

Key Features

  • End-to-End Encryption: AES-256-GCM protects your source code and binaries during transmission.
  • Secure Key Exchange (ECDH + HKDF): Dynamic Elliptic-Curve Diffie-Hellman handshake for generating ephemeral session keys without transmitting them over the network.
  • Stateless Session Tickets: Server memory is protected from DDoS and memory leaks. The server does not maintain session states in its RAM.
  • MITM Protection: Automatic mixing of a Pre-Shared auth_token into the key derivation process to block Man-In-The-Middle attacks.
  • Lightweight & Highly Portable: Designed with a minimal footprint to run smoothly on low-power devices like Raspberry Pi, old laptops, or even Android via Termux.

Warning

We intentionally avoided heavy frameworks (like FastAPI or Pydantic) that require complex C/Rust toolchains during installation. If a device can run standard Python, it can run RGCC. [!NOTE] While the server itself is lightweight, compilation speed depends entirely on your project's complexity and the hardware it's running on. Large C++ projects will still take time on mobile CPUs.


Modular Installation

To maintain the principles of loose coupling and minimal resource utilization, RGCC is divided into discrete client and server domains via [project.optional-dependencies]. You should only install the components necessary for your specific node.

Option 1: Direct GitHub Installation (Recommended)

You can leverage pip to install the package directly into your Python environment without manually synchronizing the repository.

For the Developer Node (Client): This provisions the global rgcc CLI tool and terminal UI dependencies.

pip install "git+https://github.com/whaiman/remote-compiler.git#egg=remote-compiler[client]"

For the Build Node (Server): This provisions the Starlette/Uvicorn server dependencies.

pip install "git+https://github.com/whaiman/remote-compiler.git#egg=remote-compiler[server]"

Note: The core cryptography and configuration primitives (shared/) are automatically resolved in both pipelines.

Option 2: Local Source Installation

git clone https://github.com/whaiman/remote-compiler.git
cd remote-compiler

# Install specific domains:
pip install ".[client]"
pip install ".[server]"

1. Build Node Execution (Server)

On the dedicated compiling node, start the build server. Ensure gcc, g++, or clang are locally accessible in the system path.

rgcc-server

On the initial boot, the server drops a server_config.yaml file in the execution directory containing cryptographically secure credentials.

# server_config.yaml
server:
  auth_token: <auto-generated-url-safe-base64-token> # <-- Retain this string.
  host: 0.0.0.0
  port: 4444

# Cross-compilation & Compiler definitions
compilers:
  clang++:
    default_args: ["-fcolor-diagnostics"]
    platforms:
      win64:
        target: "x86_64-w64-mingw32" # Clang --target override
        sysroot: "/usr/x86_64-w64-mingw32" # Clang --sysroot definition
        args: ["-static", "-fuse-ld=lld", "-static-libgcc", "-static-libstdc++"]
  clang:
    platforms:
      win64:
        target: "x86_64-w64-mingw32"
        args: ["-static", "-fuse-ld=lld"] 
  # ... gcc / g++ toolchains ...

Warning

Security Policy Constraint: The server evaluates inbound compilation requests against an internal whitelist of compiler binaries (e.g., gcc, clang). Unrecognized toolchains passed by the client will implicitly fail payload execution to prevent Remote Code Execution (RCE).


2. Developer Node Execution (Client)

On the local machine, trigger a dummy run to generate client_config.yaml or scaffold it yourself.

Pre-Flight Configuration

Establish cryptographic trust by synchronizing the client to the build node:

  1. Map endpoint to the build server's resolvable IP or FQDN.
  2. Bind the auth_token derived from the server_config.yaml.
# client_config.yaml
client:
  endpoint: http://192.168.1.50:4444
  auth_token: <paste-token-from-the-server-here>

CLI Operations

Rapid Iteration

The CLI recursively tracks local headers and orchestrates the payload.

# Standard compilation using ambient platform defaults
rgcc compile sample/main.cpp

# Target specific output binaries and language standards
rgcc compile sample/main.cpp -o my_renderer --std c++20

# Override target heuristics for cross-compilation (linux -> win64)
rgcc compile sample/main.cpp --platform win64

Interactive Orchestration (-i)

Leverage the TUI to mutate toolchains dynamically and hydrate persistent configuration logic (build.json).

rgcc compile sample/main.cpp -i

Persistent State Management (build.json)

For complex topologies, declare state within a JSON-serialized manifest. Generate via rgcc init or interactive mode.

{
  "compiler": "clang++",
  "standard": "c++20",
  "entry_point": "sample/main.cpp",
  "output": "main.exe",
  "platform": "win64",
  "flags": ["-Wall", "-O3", "-static"],
  "defines": ["DEBUG=1"]
}

Note: Transient lifecycle attributes (SHA-256 checksum logic, UTC chron timestamps, recursive source graphs) are extrapolated natively at runtime to enforce deterministic payloads.

Pipeline Utilities

# Abstract syntax evaluation (no linkage)
rgcc compile sample/main.cpp --compile-only

# Local packaging validation (no wire transfer)
rgcc compile sample/main.cpp --dry-run

All resultant compilation artifacts (.out / .exe, SDTOUT logs, telemetry manifests) are automatically pipelined back to the developer node and extracted securely into the local dist/ directory (leveraging TarSlip mitigation).


Contributing

Contributions are welcomed via standard git workflows. By leveraging structural design patterns (SOLID) and Pythonic rigor, RGCC scales dynamically.

  1. Fork the repository
  2. Checkout your feature branch (git checkout -b feature/RefactorArchitecture)
  3. Commit discrete changes (git commit -m 'Adopt Domain-Driven Design for compiler backend')
  4. Push (git push origin feature/RefactorArchitecture)
  5. Open a Pull Request

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

You are free to use, modify, and distribute this software, but any modified version - including versions run over a network - must also be released under the AGPL-3.0 with its full source code made available. See the LICENSE file for details.

About

Remote compiler service, designed to run on mobile devices via Termux

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages