Skip to main content Switch to mobile version gcc-env 0.5.0 Cross-platform GCC/C++ toolchain manager built on conda-forge and uv
pip install gcc-env Copy PIP instructions
A cross-platform GCC/C++ toolchain manager built on conda-forge and uv.
ge installs complete GCC toolchains into isolated prefixes under ~/.ge, gives each one a uv-managed Python build environment (CMake, Ninja, ...), and makes switching compilers a one-liner. It also takes care of the infamous libstdc++.so.6 / GLIBCXX_3.4.xx not found deployment problem.
$ ge setup $ ge create gcc13 --gcc 13.3.0 --use $ ge c++ -- -std=c++20 main.cpp -o app $ ge doctor Works natively on Linux, macOS, and Windows (MinGW-w64), and inside WSL like any other Linux distribution.
Why another toolchain manager?
Installing several GCC versions on one machine usually means fighting with the system compiler, ABI-incompatible libstdc++, and build scripts that cache CC. ge keeps everything self-contained:
Real GCC, not a shim. Compilers come from conda-forge's gcc_*/gxx_* packages. Linux uses the sysroot_linux-64 package (default glibc 2.17), so new compilers can still produce binaries for old distributions: the sysroot caps the glibc symbol versions a binary may need, while at run time the binary uses the target machine's own glibc (see Platform notes).
One prefix per version. ~/.ge/envs/ contains the conda toolchain and a separate uv virtual environment. Nothing is installed system-wide.
uv for build tooling. Each environment gets its own Python venv with cmake and ninja (configurable), installed by uv and isolated per GCC.
Portable output. ge c++ links the C++ runtime statically by default and ge bundle can produce a relocatable directory with libstdc++ next to your application instead of depending on the target machine.
Offline and cross-platform bundles. ge pack downloads a whole toolchain — for this machine or, with --platform, for another operating system — into one archive, and ge import installs it on a machine without network access.
Bare compiler names. After activation, c, cc, gcc, c++, and g++ are available directly (no ge prefix) through per-environment shims.
Explainable diagnosis. ge doctor compiles a probe, reads GLIBC_*, GLIBCXX_*, and CXXABI_* symbol requirements, compares them with the target glibc and the system libstdc++, and tells you exactly what will break.
No Python of your own is needed with the standalone installer: it brings a pinned CPython 3.12 from python-build-standalone and only needs sh plus curl or wget on Linux/macOS, or PowerShell 5.1+ with tar.exe (Windows 10 1803+) on Windows. Installing through pip, uv, or pipx instead needs Python 3.11+ to run ge itself.
Network access for the first bootstrap: conda-forge (the GCC toolchain), micro.mamba.pm (the micromamba release), GitHub (uv releases, the standalone installer's CPython and wheel, and — when uv has to download one — CPython builds), and pypi.org (the pip seed and build tools such as cmake/ninja). A machine without it can be set up from a ge pack archive made elsewhere: ge import needs no network at all (see Offline environments).
~1 GB disk space per toolchain (shared package caches reduce this)
ge uses the first micromamba and uv it finds: the GE_MICROMAMBA/ GE_UV variables, then a private copy in ~/.ge/bin, then PATH. Only when none of these provides the tool does it download the pinned release into ~/.ge/bin. You do not need conda, Mamba, or a system GCC installed.
ge is a Python package, so it installs like any other — but Python is only needed to run it, never to install it. Pick whichever fits the machine:
Standalone installer (no Python required)
Like uv's own installer, this one is self-contained: it downloads a pinned CPython from python-build-standalone (the same builds uv uses) and the gcc-env wheel from the latest GitHub Release, verifies both against SHA-256 digests before anything is extracted, and installs everything under ~/.ge/standalone with a launcher in ~/.local/bin:
# Linux / macOS / WSL curl -fsSL https://raw.githubusercontent.com/yulianjie/gcc-env/main/install.sh | sh # Windows, PowerShell 5.1 or later powershell -ExecutionPolicy Bypass -c "irm https://raw.githubusercontent.com/yulianjie/gcc-env/main/install.ps1 | iex" Then open a new shell and run:
ge --version ge setup Both scripts are also attached to every release and covered by its SHA256SUMS, so a mirror can serve them from https://github.com/yulianjie/gcc-env/releases/download/v / instead of main.
Running the installer again upgrades in place (a runtime of the same pin is reused, older ones are removed); ge update does the same without the script (see Updating and uninstalling). The installer takes no arguments (it is piped into sh/iex), so it is configured through environment variables:
GE_VERSION — the release to install: latest (default), 0.5.0, or v0.5.0.
GE_INSTALL_DIR — where the launcher goes (~/.local/bin, or $XDG_BIN_HOME).
GE_STANDALONE_DIR — where the runtime lives ($GE_ROOT/standalone).
GE_WHEEL — install this local wheel instead of downloading one.
GE_WHEEL_URL + GE_WHEEL_SHA256 — fetch the wheel from a mirror. An override without its checksum is refused before any network access, exactly like the bootstrap downloads below.
GE_PYTHON_ARCHIVE — use a local python-build-standalone install_only archive.
GE_PYTHON_URL + GE_PYTHON_SHA256 — fetch CPython from a mirror.
GE_ALLOW_INSECURE_BOOTSTRAP_URL — 1 allows non-https:// override URLs (isolated networks only).
GE_SSL_VERIFY — false skips TLS certificate verification for every download (mirrors behind self-signed certificates; isolated networks only).
GE_CA_BUNDLE — trust this PEM bundle instead of the system store.
GE_FORCE — 1 replaces a ge launcher that this installer did not create (for example one from uv tool install).
Local files are trusted as they are; the matching *_SHA256 variable checks them when set. Archives are cached in ~/.ge/cache/downloads, which ge clean --downloads empties. The launcher runs the runtime in Python's isolated mode (-I on Unix, a python._pth file on Windows), so a stray PYTHONHOME/PYTHONPATH — from uv run, an activated conda environment, an embedded-Python application — cannot break ge.
With uv, pipx, or pip (Python 3.11+)
Install as a standalone uv tool (recommended when uv is already on the machine):
uv tool install gcc-env Until the package is on PyPI, install directly from GitHub:
uv tool install "git+https://github.com/yulianjie/gcc-env" Or from a release wheel:
uv tool install ./gcc_env- -py3-none-any.whl Verify:
ge --version ge bootstrap Updating and uninstalling
ge manages its own installation, whichever of the ways above brought it onto the machine. It works out how it was installed from where the running ge lives, so the same two commands work everywhere:
ge update # upgrade gcc-env itself to the latest GitHub Release ge update --check # only report; exit status 1 when a release is available ge update 0.3.3 # install (or downgrade to) that release ge uninstall # remove the launcher, the package and the shell hook ge uninstall --purge # ... and every environment, cache and config.toml A standalone install is updated like the installer does it: the release's SHA256SUMS names the wheel and its digest, the wheel is downloaded (or taken from ~/.ge/cache/downloads when the digest matches), verified, and installed into the private runtime with its pip. The GE_WHEEL, GE_WHEEL_URL and GE_WHEEL_SHA256 variables steer this exactly as they steer the installer (a local wheel, a mirror). Nothing else under ~/.ge is touched, and the pinned CPython runtime stays.
uv tool, pipx and pip installs are handed to the tool that owns them: uv tool upgrade gcc-env (or uv tool install --force gcc-env==X for a specific release), pipx upgrade gcc-env and python -m pip install --upgrade gcc-env. The latest version is looked up first, so an up-to-date installation runs no package manager at all; if the lookup fails (no GitHub access, say) the package manager still gets to try.
ge update never touches environments or configuration, and the shell hook in your profiles needs no change after an update (it asks ge shell-init for the current code at every shell start). Running ge processes keep the previous version until they exit.
ge uninstall asks for confirmation (--yes for scripts; a non-interactive session without it is an error, exit 2). It removes the gcc-env block from every profile ge shell-init --install edits (or only from --profile PATH, for a hook installed into a custom profile), then the program itself. Environments, caches and config.toml under ~/.ge are kept unless --purge is given; --purge deletes only what ge created there (a GE_ROOT that holds other files keeps them, and a micromamba root configured outside GE_ROOT is never removed). Restart open shells afterwards: they still carry the ge() shell function.
Windows keeps the files of a running program locked, so a standalone ge cannot delete its own interpreter or launcher while it runs; ge uninstall hands those to a PowerShell that removes them about two seconds after ge exits and says so.
Bootstrap downloads are pinned and verified
When ge does have to download an engine, it fetches a pinned release — uv 0.13.10 and micromamba 2.10.0 by default — and verifies the archive against a SHA-256 digest before anything is extracted into ~/.ge/bin; a truncated or tampered download is deleted. To use a mirror or another release, set GE_UV_URL and/or GE_UV_VERSION (likewise GE_MICROMAMBA_*) together with the matching GE_UV_SHA256/GE_MICROMAMBA_SHA256: an override without a checksum is refused before any network access. Non-https:// URLs are refused as well unless GE_ALLOW_INSECURE_BOOTSTRAP_URL=1 (isolated networks only). TLS certificates are verified on every HTTPS request ge makes or delegates — its own downloads, uv's PyPI and managed-Python downloads and micromamba's conda-forge downloads; a mirror behind a self-signed certificate is served by GE_CA_BUNDLE or GE_SSL_VERIFY=false (see Self-signed certificates). ge config shows the effective pins, checksums, and overrides.
# Locate uv/micromamba, create "default" (GCC 14 on Linux/Windows, # GCC 15 on macOS) with Python 3.12 + cmake + ninja, and select it. ge setup # One-time shell integration: makes `ge activate` modify the current shell # directly instead of merely printing shell code. ge shell-init --install # Restart the shell (or source your profile), then: ge create gcc13 --gcc 13.3.0 ge activate gcc13 # Compiler names are now available without the `ge` prefix. c++ --version c++ -std=c++20 main.cpp -o app ge status ge deactivate ge activate also enables global activation by default: new shells that load the profile hook start with gcc13 active and show (gcc13) in the prompt. Use --session for a venv-style, current-shell-only activation. The prompt prefix is removed and the previous environment restored by ge deactivate; use deactivate --session to keep global activation enabled. ge status shows the shell, global, and default states.
ge activate must be able to modify the current shell. A normal executable cannot do that, so ge shell-init --install adds a small wrapper function to your profile (bash/zsh/fish/PowerShell). Without the hook, use the explicit fallback:
eval "$(ge activate gcc13)" The hook is idempotent and can be removed with ge shell-init --uninstall. ge deactivate restores the environment from before the first activation in that shell (it also removes the per-environment compiler shims from PATH).
PowerShell users can install/print the hook directly:
ge shell-init --install Invoke-Expression ((ge shell-init --shell powershell) -join [Environment]::NewLine) On Windows, ge shell-init --install writes both the PowerShell 7 profile (Documents\PowerShell\...) and the Windows PowerShell 5.1 profile (Documents\WindowsPowerShell\...). If ge activate still says “This shell has no gcc-env hook”, the current terminal predates the installation, or was started with -NoProfile. Close/reopen it, or initialize the current session with:
Invoke-Expression ((ge shell-init --shell powershell) -join [Environment]::NewLine) ge activate gcc13 More commands:
ge list ge use gcc13 ge shell ge run gcc13 -- cmake --version ge create gcc15 --gcc 15.2.0 # Linux only: choose a newer glibc/sysroot target. ge create gcc15-glibc228 --gcc 15.2.0 --sysroot 2.28 # Air-gapped machine, or another OS: download a whole toolchain into one # archive here, install it there without network access. ge pack --platform linux-64 --gcc 14 ge import gcc-14-linux-64.tar.gz ge also ships ge cc, ge gcc and ge g++ aliases. Advanced compiler flags for ge itself must come before the first compiler argument:
ge c++ --env gcc13 --runtime shared -- -O2 main.cpp -o app ge c++ --print-command -- -std=c++20 main.cpp -o app Commands
Use ge COMMAND --help for details. A few options deserve a note:
ge shell starts bash/zsh/fish without their startup files by default; --rc loads them, --shell picks the executable (bash, zsh, fish, sh, pwsh, powershell, cmd, or a path), and --quiet skips the banner.
ge activate/ge deactivate refuse to print code to an interactive terminal without the hook; --print-code prints it anyway (--shell selects the dialect). ge shell-init --profile PATH overrides the profile file that --install/--uninstall edit.
ge doctor --runtime and ge toolchain --runtime override the environment's policy for the probe/toolchain file; ge toolchain --output PATH selects the destination instead of ~/.ge/envs/NAME/ge-toolchain.cmake.
ge bundle --force replaces only bin/ and lib/ inside an existing destination and leaves every other file there untouched. The destination is refused when it is — or contains — your home directory, the current directory, a filesystem root, the gcc-env root, an environment directory, or the directory holding the binary.
ge clean removes what ge keeps on purpose; at least one selector is required: --downloads deletes ~/.ge/cache/downloads/*, --uv runs uv cache clean, --pkgs runs micromamba clean --all --yes (which is why ge remove suggests it), --python deletes interpreters under ~/.ge/python/ that no envs/*/venv/pyvenv.cfg references any more, --all does all of them, and --dry-run only lists what would go.
ge pack downloads for the target platform without installing anything here (ge pack NAME packs an installed environment from its own lock), and ge import installs the result on a machine without network access; see Offline environments.
~/.ge/ ├── bin/ # private micromamba and uv (downloaded only if not found) ├── cache/ │ ├── downloads/ # bootstrap archives for uv and micromamba │ └── uv/ # uv cache ├── python/ # uv-managed Python interpreters ├── standalone/ # private CPython + gcc-env written by install.sh / install.ps1 ├── mamba/ # micromamba root prefix and package cache ├── envs/ │ └── gcc13/ │ ├── conda/ # conda-forge GCC, binutils, sysroot, patchelf │ ├── venv/ # uv venv with cmake/ninja (per toolchain) │ ├── bin/ # c/cc/gcc/c++/g++ shims for bare compiler names │ ├── ge-toolchain.cmake # written by `ge toolchain` │ └── env.json # exact resolved versions, paths, and the explicit conda lock ├── state/ # per-shell activation snapshots for ge deactivate ├── active # name of the globally auto-activated environment ├── current # name of the selected environment ├── .lock # mutex held by commands that mutate ~/.ge └── config.toml # optional defaults ge create does three things:
Locates micromamba (GE_MICROMAMBA, ~/.ge/bin, PATH, or one pinned download) and runs a conda solve against conda-forge with an explicit toolchain package, for example on Linux:
gcc_linux-64=13.3.0 gxx_linux-64=13.3.0 sysroot_linux-64=2.17 patchelf The solved prefix is recorded in env.json (conda.packages and the reproducible micromamba list --explicit lock in conda.explicit).
Discovers the actual compiler executables from the prefix (including the target-prefixed names used by conda-forge).
Runs uv venv --seed --python 3.12 in venv/ and uv pip install cmake ninja for build tooling. Use --no-python if you only need the compiler.
Activation reconstructs a minimal, clean environment: it prepends the environment's shim directory, venv, and toolchain bin directories, exports CC/CXX/AR/LD/..., sets CMAKE_PREFIX_PATH and CONDA_BUILD_SYSROOT, and prepends the toolchain lib directory to the runtime loader path. It deliberately does not import conda-build's default -march=nocona/-O2 flags, so your project's flags remain yours.
The shim directory contains c, cc, gcc, c++, and g++ wrappers that delegate to ge cc / ge c++, so the bare compiler names respect the same runtime policy. ge shell-init --install is what lets ge activate/ge deactivate change the parent shell; without it, use eval "$(ge activate ...)".
Note that cc -v (and c++ -v) is GCC's verbose diagnostic flag and prints a large configuration dump by design. Use cc --version for a one-line version.
Global activation and prompts
ge activate NAME writes ~/.ge/active and updates the current shell. The installed shell hook auto-activates that environment in new shells, and (NAME) is prepended to the prompt. ge deactivate clears both the current shell state and ~/.ge/active. For a purely local activation:
ge activate gcc13 --session ge deactivate --session Set GE_NO_AUTO_ACTIVATE=1 in a shell to skip global auto-activation for that shell.
The (NAME) prefix is a plain PS1 prepend, so prompt frameworks that rebuild their prompt themselves (starship, powerlevel10k, ...) do not see it. For those, ge activate exports GE_PROMPT_MODIFIER — "(gcc13) " with a trailing space, unset again by ge deactivate:
# starship.toml [env_var.GE_PROMPT_MODIFIER] format = "[$env_value]($style)" style = "bold green" # bash: a custom PS1 that reads it at prompt time PS1='${GE_PROMPT_MODIFIER}\u@\h:\w\$ ' Without the shell hook (the eval fallback) nothing re-injects the session id, so ge activate exports GE_SESSION (a uuid) instead; its snapshot under ~/.ge/state/ is reclaimed by the 7-day expiry.
They solve different problems. conda-forge supplies the native GCC toolchain, binutils, sysroot, and runtime libraries; uv supplies isolated Python tooling and Python interpreters. Using uv alone cannot install native conda packages, and using conda alone would duplicate a Python environment per compiler without uv's speed and lockfile ecosystem. ge composes them.
The libstdc++.so.6 problem
A binary linked with GCC 13/14/15 may require GLIBCXX_3.4.32 (or newer), while the target machine's /usr/lib/.../libstdc++.so.6 only provides an older version. The usual results are:
./app: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found ./app: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.15' not found Setting LD_LIBRARY_PATH globally or shipping a newer libstdc++ "somewhere" often breaks other applications. ge gives you three explicit policies:
Choose per command or when creating the environment:
ge create gcc14 --gcc 14 ge create gcc14-shared --gcc 14 --runtime shared ge c++ --env gcc14 --runtime static -- main.cpp -o app ge c++ --env gcc14 --runtime shared -- main.cpp -o app-shared ge c++ --env gcc14 --runtime bundle -- main.cpp -o app-bundle ge doctor is the source of truth:
$ ge doctor gcc13 ✓ environment gcc13 (Linux x86_64) ✓ compiler: ~/.ge/envs/gcc13/conda/bin/x86_64-conda-linux-gnu-cc ✓ compiled a C++20 filesystem/format probe ✓ maximum GLIBC symbol: GLIBC_2.17 ✓ GLIBC requirements fit the target (2.17) ✓ no libstdc++.so.6 dependency (static runtime); portable across ... ✓ Python venv: .../venv/bin/python (3.12.3) ✓ uv-installed tool: cmake ✓ uv-installed tool: ninja ok doctor passed Inspect an existing binary instead of compiling a probe:
ge doctor gcc13 --binary ./app ge doctor gcc13 --binary ./app --target-glibc 2.17 --json ge doctor exits non-zero only on errors, making it usable in CI. It reports:
the maximum GLIBC_* requirement versus the sysroot target;
the maximum GLIBCXX_* / CXXABI_* requirement versus the system libstdc++ (on Linux);
MinGW runtime DLL dependencies on Windows;
missing Python/uv tooling.
The GLIBC_*/GLIBCXX_*/CXXABI_* requirements are read from the binary's version-needs section with readelf. When readelf is unavailable (or the section is missing), they are extracted heuristically from the raw bytes and may be higher than the real requirement, so ge doctor reports those lines as warn rather than ok, and --json carries version_source (readelf, raw-scan, or none).
The GLIBC_* check is the glibc counterpart of the libstdc++ problem, with one difference: unlike libstdc++, glibc cannot be shipped next to a binary. sysroot_linux-64 is a link-time target — its headers and libraries cap the glibc symbol versions the compiler emits (2.17 by default), which is why binaries built with ge run on any distribution with a newer glibc — but every binary still starts through the system's own ld-linux and libc.so.6, exactly like every conda-forge package. When the target machine's glibc is older than the symbols a binary needs, the fixes are an older --sysroot for the toolchain or a fully static link (ge c++ -- -static …, with the usual caveats: dlopen then does not work and NSS functions such as getaddrinfo still expect a matching glibc on the target), never a bundled libc.so.6.
Creating a portable bundle
ge c++ --env gcc13 --runtime bundle -- app.cpp -o app ge bundle ./app --env gcc13 --dest ./dist find ./dist # dist/bin/app # dist/lib/libstdc++.so.6 # dist/lib/libgcc_s.so.1 ge bundle copies the binary into bin/ and then the transitive closure of its dependencies — DT_NEEDED on ELF, LC_LOAD_DYLIB on Mach-O, the import table on PE — into lib/ (next to the .exe on Windows), re-inspecting every copied library so nothing is missed. System libraries (glibc, libc++, the Windows system/UCRT DLLs) are the boundary. Each copied library gets its RPATH/install name rewritten to point at its siblings: $ORIGIN on Linux, @rpath/ plus @loader_path on macOS. A non-system dependency that is not in the environment is reported with a warn and must be provided by the target system.
On Linux, ge bundle uses patchelf (installed in the environment) to replace the absolute development RPATH with $ORIGIN/../lib. On macOS it uses install_name_tool and ad-hoc codesigning when available. On Windows it copies the required MinGW DLLs next to the .exe. --force replaces only bin/ and lib/ inside an existing destination (see Commands).
ge toolchain writes a CMake toolchain file with the compiler paths, static runtime flags, prefix paths, and a relative install RPATH for bundle builds:
ge toolchain gcc13 # ~/.ge/envs/gcc13/ge-toolchain.cmake ge run gcc13 -- cmake -S . -B build \ -DCMAKE_TOOLCHAIN_FILE=$HOME/.ge/envs/gcc13/ge-toolchain.cmake ge run gcc13 -- cmake --build build The environment's venv provides cmake and ninja, so no system CMake is required. The static flags go into CMAKE_EXE_LINKER_FLAGS_INIT and CMAKE_MODULE_LINKER_FLAGS_INIT; CMAKE_SHARED_LINKER_FLAGS_INIT stays empty for the same reason -shared targets get no static runtime (see above).
Optional ~/.ge/config.toml (all timeouts are in seconds):
[defaults] gcc = "14" sysroot = "2.17" # Linux only; "none" to use the default sysroot python = "3.12" runtime = "static" # static | shared | bundle tools = ["cmake", "ninja"] channels = ["conda-forge"] mamba_root = "~/.ge/mamba" # default: /mamba download_timeout = 60 # bootstrap downloads (GE_DOWNLOAD_TIMEOUT) solve_timeout = 3600 # conda solve; `ge create` holds the lock meanwhile (GE_SOLVE_TIMEOUT) venv_timeout = 900 # each uv venv / uv pip install step (GE_VENV_TIMEOUT) ssl_verify = true # false skips TLS certificate verification (GE_SSL_VERIFY) Common environment variables (they override config.toml):
GE_ENV, GE_GCC_VERSION, GE_ACTIVE, GE_SHELL and GE_SESSION are set by ge and the shell hook rather than by you, and need no configuration: GE_ENV/GE_GCC_VERSION name the active environment and compiler, GE_ACTIVE=1 marks an activated shell (a non-exported shell variable in POSIX shells), GE_SHELL names the shell dialect — injected per call by the hook, or set manually to override detection for ge activate/ge deactivate/ge shell-init — and GE_SESSION identifies the shell's snapshot under ~/.ge/state/: the shell's pid, injected for the call only and never exported, in hook mode; an exported uuid in the eval fallback.
ge passes channels explicitly and uses --no-rc, and it strips every CONDA_*/MAMBA_* variable (CONDA_SUBDIR, CONDA_SOLVER, CONDA_OVERRIDE_*, ...) from the solver's environment, so neither a user .condarc nor an activated conda shell can silently change the solve. Point it at a mirror explicitly:
GE_CONDA_CHANNELS="https://mirrors.example.edu/conda-forge,conda-forge" ge create gcc13 Self-signed certificates (intranets and TLS-inspecting proxies)
Every HTTPS request ge makes or delegates verifies the server's certificate: its own bootstrap downloads, the PyPI metadata, wheels, interpreter and engine archives that ge pack fetches, uv's PyPI and managed-Python downloads, micromamba's conda-forge downloads, and the standalone installers. On a network whose proxy or mirror presents a self-signed or privately issued certificate, either trust the issuer — the preferred fix, since everything stays verified:
GE_CA_BUNDLE=/etc/corp-ca/ca-bundle.pem ge setup or, on an isolated network only, skip verification altogether:
GE_SSL_VERIFY=false ge setup Both apply to uv and micromamba automatically: ge exports UV_INSECURE_HOST=* or SSL_CERT_FILE for uv and MAMBA_SSL_VERIFY=false or the bundle path for micromamba, which --no-rc does not silence. They persist in config.toml (ca_bundle = "/etc/corp-ca/ca-bundle.pem", ssl_verify = false) for ge, the installers read the same variables, and ge config prints the policy under tls verify / ca bundle. A warning is printed whenever verification is off. The pinned SHA-256 digests still protect the bootstrap archives when TLS is not verified; only the identity of the server is then unproven. The bundle is the whole trust store for ge, uv, micromamba, curl and wget, so include public roots in it if the machine also reaches PyPI or conda-forge directly (the Windows installer adds it to the system store instead). Note that uv never consults the operating system's trust store by default (UV_SYSTEM_CERTS=true opts in), so a CA installed there is not enough for uv pip install.
ge create needs network access on the machine that runs it: micromamba fetches repodata and the conda packages, uv fetches the interpreter and the wheels. ge pack moves all of that work to a machine that has network access and produces one archive that ge import installs on a machine that has none — an air-gapped server, a container build, a classroom. It also works across operating systems, because nothing is extracted while packing: a Windows machine can pack a Linux toolchain it could never run.
# Anywhere with network access: resolve GCC 14 with the glibc 2.17 sysroot for # Linux x86_64 and download everything (roughly 200 MB) into one archive. ge pack --platform linux-64 --gcc 14 --sysroot 2.17 # gcc-14-linux-64.tar.gz # Or pack an installed environment exactly as it is locked: its conda-meta # records carry the package URLs and digests, and cached tarballs are reused. ge pack gcc13 # On the target machine, which only needs `ge` itself: ge import gcc-14-linux-64.tar.gz ge use gcc-14 The archive holds one directory:
gcc-14-linux-64/ ├── bundle.json # manifest: platform, specs, and every file with its SHA-256 ├── explicit.txt # the micromamba explicit lock ( # ) for reference ├── pkgs/ # conda packages, exactly as conda-forge serves them ├── python/ # the standalone CPython build for the target platform ├── wheels/ # cmake, ninja — whatever --tools lists — for that platform └── engines/ # micromamba and uv for the target platform ge pack resolves the target platform's toolchain with micromamba create --dry-run --json --platform and downloads every package, checking it against the SHA-256 from the solution. It asks uv which interpreter it would use for --python on that platform and downloads that build; it resolves --tools with uv pip compile for the target's wheel tags and fetches the matching wheels from PyPI; and it adds the pinned micromamba and uv archives for the target platform. --platform takes a conda subdir (linux-64, linux-aarch64, osx-64, osx-arm64, win-64) and defaults to this machine. --gcc, --sysroot, --runtime and --tools mean what they mean for ge create, with the target platform's defaults (GCC 15 and no sysroot on macOS, for instance). -o picks the archive (a .zip suffix writes a zip file, a directory receives the default name) and --name the environment name recorded in it; --no-python leaves out the interpreter and wheels, --no-engines the micromamba/uv archives.
The packing machine reaches conda-forge, PyPI and GitHub with the same settings as ge create: GE_CONDA_CHANNELS points the dry-run solve at a conda mirror, uv's own UV_DEFAULT_INDEX points uv pip compile at a PyPI mirror, and a proxy or mirror behind a self-signed certificate is handled by GE_CA_BUNDLE / GE_SSL_VERIFY like every other download (see Self-signed certificates). ge import needs none of these: it never opens a connection.
ge import (alias ge unpack) needs no network access:
It reads bundle.json from the archive (an already extracted directory works too) and refuses a bundle packed for another platform before extracting anything — conda toolchains are platform-specific.
It extracts the archive and verifies every file against the SHA-256 digests in bundle.json; a missing or damaged file stops the import before anything is installed.
It installs micromamba and uv from engines/ into ~/.ge/bin when the machine has neither, after checking them against the same pinned digests ge setup uses.
It builds the conda prefix with micromamba create --offline from the packaged archives, discovers the compiler and writes env.json exactly like ge create, explicit lock included, so the environment is indistinguishable from a created one.
It creates the venv from the bundled interpreter and installs the tools from the bundled wheels with uv pip install --no-index. The venv is not seeded with pip, setuptools and wheel (that would be three more downloads); add them with uv pip install pip if the machine ever gets network access.
--name installs under another name, --no-python skips the venv, --use selects the environment, and --force replaces an existing one transactionally like ge create --force. The imported interpreter lives in ~/.ge/envs/NAME/python/, so ge remove reclaims it with the environment.
A Linux bundle needs a glibc system on the target (glibc 2.17 or newer, the same floor as the pinned micromamba); Alpine and other musl systems are not supported. The interpreter archive is the one file whose digest ge records rather than verifies — uv does not publish it separately — so its SHA-256 in bundle.json reflects what was downloaded over HTTPS at pack time and is checked on import. Every other file is verified against the solver's or PyPI's digest while packing and again while importing.
Default sysroot: glibc 2.17, the conda-forge default, for broad compatibility. Use --sysroot 2.28 or 2.39 when you need newer glibc APIs. The sysroot is used at compile and link time only: conda-forge packages, and therefore everything built with ge, run against the target machine's own glibc, which must be at least that version.
Native x86_64 and aarch64 are supported.
glibc distributions only: the pinned micromamba and the standalone installer's CPython are glibc builds, so Alpine and other musl systems are not supported (use a glibc container).
WSL is a normal Linux platform; the same commands work unchanged.
conda-forge's native GCC packages start at 15.2, so the default is GCC 15. Use --gcc 15.2.0 or newer explicitly; older GCC versions are not available for macOS from conda-forge.
arm64 and x86_64 are supported.
The static runtime policy is the default. conda-forge's GCC links against the system libc++ (there is no conda libstdc++ on macOS), so static only adds -static-libgcc here. ge doctor does not flag libc++.1.dylib; it only warns when libstdc++.6.dylib (a non-default runtime) or libgcc_s dylibs remain.
ge bundle works for dynamically linked applications; install_name_tool and codesign require Xcode command line tools.
Native MinGW-w64 (UCRT) GCC is installed from gcc_win-64/gxx_win-64. This is not MSVC: it produces native Windows executables with the MinGW ABI.
x86_64 only. Use WSL to run a Linux toolchain on Windows (on Windows on ARM that is the only way). Packing a Linux toolchain for another machine works natively on any Windows host, though: ge pack --platform linux-64 (or linux-aarch64) downloads without extracting anything, and the archive is imported on the Linux machine with ge import (see Offline environments).
The default static runtime produces an .exe whose only imports are Windows UCRT functions, making it easy to distribute.
ge shell starts PowerShell (or cmd if PowerShell is unavailable) with the environment applied. ge activate --shell powershell prints code for Invoke-Expression.
The standalone installer needs PowerShell 5.1+ and tar.exe (Windows 10 1803+). Its ge.exe is the launcher pip generates, so no .cmd wrapper is involved; x86_64 only, as above.
ci.yml: unit tests on Linux/macOS/Windows and Python 3.11–3.13, lint, build, real toolchain integration tests on Linux and platform smoke tests on macOS/Windows, plus the standalone installer: on all three operating systems against the freshly built wheel (followed by ge update --force and ge uninstall --purge on that install), and inside a debian:bookworm-slim container that has no Python at all against the real latest release.
release.yml: on a v* tag, builds an sdist and wheel, verifies the wheel, creates a GitHub Release with the artifacts, install.sh/install.ps1 and SHA-256 checksums, smoke-tests both installers against that fresh release, and can optionally publish to PyPI when the PYPI_PUBLISH repository variable and PYPI_API_TOKEN secret are configured.
Build agents without network access follow the same split: run ge pack on a connected machine or CI stage, ship the archive, and ge import it on the agent; the imported environment is indistinguishable from a created one (see Offline environments).
Create a release (the version lives in src/gcc_env/__init__.py and is read from there by hatchling):
git tag v git push origin v Development
git clone https://github.com/yulianjie/gcc-env cd gcc-env uv sync --dev uv run pytest -m "not integration" uv run ruff check src tests uv run pytest -m integration # network + several hundred MB The integration tests create real environments (ge-it-*) under ~/.ge and remove them afterward; they also run install.sh/install.ps1 end to end against a scratch GE_ROOT. GE_INTEGRATION_ROOT exists only for them: it points the integration tests at another root (falling back to GE_ROOT) and is not read by ge itself.
src/gcc_env/ ├── __init__.py # package metadata; the single source of the version ├── __main__.py # `python -m gcc_env` ├── cli.py # argparse CLI and manual parsers for cc/c++/run ├── config.py # ~/.ge layout, config.toml, defaults and timeouts ├── platforms.py # platform/arch detection; conda and uv target names ├── errors.py # exception types with user-facing exit codes ├── util.py # terminal output, safe extraction, downloads, file lock ├── bootstrap.py # pinned micromamba/uv lookup, download, SHA-256 check ├── conda.py # micromamba wrapper: isolated, --no-rc conda solve ├── uvtools.py # uv venv + pip integration with isolated caches ├── compiler.py # conda specs, compiler discovery, runtime link flags ├── envs.py # env.json metadata; transactional create/remove/use ├── activation.py # toolchain environment variables and shell snippets ├── shellinit.py # shell hook rendering and profile install/uninstall ├── state.py # per-shell activation snapshots and their pruning ├── runtime.py # ELF/PE/Mach-O inspection, ge doctor ├── bundle.py # relocatable bundling: dependency closure, RPATH rewrite ├── cmake.py # CMake toolchain generation ├── clean.py # ge clean: reclaim caches and orphaned interpreters ├── pack.py # ge pack / ge import: offline bundles, manifest, archive └── selfmanage.py # ge update / ge uninstall: install-method detection, wheel update, removal Limitations
Each environment owns a full toolchain prefix; this is intentional isolation, not a lightweight multiplexer. Package caches are shared.
The standalone runtime under ~/.ge/standalone is private to ge: ge create still downloads the venv's CPython into ~/.ge/python, so a standalone install costs one extra ~30 MB interpreter. ge update replaces the gcc-env package inside that runtime but keeps the pinned CPython it was installed with; run the installer again to move to a newer runtime pin.
The Python venv is optional (--no-python), but ge doctor tool checks and ge toolchain CMake/Ninja convenience depend on it.
A statically linked libstdc++ is excellent for executables, but shared libraries and plugin boundaries may require shared/bundle instead.
glibc itself is still a system dependency on Linux. The 2.17 sysroot gives broad compatibility, but it cannot make a binary work on a machine older than that glibc.
macOS GCC from conda-forge is newer than the usual Homebrew GCC versions; Apple's Clang remains the platform default for Apple-specific frameworks.
ge pack bundles are platform-specific, a Linux bundle needs glibc 2.17 or newer on the target machine, and an imported venv lacks the pip, setuptools and wheel seed packages (see Offline environments).
c++ conda-forge g++ gcc libstdc++ toolchain uv
Development Status 4 - Beta
Intended Audience Developers
License OSI Approved :: MIT License
Topic Software Development :: Build Tools
System :: Software Distribution
Release files for gcc-env 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 371.4 kB
Release files / gcc_env-0.5.0.tar.gz
Release files / gcc_env-0.5.0-py3-none-any.whl
Security for gcc-env 0.5.0
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 2, 2026 2 release files No provenance
Dec 1, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




