From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B7F0C433DB for ; Sun, 14 Feb 2021 11:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0F9F64E56 for ; Sun, 14 Feb 2021 11:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbhBNLuY (ORCPT ); Sun, 14 Feb 2021 06:50:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbhBNLuO (ORCPT ); Sun, 14 Feb 2021 06:50:14 -0500 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1640CC061574; Sun, 14 Feb 2021 03:49:34 -0800 (PST) Received: by mail-yb1-xb35.google.com with SMTP id 133so4367333ybd.5; Sun, 14 Feb 2021 03:49:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=YbYZAdSVhVuJNoAtWccCf/rL4wPcvTLqCtelTv8zP+0=; b=tIfW9jhPos2FN4wybEValTe3L0GwaS4QasOe7OesU6SBJKghvCL4FHbCN3D6d740Tp XL+GfjnmGjBQUM7haFOs6T6LA2IJQDGHba5b5DrvIMl1bwzlb7XA/TzR4JBbdKK3u78E nIJouAQSNb5qD7VMkhI5gMNXoYxPl7Gngp13t8Y3EnxaWwHj+0g9UHtp1/8Vlvd+vB64 E+Mzl+SkgvNVMx26CgR3DgeUsMpGN9Zdd2qEq1kcup8k9bhw+vR2a7T5nNZkla3Vnyi8 sEUwDnWPPinlkiGjWNStGmyGKYJMXk2rmn1mDMQ+3YC8p/pE0uNFFcNLfbSt38rjqLM/ IMTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=YbYZAdSVhVuJNoAtWccCf/rL4wPcvTLqCtelTv8zP+0=; b=DpjSxpiVCHdnYNJGkE1af4Tt2AEii8XG+887bRBs44+2Cn9G0m/kCvqVV/pXYB0gUP CeWOLUwntDv81/U4VmDLD7iicMnpJEyUbUtnn+grhHKjPguVbpnX9pcyJnmDhwUGHaeP 0E357KEy6pm4sCrwwVWD4cA+jsLIIFN4n82cLXJpk9GJQ8Svn2BI8pa9gx5Lpr6TIR+t GGmqXe2fyfur6J+btJM7ePp+1Y15L1XHxuNVtrfe3cswRaSC8rDlCur/PD16nH/CK7CF M5LkpxuRWPxeghL02LkVo85SK4Uu6LNBnhpB+t1NPsQjhRb/goPzEdhAKv9/EhhZk138 GjLw== X-Gm-Message-State: AOAM531XSGIdmDAatZDjudxCKSWbQflHnvD60JshB7MLXXUCl86WosJa +7KUrHEzlr7B6bXJQkhkvr3QXsO2x/EYE8IqPO0= X-Google-Smtp-Source: ABdhPJxBXprXfO+zHFZQa26UWH9ERnKFBq5or7C0kRpR48smN3Yt6/llKsTVLFlxS0b5Sv1xBBoD58Rt2xfUegBkY24= X-Received: by 2002:a25:7312:: with SMTP id o18mr16101845ybc.352.1613303373113; Sun, 14 Feb 2021 03:49:33 -0800 (PST) MIME-Version: 1.0 References: <1612783737-3512-1-git-send-email-stephenzhangzsd@gmail.com> <20210208195439.GA1097868@ubuntu-m3-large-x86> <20210209192729.GA820978@ubuntu-m3-large-x86> <20210210182400.GA3502674@ubuntu-m3-large-x86> In-Reply-To: From: Stephen Zhang Date: Sun, 14 Feb 2021 19:49:22 +0800 Message-ID: Subject: Re: [PATCH v1] clang_tools:gen_compile_commands: Change the default source directory To: Masahiro Yamada Cc: Nathan Chancellor , Nick Desaulniers , Nathan Chancellor , clang-built-linux , LKML , Tom Roeder , Linux Kbuild mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masahiro Yamada =E4=BA=8E2021=E5=B9=B42=E6=9C=8813= =E6=97=A5=E5=91=A8=E5=85=AD =E4=B8=8B=E5=8D=888:46=E5=86=99=E9=81=93=EF=BC= =9A > This is the steps I tested. > > > masahiro@oscar:~/ref/linux$ make O=3Dbuild 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=3Dbuild > > 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=3D/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=3D/tmp/build defconfig all -j24 where the build directory is not a subpath of the source directory. -- Best Regards Stephen Zhang