[cfe-dev] Can someone tell me what I'm doing wrong?

Alexander Kornienko alexfh at google.com
Mon Oct 29 09:46:09 PDT 2012


On Wed, Oct 24, 2012 at 11:30 PM, Bill White <bill.white at griggsinst.com>wrote:

> I'm trying to understand how to make a compile database.  I can't switch to
> cmake because my very large project uses gmake.  So I've made a python
> program to create a compile_commands.json file.  It seems to have the right
> information.  For one file, named "x/y.cpp", when I cut the "command" value
> out of the compile_commands.json file for "x/y.cpp" and execute it in a
> shell,
> the command executes as I expect it to.  However, when I try to run
> "clang-check"
> I get various odd errors.  Here's the complete situation:
>
> 1.) The compile_commands.json file is in /a/b/c/compile_commands.json.  I
>     Think that makes "/a/b/c" the build directory in clang Tooling terms.
> 2.) The source file is in /a/b/c/x/y.cpp.
> 3.) The entry in compile_comands.json is:
>         {"directory": "/a/b/c", "command": "clang++ x/y.cpp ... stuff
> ...", "file": "/a/b/c/x/y.cpp"}
>     And of course there are many entries.  This is just one of hundreds.
>
Do you separate them with commas and put brackets around the whole
construct? I.e., does your file look like this:

[
        {"directory": "/a/b/c/x", "command": "clang++ x/y.cpp ... ",
"file": "/a/b/c/x/y.cpp"},
        {"directory": "/a/b/c/x", "command": "clang++ x/z.cpp ... ",
"file": "/a/b/c/x/z.cpp"}
]

?


> When I run clang-check, as the documentation seems to imply, using -p to
> name
> the build directory, I get this:
>
> % cd /a/b/c
> % clang-check -p . x/y.cpp
> Processing: /a/b/c/x/y.cpp.
> error: no input files
> error: unable to handle compilation, expected exactly one compiler job in
> ''
> Error while processing /a/b/c/x/y.cpp.
>
> Note: I get the same behavior putting the full path name for ".", when
> eliminate
>       the "-p build_dir" completely.  I also get the same behavior
> when I cd into
>       x and run the experiments (with y.cpp in place of x/y.cpp, of
> course).
>
> Why am I being so dense about this?  What am I missing?  This seems very
> unintuitive.  I'm trying to build a tool which extracts dependence
> information, but
> I'm stymied right at the beginning.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



-- 
Alexander Kornienko | Software Engineer | alexfh at google.com | +49 151 221
77 957
Google Germany GmbH | Dienerstr. 12 | 80331 München
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121029/a4e62a0b/attachment.html>


More information about the cfe-dev mailing list