Repository navigation
Open
Description
I am trying to use woboq on postgres (https://github.com/postgres/postgres).
I have generated compile_commands.json using bear
cd postgres
bear -- ./configure
bear -- make
Now when I run codebrowser_generator, I get the below-mentioned error
OUTPUT_DIRECTORY=~/public_html/postgres
DATA_DIRECTORY=$OUTPUT_DIRECTORY/../data
mkdir -p $OUTPUT_DIRECTORY
mkdir -p $DATA_DIRECTORY
BUILD_DIRECTORY=$PWD
SOURCE_DIRECTORY=$PWD
VERSION=`git describe --always --tags`
codebrowser_generator -b $BUILD_DIRECTORY -a \
-o $OUTPUT_DIRECTORY \
-p postgres:$SOURCE_DIRECTORY:$VERSION
json-compilation-database: Unknown key: ""output""
Could not load compilationdatabase. Please use the -b option to a path containing a compile_commands.json, or use '--' followed by the compilation commands.
Here is a sample entry from compile_commands.json,
{
"arguments": [
"/usr/bin/x86_64-linux-gnu-gcc-10",
"-Wall",
"-Wmissing-prototypes",
"-Wpointer-arith",
"-Wdeclaration-after-statement",
"-Werror=vla",
"-Wendif-labels",
"-Wmissing-format-attribute",
"-Wimplicit-fallthrough=3",
"-Wcast-function-type",
"-Wformat-security",
"-fno-strict-aliasing",
"-fwrapv",
"-fexcess-precision=standard",
"-Wno-format-truncation",
"-Wno-stringop-truncation",
"-O2",
"-fPIC",
"-I.",
"-I/home/jagadeesha/Downloads/postgres-git/src/pl/plpgsql/src",
"-I../../../../src/include",
"-I/home/jagadeesha/Downloads/postgres-git/src/include",
"-D_GNU_SOURCE",
"-c",
"-o",
"pl_scanner.o",
"/home/jagadeesha/Downloads/postgres-git/src/pl/plpgsql/src/pl_scanner.c"
],
"directory": "/home/jagadeesha/Downloads/postgres-git/build/src/pl/plpgsql/src",
"file": "/home/jagadeesha/Downloads/postgres-git/src/pl/plpgsql/src/pl_scanner.c",
"output": "/home/jagadeesha/Downloads/postgres-git/build/src/pl/plpgsql/src/pl_scanner.o"
}
and codebrowser version details:
$ codebrowser_generator -version
LLVM (http://llvm.org/):
LLVM version 3.8.1
Optimized build.
Built Jun 2 2017 (13:11:29).
Default target: x86_64-pc-linux-gnu
Host CPU: westmere
is the generated entries in compile_commands.json not supposed to contain output field?
How do I resolve this issue?
Metadata
Metadata
Assignees
Labels
No labels
Activity
kanihal commentedon Oct 22, 2021
@PiotrZSL @gavinchou - Any idea on how to resolve this issue?
[-]Could not load compilationdatabase - json-compilation-database: Unknown key: ""output""[/-][+]Could not load compilationdatabase - Unknown key: ""output""[/+]ogoffart commentedon Oct 22, 2021
How did you generate that compilation database?
It looks like clang's compilation database parser don't support extra key.
Also your version of LLVM is quite old, perhaps output is a recent addition. (I have no idea about that, just a guess. Upgrading clang might or might not help)
kanihal commentedon Oct 22, 2021
@ogoffart
Since postgres is not a cmake project, I generated
compile_commands.jsonusing bear(https://github.com/rizsotto/Bear).I had installed codebrowser_generator using
.debfile linked in the woboq website: https://woboq.com/codebrowser-download.html. This is a very old build as you mentioned.I also tried building codebrowser with LLVM-13(latest version). I get the following error while compiling,
The 2 errors are:
kanihal commentedon Oct 23, 2021
Workaround Fix:
I followed the instructions given in rizsotto/Bear#196 (comment) to generate
compile_commands.jsonin the older format (i.e. withoutoutputfield). codebrowser_generator worked fine with the older format.Adding
config.jsonthat I used for reference here.As for the
codebrowserbuild failure with LLVM-13, I have logged a new issue (#95).gavinchou commentedon Oct 27, 2021
@kanihal Since you've solved the db problem, I would like to share some tips on generating compilation.json. Hope it may help in the future.
For any project I'd like to compile with codebrowser, I would like to write another new CMakeList.txt for it to get full control of the source code and dependencies needed by codebrowser, even though it already has one.
Of course, I need some script to help, here is the example
https://github.com/gavinchou/codebrowser/tree/master/examples/build-project-with-template