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

NAME

6       Bear - Build EAR
7

SYNOPSIS

9       bear [options] [build command]
10

DESCRIPTION

12       Bear is a tool to generate compilation database for clang tooling.
13
14       The  JSON compilation database <http://clang.llvm.org/docs/JSONCompila
15       tionDatabase.html> is used in Clang project to provide information  how
16       a  single  compilation unit was processed.  When that is available then
17       it is easy to re-run the compilation with different programs.
18
19       Bear executes the original build command and intercepts the  subsequent
20       execution  calls.   To achieve that Bear uses library preload mechanism
21       provided by the dynamic linker.  There is a library which  defines  the
22       exec  methods  and  used in every child processes of the build command.
23       The executable itself sets the environment up to  child  processes  and
24       writes the output file.
25

OPTIONS

27       --version
28              Print out Bear version number.
29
30       -v, --verbose
31              Enable  verbose  output  from  Bear.  A second, third and fourth
32              flags increases verbosity.
33
34       -o file, --cdb file
35              Specify output file.  (Default value provided.)  The  output  is
36              not  continuously updated, it's done when the build command fin‐
37              ished.
38
39       –field-output
40              Ask to emit the output field for  each  entries  in  the  output
41              file.
42
43       --use-cc program
44              Hint Bear to classify the given program name as C compiler.
45
46       --use-c++ program
47              Hint Bear to classify the given program name as C++ compiler.
48
49       --use-fortran program
50              Hint  Bear to classify the given program name as Fortran compil‐
51              er.
52
53       --use-only
54              Force to use only the --use-cc and --use-c++ given compilers.
55
56       --include directory
57              Only include this directories or files to the output.  The  flag
58              can be used multiple times.  The directory is either absolute or
59              relative to current working directory.  Use --exclude to  filter
60              entries out from these directory.
61
62       --exclude directory
63              Exclude  these  directories  or files from the output.  The flag
64              can be used multiple times.  The directory is either absolute or
65              relative  to  current working directory.  The --include will not
66              enable entries from these directories.
67
68       -a, --append
69              Use previously generated output file and append the new  entries
70              to  it.  This way you can run Bear continuously during work, and
71              it keeps the compilation database up to date.  File deletion and
72              addition are both considered.  But build process change (compil‐
73              er flags change) might cause duplicate entries.
74
75       -l path, --libear path
76              Specify the preloaded library location.  (Default value  provid‐
77              ed.)
78

OUTPUT

80       The  JSON  compilation database definition changed over time.  The cur‐
81       rent version of Bear generates entries where:
82
83       directory
84              has absolute path.
85
86       file   has relative path to the directory.
87
88       arguments
89              used instead of command to avoid shell escaping  problems.   The
90              source  file  in  the compiler call match to the file attribute,
91              therefore it is relative path to  directory.   Other  filesystem
92              related references are not modified (those still can be absolute
93              or relative depending the original command).
94
95       Some non compilation related flags are filtered out from the final out‐
96       put.
97

EXIT STATUS

99       Bear  exit status is the exit status of the build command.  Except when
100       bear crashes, then it sets to non zero.
101

ENVIRONMENT

103       INTERCEPT_BUILD_TARGET_DIR
104              Temporary directory to collect  the  execution  reports  at  one
105              place.  Directory path is derived from TMPDIR, TEMP or TMP envi‐
106              ronment variable.
107
108       LD_PRELOAD
109              Used by the dynamic loader on Linux, FreeBSD and other UNIX  OS.
110              Value set by Bear, overrides previous value for child processes.
111
112       DYLD_INSERT_LIBRARIES
113              Used  by  the  dynamic loader on OS X.  Value set by Bear, over‐
114              rides previous value for child processes.
115
116       DYLD_FORCE_FLAT_NAMESPACE
117              Used by the dynamic loader on OS X.  Value set  by  bear,  over‐
118              rides previous value for child processes.
119

FILES

121       libear.so or libear.dylib
122              The preload library which implements the exec methods.
123

SEE ALSO

125       ld.so(8), exec(3)
126

BUGS

128       Because Bear uses LD_PRELOAD or DYLD_INSERT_LIBRARIES environment vari‐
129       ables, it does not append to it, but overrides it.  So builds which are
130       using  these  variables  might  not work.  (I don't know any build tool
131       which does that, but please let me know if you do.)
132
133       Security extension/modes on different operating systems  might  disable
134       library preloads.  This case Bear behaves normally, but the result com‐
135       pilation database will be empty.  (Please make sure it's not  the  case
136       when  reporting bugs.) Notable examples for enabled security modes are:
137       SIP on OS X Captain and SELinux on Fedora, CentOS, RHEL.
138
140       Copyright (C)  2012-2019  by  László  Nagy  <https://github.com/rizsot
141       to/Bear>
142

AUTHORS

144       László Nagy.
145
146
147
148Bear User Manuals                May 10, 2019                          BEAR(1)
Impressum