cpp

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2026 License: GPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cpp provides a C++ builder that uses system-installed g++ and clang++ compilers.

Unlike other builders that download compiler toolchains, this package discovers compilers already present on the host (e.g. /usr/bin/g++-13, /usr/bin/clang++-18) and mounts them into the sandbox for compilation.

Version IDs follow the format "g++<semver>" or "clang++<semver>", for example "g++13.3.0" or "clang++18.1.3". The default version is "g++13.3.0".

Import this package for its side effects to register the builder:

import _ "github.com/Highload-fun/builders/cpp"

Index

Constants

View Source
const BuilderId = "cpp"

BuilderId is the identifier used to register and look up this builder.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cpp

type Cpp struct {
	// contains filtered or unexported fields
}

Cpp implements the builders.Builder interface for C++ using system-installed g++ and clang++ compilers.

func (*Cpp) Build

func (c *Cpp) Build(ctx context.Context, sb *sandbox.Sandbox, version string, flags []string) error

Build compiles main.cpp inside the sandbox using the specified compiler version. If version is empty, "g++13.3.0" is used. If flags is empty, "-O2 -std=c++17" is used. The compiled binary is written to /out/main.

func (*Cpp) GetVersions

func (c *Cpp) GetVersions(_ context.Context) ([]builders.Version, error)

GetVersions discovers available C++ compilers by scanning /usr/bin for g++-* and clang++-* binaries, running --version on each to extract the version string. Results are cached for 1 hour.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL