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

COMMANDS

54       bear-intercept(1)
55              Intercepts events that happened  during  the  execution  of  the
56              build command.
57
58       bear-citnames(1)
59              Deduce  the  semantics  of  the commands captured by bear-inter‐
60              cept(1).
61

OUTPUT

63       The JSON compilation database definition changed over time.   The  cur‐
64       rent version of Bear generates entries where:
65
66       directory
67              has absolute path.
68
69       file   has absolute path.
70
71       output has absolute path.
72
73       arguments
74              used instead of command to avoid shell escaping problems.  (Con‐
75              figuration can force to emit the command field.) The compiler as
76              the  first argument has absolute path.  Some non compilation re‐
77              lated flags are filtered out from the final output.
78

CONFIG FILE

80       Read bear-citnames(1) man page for the content of this file.   bear  is
81       not reading the content of this file, but passing the file name to bear
82       citnames command.
83

EXIT STATUS

85       The exit status of the program is the exit status of the build command.
86       Except when the program itself crashes, then it sets to non-zero.
87

TROUBLESHOOTING

89       The  potential problems you can face with are: the build with and with‐
90       out Bear behaves differently or the output is empty.
91
92       The most common cause for empty outputs is that the build  command  did
93       not execute any commands.  The reason for that could be, because incre‐
94       mental builds not running the compilers if  everything  is  up-to-date.
95       Remember,  Bear does not understand the build file (eg.: makefile), but
96       intercepts the executed commands.
97
98       The other common cause for empty output is that the build has  a  “con‐
99       figure”  step,  which  captures  the compiler to build the project.  In
100       case of Bear is using the  wrapper  mode  (read  bear-intercept(1)  man
101       page),  it  needs  to run the configure step with Bear too (and discard
102       that output), before run the build with Bear.
103
104       There could be many reasons for any of these failures.  It’s better  to
105       consult  with  the  project wiki page for known problems, before open a
106       bug report.
107
109       Copyright (C)  2012-2023  by  László  Nagy  <https://github.com/rizsot
110       to/Bear>
111

AUTHORS

113       László Nagy.
114
115
116
117Bear User Manuals                Jan 02, 2023                          BEAR(1)
Impressum