1BEAR(1) BEAR(1)
2
3
4
6 Bear - Build EAR
7
9 bear [options] [build command]
10
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
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 --use-cc program
40 Hint Bear to classify the given program name as C compiler.
41
42 --use-c++ program
43 Hint Bear to classify the given program name as C++ compiler.
44
45 --use-only
46 Force to use only the --use-cc and --use-c++ given compilers.
47
48 -a, --append
49 Use previously generated output file and append the new entries
50 to it. This way you can run Bear continuously during work, and
51 it keeps the compilation database up to date. File deletion and
52 addition are both considered. But build process change (compil‐
53 er flags change) might cause duplicate entries.
54
55 -l path, --libear path
56 Specify the preloaded library location. (Default value provid‐
57 ed.)
58
60 The JSON compilation database definition changed over time. The cur‐
61 rent version of Bear generates entries where:
62
63 directory
64 has absolute path.
65
66 file has relative path to the directory.
67
68 arguments
69 used instead of command to avoid shell escaping problems. The
70 source file in the compiler call match to the file attribute,
71 therefore it is relative path to directory. Other filesystem
72 related references are not modified (those still can be absolute
73 or relative depending the original command).
74
75 Some non compilation related flags are filtered out from the final out‐
76 put.
77
79 Bear exit status is the exit status of the build command. Except when
80 bear crashes, then it sets to non zero.
81
83 INTERCEPT_BUILD_TARGET_DIR
84 Temporary directory to collect the execution reports at one
85 place. Directory path is derived from TMPDIR, TEMP or TMP envi‐
86 ronment variable.
87
88 LD_PRELOAD
89 Used by the dynamic loader on Linux, FreeBSD and other UNIX OS.
90 Value set by Bear, overrides previous value for child processes.
91
92 DYLD_INSERT_LIBRARIES
93 Used by the dynamic loader on OS X. Value set by Bear, over‐
94 rides previous value for child processes.
95
96 DYLD_FORCE_FLAT_NAMESPACE
97 Used by the dynamic loader on OS X. Value set by bear, over‐
98 rides previous value for child processes.
99
101 libear.so or libear.dylib
102 The preload library which implements the exec methods.
103
105 ld.so(8), exec(3)
106
108 Because Bear uses LD_PRELOAD or DYLD_INSERT_LIBRARIES environment vari‐
109 ables, it does not append to it, but overrides it. So builds which are
110 using these variables might not work. (I don't know any build tool
111 which does that, but please let me know if you do.)
112
113 Security extension/modes on different operating systems might disable
114 library preloads. This case Bear behaves normally, but the result com‐
115 pilation database will be empty. (Please make sure it's not the case
116 when reporting bugs.) Notable examples for enabled security modes are:
117 SIP on OS X Captain and SELinux on Fedora, CentOS, RHEL.
118
120 Copyright (C) 2012-2017 by László Nagy <https://github.com/rizsot‐
121 to/Bear>
122
124 László Nagy.
125
126
127
128Bear User Manuals April 20, 2017 BEAR(1)