compile_commands.json empty on MacOS Catalina
erszcz opened this issue · comments
I'm running intercept-build make
after a fresh clone of http://github.com/strophe/libstrophe.git, but the resulting compile_commands.json
is empty. Do I have to disable SIP for intercept-build
to work or was it only a temporary workaround (I found the suggestion in some other issue)?
Thanks for the report. Need more context to help. How did you installed this package? Which version? What os version you have? Did it work with other project?
Was looking to the libstrophe
project you've mentioned. If you are using OSX scan-build
will try to use compiler wrappers. This project is using configure
script, which detects the compilers and put that into the makefile. So, maybe you can try to run the configure
step with intercept-build
(just ignore the output) and then scan-build make
.
Hey, thanks for a prompt response!
My MacOS version is Catalina 10.15, scan-build 2.0.18 is installed via pip. Doing ./bootstrap.sh
, ./configure
, intercept-build make
on a Linux box populated compile_commands.json
as expected.
I've tried cleaning the libstrophe
repo completely then running intercept-build ./configure
, scan-build make
, but the resulting compile_commands.json
is still empty. However, I've noticed a execution report might be incomplete: missing target directory
in the logs:
...
intercept-cc: execution report might be incomplete: missing target directory
mv -f examples/.deps/vcard-vcard.Tpo examples/.deps/vcard-vcard.Po
/bin/sh ./libtool --tag=CC --mode=link intercept-cc -I. -Wall -Wextra -Wno-unused-parameter -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -o examples/vcard examples/vcard-vcard.o libstrophe.la
libtool: link: intercept-cc -I. -Wall -Wextra -Wno-unused-parameter -I/usr/local/opt/openssl/include -o examples/.libs/vcard examples/vcard-vcard.o -L/usr/local/opt/openssl/lib ./.libs/libstrophe.dylib -lssl -lcrypto -lexpat -lresolv
intercept-cc: execution report might be incomplete: missing target directory
scan-build: Removing directory '/var/folders/g9/nbwdb6ln7jjcwmbjwwwps6cc0000gq/T/scan-build-2020-01-13-10-07-17-152925-c_geVW' because it contains no report.
Might it be of any importance?
Thanks to come back with these updates.
Yes, the linux version is using the OS dynamic linker library preload functionality. (LD_PRELOAD
) While working on OSX the program detects the SIP status, and choose compiler wrapper (the intercept-cc
in the logs).
The error message execution report might be incomplete: missing target directory
is an interesting one. Could you run the command with verbose flags with? (Calling intercept-build -vvvv ./configure
)
And I was wrong with the commands I've suggested. It needs to use the same tool for configure
and make
in order to use the same compiler wrappers. (intercept-build ./configure
and intercept-build make
and later to run the analyzer analyze-build
) <- This will create a compilation database first and then run the analyzer. (scan-build ./configure
and scan-build make
will run the analyzer right after the compiler call.) I would do the intercept-build
and inspect the compile_commands.json
file to see if that has entries or not.
And I would recommend to check the closed issues for this. Some might be relevant to you OS version or toolchain version.
Awesome! Running intercept-build ./configure
and then intercept-build make
did the trick - compile_commands.json
is now populated. Thanks, @rizsotto!