Back to Bear

Supported compilers

site/src/reference/supported-compilers.md

4.2.015.5 KB
Original Source
<!-- Diataxis type: reference -->

Supported compilers

Bear decides whether an intercepted command is a compilation by matching the name of the executable the build ran against a table of known compiler names. A name it does not know is not a compiler, and Bear does not run the program to guess otherwise. The one exception is a short list of names that are genuinely ambiguous across platforms, and Ambiguous names below says which and why. Once a name matches, the command line is parsed with that family's own flag rules, since GCC, MSVC, and Swift (to pick three) do not agree on how to spell an include path or an output file. This page explains how that matching works and lists the names it currently covers; the configuration keys that let you extend or correct it are in the bear(1) man page and explained in Configure Bear.

Cross-compiler prefixes and version suffixes

A handful of core families are recognized under more than their plain name. GCC and Clang (and, following the same pattern, CUDA's nvcc, Flang, and Vala's valac) are also recognized with a cross-compilation target prefix (arm-linux-gnueabihf-gcc, aarch64-linux-gnu-clang), a version suffix (gcc-12, clang-15), or both together (arm-linux-gnueabi-gcc-12). Every such spelling is parsed with its base name's flag rules. Support for this varies by family: it is not a blanket rule applied to every entry in the table below.

Compiler launchers

ccache, sccache, distcc, and icecc wrap a real compiler invocation rather than compiling anything themselves. Bear recognizes each launcher by name, finds the real compiler among its arguments, and records the compilation as if the launcher were not there: ccache gcc -c main.c is recorded as a gcc invocation, not a ccache one. A launcher invocation whose argument is not a recognized compiler (ccache make all), or that wraps another launcher (ccache distcc gcc -c main.c), produces no entry; Bear does not chase a chain of launchers. distcc's own options (-j, --jobs, -v, and similar) are skipped while looking for the compiler, so they never get mistaken for one.

MPI compiler wrappers

mpicc, mpicxx, mpifort, and the vendor-specific MPI wrappers (Intel's mpiicc, mpiifort, and similar) are recorded as invoked, not expanded to the compiler they wrap. Clang tooling that needs a wrapper's baked-in include paths can point at the wrapper directly, for example with clangd's --query-driver. An information-only invocation (mpicc -showme, -show, -compile_info, -link_info) produces no entry, and a wrapper option that carries a value (MPICH's -cc=gcc) never swallows a following source file.

Ambiguous names

cc, c++, and the HPE Cray PrgEnv wrapper CC are not in the name table at all, because the same basename is a different compiler depending on the platform or the loaded environment module (GCC on most Linux distributions, Clang on the BSDs and macOS, whatever the loaded programming environment selects on a Cray system). Bear classifies these by running the executable once with --version and caching the result; a compilers: entry in the configuration (see below) skips the probe and forces a classification when its output does not match a known signature.

as and ignore hints

A compilers: entry in the configuration names a path and either an as value (the family to parse it with) or ignore: true (drop its invocations entirely). Reach for it when a compiler sits at a path or under a name the table below does not cover, or when a generic name is misclassified. The generic names cc and c++ are the usual reason to add an entry, since not every custom build of GCC or Clang answers --version in a way the probe recognizes.

An as value is a family identifier, not a display name: it is the short, lower-case id given as each family's "Configuration as: value" below, spelled verbatim. There are no aliases, so as: gcc is accepted while as: GCC is not, and several families share one id (icx and icc are both intel_cc). The accepted ids are the ones in the family tables below, which are generated from the compiler definitions, plus wrapper for a compiler launcher. This page does not repeat them here as a list: the tables are the copy that cannot drift. An unaccepted value is rejected when the configuration loads, with an error listing every value that would have worked, and bear semantic --print-compilers prints the same mapping for the version you have installed.

Recognized families

Internal jobs that a driver spawns for itself are recognized only so Bear can filter them back out: they are never user-facing invocations and never produce a database entry. The tables below label each one as internal, separately from the family's real, user-facing names.

The compiler launchers share one kind rather than a compiler family, so wrapper, or any launcher's own name from the launcher table below, selects it.

<!-- BEGIN GENERATED: scripts/generate-supported-compilers.py -- DO NOT EDIT. Edits inside this block are lost the next time the script runs. -->

Compiler families

armclang

Configuration as: value: armclang.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
armclang, armclang++Arm Compiler 6armclang-12not recognizeddeveloper.arm.com

clang

Configuration as: value: clang.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
clang, clang++Clangclang-12arm-linux-gnueabihf-clangclang.llvm.org
amdclang, amdclang++, hipccAMD ROCm Clang/HIPnot recognizednot recognizedrocm.docs.amd.com
emcc, em++, emcc.py, em++.pyEmscriptennot recognizednot recognizedemscripten.org
tiarmclangTexas Instruments Arm Clangnot recognizednot recognizedti.com

An invocation is also ignored when its arguments include -cc1: that is an internal frontend or codegen call, not a user-facing compile.

clang_cl

Configuration as: value: clang_cl.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
clang-clClang (MSVC mode)clang-cl-12not recognizedclang.llvm.org

