From: Nathan Chancellor <nathan@kernel.org>
To: Stephen Zhang <stephenzhangzsd@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <natechancellor@gmail.com>,
clang-built-linux <clang-built-linux@googlegroups.com>,
LKML <linux-kernel@vger.kernel.org>,
Tom Roeder <tmroeder@google.com>,
Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH v1] clang_tools:gen_compile_commands: Change the default source directory
Date: Sun, 14 Feb 2021 16:28:20 -0700 [thread overview]
Message-ID: <20210214232820.GA55343@24bbad8f3778> (raw)
In-Reply-To: <CALuz2=fHXZ=NrVdRNzyromD88wp9pAzYC9nffPt6y5YM=sJniw@mail.gmail.com>
On Sun, Feb 14, 2021 at 07:49:22PM +0800, Stephen Zhang wrote:
> Masahiro Yamada <masahiroy@kernel.org> 于2021年2月13日周六 下午8:46写道:
> > This is the steps I tested.
> >
> >
> > masahiro@oscar:~/ref/linux$ make O=build defconfig all -j24
> > [ snip ]
> > masahiro@oscar:~/ref/linux$
> > ./scripts/clang-tools/gen_compile_commands.py -d build
> > masahiro@oscar:~/ref/linux$ grep '"file":' compile_commands.json |
> > grep scripts/ | head -n5
> > "file": "/home/masahiro/ref/linux/scripts/mod/empty.c"
> > "file": "/home/masahiro/ref/linux/scripts/mod/sumversion.c"
> > "file": "/home/masahiro/ref/linux/scripts/mod/file2alias.c"
> > "file": "/home/masahiro/ref/linux/scripts/mod/modpost.c"
> > "file": "/home/masahiro/ref/linux/build/scripts/kconfig/parser.tab.c"
> >
> > --
> > Best Regards
> > Masahiro Yamada
>
> Thanks. Nathan had a detailed description about this:
>
> > $ make O=build
> >
> > will work with '-d .' because the .cmd files are in '.' and the source
> > files will be placed relative to '.', which is correct. Your command
> > does not work for two reasons:
> >
> > 1. You are using a build directory that is not a subpath of the source
> > directory. In other words, this script would not work for
> >
> > $ make O=/tmp/build
> >
> > because '-d /tmp/build' needs to be used to find the .cmd files but then
> > the relative path of the source files is messed up, as you point out.
>
> This may help you reproduce the problem. So you shoud try:
>
> >masahiro@oscar:~/ref/linux$ make O=/tmp/build defconfig all -j24
>
> where the build directory is not a subpath of the source directory.
>
This will actually work for the regular build system as it uses the full
path to the files when O= is outside of the source tree. My comment
applies only to the tools/ build system, which Masahiro has explicitly
said he does not want this script to support.
Cheers,
Nathan
next prev parent reply other threads:[~2021-02-14 23:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-08 11:28 [PATCH v1] clang_tools:gen_compile_commands: Change the default source directory Stephen Zhang
2021-02-08 19:54 ` Nathan Chancellor
[not found] ` <CALuz2=d-ENRbWgGYaO_ESEaw5eOVSwkQmkeYBJ-w0Vb3zZ+REg@mail.gmail.com>
2021-02-09 19:27 ` Nathan Chancellor
[not found] ` <CALuz2=dyA_ki98t8VNe2L1UcBXrSoJT1r6j1puEmLn7WrX87XQ@mail.gmail.com>
2021-02-10 18:24 ` Nathan Chancellor
2021-02-11 13:47 ` Stephen Zhang
2021-02-11 14:15 ` Masahiro Yamada
2021-02-12 11:20 ` Stephen Zhang
2021-02-13 12:45 ` Masahiro Yamada
2021-02-14 11:49 ` Stephen Zhang
2021-02-14 17:09 ` Masahiro Yamada
2021-02-15 11:57 ` Stephen Zhang
2021-02-14 23:28 ` Nathan Chancellor [this message]
2021-02-15 11:36 ` Stephen Zhang
2021-02-10 20:32 ` Tom Roeder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210214232820.GA55343@24bbad8f3778 \
--to=nathan@kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=stephenzhangzsd@gmail.com \
--cc=tmroeder@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).