C Runtime
C runtime requirements, setup, and gotchas for poly-bench
This guide walks through using C with poly-bench, from init through run. It covers what gets created, how dependencies work, and common gotchas.
The C runtime requires clang — gcc is not supported. The table below summarizes the requirements.
| Requirement | Details |
|---|---|
| Binary | clang (not gcc) |
| Version | — |
| Verify | clang --version |
clang, not gcc. Install: brew install llvm (macOS), sudo apt install clang (Linux).When you run poly-bench init --languages c (or select C in the interactive flow), poly-bench creates a C project under .polybench/runtime-env/c/. The structure depends on whether you have external dependencies:
1.polybench/runtime-env/c/2└── main.cWith zero C dependencies, poly-bench compiles with clang directly and does not use CMake. When you add external dependencies, it switches to CMake plus a vcpkg manifest.
To add C dependencies, use the add command with the --c flag:
$poly-bench add --c openssl@3.2The spec format is package@version — for example, openssl@3.2. When you add C dependencies, poly-bench uses vcpkg and CMake. You need the following in place:
| Requirement | Details |
|---|---|
| vcpkg | Set VCPKG_ROOT or CMAKE_TOOLCHAIN_FILE |
| Default paths | ~/vcpkg, /opt/homebrew/share/vcpkg, etc. |
| CMake | 3.20+ on PATH |
For example, openssl maps to find_package(OpenSSL REQUIRED COMPONENTS SSL Crypto). vcpkg installs it; you do not need system OpenSSL if you are using vcpkg.
Running poly-bench install (or poly-bench build) runs CMake configure and build when C dependencies are present. With no dependencies, there is no install step — just compilation at run time.
When you run poly-bench run, the build behavior depends on your dependencies. With no C deps, poly-bench compiles with clang directly. With deps, it uses CMake and the vcpkg manifest to build.
brew install llvm (macOS), sudo apt install clang (Linux).openssl@3.2), poly-bench uses vcpkg + CMake. Requires VCPKG_ROOT or CMAKE_TOOLCHAIN_FILE.cmake must be on PATH.openssl maps to find_package(OpenSSL REQUIRED COMPONENTS SSL Crypto). vcpkg installs it; no system OpenSSL needed if using vcpkg.