cray_cc

Configuration as: value: cray_cc.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
craycc, crayCC, craycxxCray C/C++craycc-12not recognizedsupport.hpe.com

cray_fortran

Configuration as: value: cray_fortran.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
crayftn, ftnCray Fortrancrayftn-12not recognizedsupport.hpe.com

cuda

Configuration as: value: cuda.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
nvccNVIDIA CUDAnvcc-12arm-linux-gnueabihf-nvccdocs.nvidia.com

fasm

Configuration as: value: fasm.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
fasmflat assemblernot recognizednot recognizedflatassembler.net

flang

Configuration as: value: flang.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
flang, flang-newFlangflang-12arm-linux-gnueabihf-flangflang.llvm.org
amdflangAMD ROCm Flangnot recognizednot recognizedrocm.docs.amd.com

gcc

Configuration as: value: gcc.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
gcc, g++, gfortran, egfortran, f95GCCgcc-12arm-linux-gnueabihf-gccgcc.gnu.org
xc8-cc, xc8Microchip XC8not recognizednot recognizedmicrochip.com

Internal, not user-facing: cc1, cc1plus, cc1obj, cc1objplus, f951, collect2, lto1. Bear recognizes these only so it can filter them back out; they never produce a database entry.

ibm_xl

Configuration as: value: ibm_xl.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
ibm-clang, ibm-clang++IBM Open XL C/C++ibm-clang-12not recognizedibm.com
xlclang, xlclang++IBM XL C/C++xlclang-12not recognizedibm.com

intel_cc

Configuration as: value: intel_cc.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
icx, icpxIntel oneAPI C/C++icx-12not recognizedintel.com
icc, icpcIntel C++ Compiler Classicicc-12not recognizedintel.com
mpiicc, mpiicpc, mpiicx, mpiicpxIntel MPI C/C++ wrappernot recognizednot recognizedintel.com

intel_fortran

Configuration as: value: intel_fortran.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
ifort, ifxIntel Fortranifort-12not recognizedintel.com
mpiifort, mpiifxIntel Fortran MPI wrappernot recognizednot recognizedintel.com

mpi

Configuration as: value: mpi.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
mpicc, mpicxx, mpic++, mpiCC, mpifort, mpif77, mpif90MPI compiler wrappermpicc-12not recognizedopen-mpi.org, mpich.org

msvc

Configuration as: value: msvc.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
clMicrosoft Visual C++not recognizednot recognizedlearn.microsoft.com

Internal, not user-facing: c1, c1xx, c2. Bear recognizes these only so it can filter them back out; they never produce a database entry.

nasm

Configuration as: value: nasm.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
nasm, yasmNASM / YASM assemblernot recognizednot recognizednasm.us, github.com

nvidia_hpc

Configuration as: value: nvidia_hpc.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
nvc, nvc++, nvfortranNVIDIA HPC SDKnvc-12not recognizeddocs.nvidia.com
pgcc, pgc++, pgfortranPGI (legacy NVIDIA HPC)pgcc-12not recognizeddocs.nvidia.com

qnx

Configuration as: value: qnx.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
qcc, q++QNX qccnot recognizednot recognizedqnx.com

swift

Configuration as: value: swift.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
swiftcSwiftnot recognizednot recognizedswift.org

Internal, not user-facing: swift-frontend. Bear recognizes these only so it can filter them back out; they never produce a database entry.

An invocation is also ignored when its arguments include -frontend: that is an internal frontend or codegen call, not a user-facing compile.

vala

Configuration as: value: vala.

Executable namesRecognized asVersion suffixCross-compilation prefixDocumentation
valacValavalac-12arm-linux-gnueabihf-valacvala.dev

Compiler launchers

Executable nameRecognized asConfiguration as: valueDocumentation
ccacheCompiler cacheccacheccache.dev
distccDistributed compilerdistccdistcc.org
iceccDistributed compilericeccgithub.com
sccacheCompiler cachesccachegithub.com
<!-- END GENERATED -->

This list is kept in step with Bear's own compiler definitions, and grows by request as users bring toolchains that are not covered yet; it is not a fixed set.

What is not recognized

A few names are excluded on purpose, not by oversight:

  • as (the GNU assembler): GCC and Clang already spawn it on a temporary file for every ordinary compile, so recognizing it would add a throwaway entry per compilation, keyed on a name that differs every run.
  • mpirun, mpiexec: these launch programs, they do not compile anything.
  • swift: this is the Swift subcommand dispatcher (swift build, swift run); the actual compiler invocation is swiftc.
  • amdgpu-arch: reports target GPU architectures; despite the shared prefix, it is not a compiler driver.
  • ml, ml64 (MASM): not currently supported.

None of these can be recovered with a compilers: override, because as only redirects a path to one of the families already in the tables above; it cannot teach Bear a new one. If your build uses a toolchain that genuinely is not covered anywhere in this page, that is a gap in Bear's compiler definitions, not a configuration problem: it is worth filing as an issue against the project.

See also: Configure Bear for the compilers: section in full, and How Bear works for where recognition fits between interception and writing the database.