Open whisperity opened 7 years ago
Thanks for the report. This use-case was intentionally not addressed. Might fix in the future. A recommended workaround is:
intercept-build sh -c "g++ -c main.cpp -o main.o"
intercept-build sh -c "clang++ -c main.cpp -o main.o"
In the development of CodeChecker we hit an issue with using
intercept-build
: we are unable to log withintercept-build
if a direct compiler invocation is passed as a build command.Take, for example, the following lines:
The result is an empty
compile_commands.json
Trying to set
--override-compiler
and--use-cc
/--use-c++
to the compiler executables themselves doesn't help either.g++
g++
is/usr/bin/g++
which is a sym-link to/usr/bin/g++-5
In case of g++, setting
--use-c++ /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus
helps. This way, it looks like that proper compile database is created:However, this is not automatic, and very specific to the users' environment. :slightly_frowning_face:
clang
The problem is even more affecting when someone tries to use
clang++
as their compiler. Bothclang
andclang++
are sym-links toclang-5.0
:Using
--use-c++ "/home/username/LLVM/build/bin/clang-5.0"
does not help in this case, the compile JSON remains empty.The problem lies in that a direct
clang
invocation creates an invocation which contains a-cc1
argument, which explicitly makes the executed command to be ignored. If I edit the file to "unignore"-cc1
, the compile JSON is created, but it contains, seemingly, a lot of useless data: