-
Notifications
You must be signed in to change notification settings - Fork 360
Supported Compilers
Bear recognizes compiler executables by filename pattern matching. Recognized
compilers get their command-line flags parsed and classified so that Bear can
produce accurate compile_commands.json entries.
-
Versioned names:
gcc-11,clang-17,icx-2024 -
Cross-compilation prefixes:
arm-linux-gnueabihf-gcc,aarch64-linux-gnu-clang -
Windows
.exeextension:gcc.exe,cl.exe,clang-cl.exe -
Compiler wrappers:
ccache,distcc,sccacheare unwrapped transparently
| Family | Executables | Versioned | Cross-prefix | Extends | Platforms |
|---|---|---|---|---|---|
| GCC |
gcc, g++, cc, c++, gfortran, egfortran, f95
|
yes | yes | - | Linux, macOS, BSDs, Windows/MinGW |
| Clang |
clang, clang++
|
yes | yes | GCC | Linux, macOS, BSDs, Windows, Android |
| MSVC | cl |
no | no | - | Windows |
| clang-cl | clang-cl |
yes | no | MSVC | Windows, Linux (cross) |
| Intel C/C++ |
icx, icpx, icc, icpc
|
yes | no | Clang | Linux |
| Intel Fortran |
ifort, ifx
|
yes | no | - | Linux, Windows |
| NVIDIA CUDA | nvcc |
yes | yes | GCC | Linux, Windows |
| NVIDIA HPC SDK |
nvc, nvc++, nvfortran, pgcc, pgc++, pgfortran
|
yes | no | - | Linux |
| Flang |
flang, flang-new
|
yes | yes | GCC | Linux |
| ARM Compiler 6 |
armclang, armclang++
|
yes | no | Clang | Linux |
| IBM Open XL |
ibm-clang, ibm-clang++, xlclang, xlclang++
|
yes | no | Clang | Linux (ppc64le) |
| Cray Fortran |
crayftn, ftn
|
yes | no | - | Linux (Cray) |
Extends means the compiler inherits all flag definitions from the parent. For example, Intel C/C++ inherits all Clang flags (which in turn inherits all GCC flags), then adds Intel-specific flags on top.
If your compiler is not listed above, or uses a non-standard executable name, you can tell Bear about it in a configuration file:
schema: "4.1"
compilers:
- path: /opt/custom/bin/my-cc
as: gcc
- path: /usr/local/bin/zapcc++
as: clangThe as field accepts: gcc, clang, msvc, clang-cl, intel_cc,
intel_fortran, cuda, nvidia_hpc, flang, armclang, ibm_xl,
cray_fortran.
Bear transparently handles these compiler wrappers:
-
ccache- compiler cache -
distcc- distributed compilation -
sccache- shared compilation cache
When Bear sees ccache gcc -c foo.c, it records the gcc -c foo.c part.
To exclude a specific compiler from the output:
schema: "4.1"
compilers:
- path: /usr/bin/gcc
ignore: trueThe generic names cc and c++ point to different compilers depending on the
operating system:
| Platform |
cc is typically |
c++ is typically |
|---|---|---|
| Linux (most distros) | GCC | GCC |
| macOS | Apple Clang | Apple Clang |
| FreeBSD | Clang | Clang |
| OpenBSD | Clang | Clang |
| NetBSD | GCC | GCC |
Bear defaults to treating cc/c++ as GCC. On platforms where they are
actually Clang, add a configuration hint:
schema: "4.1"
compilers:
- path: /usr/bin/cc
as: clang
- path: /usr/bin/c++
as: clangThis ensures clang-specific flags are parsed correctly. Most common flags
are shared between GCC and Clang, so the default usually works. The config
hint matters when clang-only flags like -fcolor-diagnostics or
-Wno-unused-command-line-argument are used.
User guide
Understanding Bear
Project