1BEAR(1)                                                                BEAR(1)
2
3
4

NAME

6       Bear - a tool to generate compilation database for Clang tooling.
7

SYNOPSIS

9       bear [options] -- [build command]
10

DESCRIPTION

12       The  JSON compilation database <http://clang.llvm.org/docs/JSONCompila
13       tionDatabase.html> is used in Clang project to provide information  how
14       a  single  compilation unit was processed.  When that is available then
15       it is easy to re-run the compilation with different programs.
16
17       Bear executes the original build command and intercept the command exe‐
18       cutions  issued  by the build tool.  From the log of command executions
19       it tries to identify the compiler calls and creates the final  compila‐
20       tion database.
21

OPTIONS

23       --version
24              Print version number.
25
26       --help Print help message.
27
28       --verbose
29              Enable verbose logging.
30
31       --output file
32              Specify  output  file.  (Default file name provided.) The output
33              is a JSON compilation database.
34
35       --append
36              Use previously generated output file and append the new  entries
37              to  it.  This way you can run Bear continuously during work, and
38              it keeps the compilation database up to date.  File deletion and
39              addition are both considered.  But build process change (compil‐
40              er flags change) might cause duplicate entries.
41
42       --config file
43              Specify a configuration file.  The configuration  file  captures
44              how  the  output  should be formatted and which entries it shall
45              contain.
46
47       --force-preload
48              Force to use the dynamic linker method of intercept command.
49
50       --force-wrapper
51              Force to use the compiler wrapper method of intercept command.
52

OUTPUT

54       The JSON compilation database definition changed over time.   The  cur‐
55       rent version of Bear generates entries where:
56
57       directory
58              has absolute path.
59
60       file   has absolute path.
61
62       output has absolute path.
63
64       arguments
65              used instead of command to avoid shell escaping problems.  (Con‐
66              figuration can force to emit the command field.) The compiler as
67              the  first argument has absolute path.  Some non compilation re‐
68              lated flags are filtered out from the final output.
69

CONFIG FILE

71       Read citnames man page for the content of this file.  bear is not read‐
72       ing the content of this file, but passing the file name to citnames.
73

EXIT STATUS

75       The exit status of the program is the exit status of the build command.
76       Except when the program itself crashes, then it sets to non-zero.
77

TROUBLESHOOTING

79       The potential problems you can face with are: the build with and  with‐
80       out Bear behaves differently or the output is empty.
81
82       The  most  common cause for empty outputs is that the build command did
83       not execute any commands.  The reason for that could be, because incre‐
84       mental  builds  not  running the compilers if everything is up-to-date.
85       Remember, Bear does not understand the build file (eg.: makefile),  but
86       intercepts the executed commands.
87
88       The  other  common cause for empty output is that the build has a “con‐
89       figure” step, which captures the compiler to  build  the  project.   In
90       case  of  Bear  is using the wrapper mode (read intercept man page), it
91       needs to run the configure step with Bear too (and  discard  that  out‐
92       put), before run the build with Bear.
93
94       There  could be many reasons for any of these failures.  It’s better to
95       consult with the project wiki page for known problems,  before  open  a
96       bug report.
97

SEE ALSO

99       intercept(1), citnames(1)
100
102       Copyright  (C)  2012-2021  by  László  Nagy <https://github.com/rizsot
103       to/Bear>
104

AUTHORS

106       László Nagy.
107
108
109
110Bear User Manuals                Sep 04, 2021                          BEAR(1)
Impressum