Languages: English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Français | Deutsch | Español | Italiano | Русский | العربية
Guide for building NeverC from source and setting up a local development environment.
- CMake 3.20+
- Ninja
- A C++17 host compiler (GCC, Clang, or MSVC)
cmake -S llvm -B build-neverc -G Ninja -C neverc/cmake/caches/NeverC.cmake
cmake --build build-neverc --target nevercccache / sccache is auto-detected and enabled if present.
--target neverc is the daily stage-1 build (empty embedded-runtime
placeholders). That is enough for most local compile/debug work. When you need
embedded string / mimalloc / std / NVK runtimes in the binary itself (or want a
CI-like compiler), run the stage-2 umbrella:
cmake --build build-neverc --target neverc-embed-runtime-bitcodeDetails of the two-stage bootstrap live in Builtins.
cmake -S llvm -B build-neverc -G Ninja -C neverc/cmake/caches/NeverC.cmake -DNEVERC_INCLUDE_TESTS=ON
cmake --build build-neverc --target check-neverccheck-neverc depends on neverc-embed-runtime-bitcode, so the first test run
bootstraps and relinks the compiler before CTest. You do not need to run the
embed target by hand.
After building, the neverc binary lives at build-neverc/bin/neverc. Instead of typing the full path every time, use the helper script to add it to your shell's PATH:
source ./utils/build/neverc-env.shNow you can run neverc directly:
neverc --version
neverc -c hello.c -o hello.oWhen you no longer need the local build on PATH, remove it in the same shell session:
source ./utils/build/neverc-env.sh --remove # or -rAutomatically write the source line to your shell rc file (~/.zshrc, ~/.bashrc, or ~/.profile):
source ./utils/build/neverc-env.sh --installTo undo:
source ./utils/build/neverc-env.sh --uninstallIf you have both a release install (default: ~/.neverc) and an in-tree build, use
neverc-env.sh to switch the active neverc in the current shell without
overwriting either installation:
source ./utils/build/neverc-env.sh # local dev (build-neverc/bin)
source ./utils/build/neverc-env.sh --local # same as above
source ./utils/build/neverc-env.sh --release # release install (~/.neverc/bin)
source ./utils/build/neverc-env.sh --status # show which neverc is active
source ./utils/build/neverc-env.sh --remove # remove both from PATHSwitching sets NEVERC_ENV to local or release:
echo "$NEVERC_ENV"
neverc --version
which nevercIf the release was installed to a custom prefix, pass the same directory as
install.sh uses:
NEVERC_INSTALL_DIR=$HOME/.neverc-v3389.1.2 source ./utils/build/neverc-env.sh --releaseOptional shell aliases (replace with your repository path):
alias neverc-dev='source /path/to/NeverC/utils/build/neverc-env.sh --local'
alias neverc-rel='source /path/to/NeverC/utils/build/neverc-env.sh --release'On Windows, use the .bat script instead (no admin required):
utils\build\neverc-env.bat &REM add to PATH (current session)
utils\build\neverc-env.bat --remove &REM remove from PATH (current session)
utils\build\neverc-env.bat --global &REM persist to user PATH via setx
utils\build\neverc-env.bat --global -r &REM remove from user PATH via setxUnlike the Unix script, no source is needed — the .bat modifies the current cmd session directly. The --global flag writes to the user-level registry via setx (no admin privileges needed).
The release is signed with an Apple Developer ID certificate and notarized by Apple. Extract the archive and use directly — no quarantine workaround needed.
NeverC bundles platform SDKs in runtime/ (Windows SDK/WDK, Linux sysroot, macOS sysroot, Android NDK); no external SDK setup is needed.
neverc --target=x86_64-pc-windows-msvc \
-fbuiltin-string -o hello.exe hello.c -lkernel32See dyncode compiler docs for Windows dyncode (-fdyncode, PEB import resolution, etc.).
neverc --version
echo 'int main(void) { return 0; }' > /tmp/hello.c
neverc -c /tmp/hello.c -o /tmp/hello.o