From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UJ24E8q9nGEsSgEAgWs5BA (envelope-from ) for ; Tue, 23 Nov 2021 11:09:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id sCuND8q9nGH1RwAA1q6Kng (envelope-from ) for ; Tue, 23 Nov 2021 10:09:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5869B3DF27 for ; Tue, 23 Nov 2021 11:09:13 +0100 (CET) Received: from localhost ([::1]:42806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpSjf-0001SA-WB for larch@yhetil.org; Tue, 23 Nov 2021 05:09:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpSjX-0001Rz-EH for bug-guix@gnu.org; Tue, 23 Nov 2021 05:09:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:38529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpSjX-0005gA-5R for bug-guix@gnu.org; Tue, 23 Nov 2021 05:09:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mpSjW-0001nB-LG; Tue, 23 Nov 2021 05:09:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#52054: clangd cannot find Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: emmanuel.agullo@inria.fr, bug-guix@gnu.org Resent-Date: Tue, 23 Nov 2021 10:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52054 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 52054@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org X-Debbugs-Original-Xcc: emmanuel.agullo@inria.fr Received: via spool by submit@debbugs.gnu.org id=B.16376621216859 (code B ref -1); Tue, 23 Nov 2021 10:09:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Nov 2021 10:08:41 +0000 Received: from localhost ([127.0.0.1]:50075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mpSjA-0001mY-Lx for submit@debbugs.gnu.org; Tue, 23 Nov 2021 05:08:41 -0500 Received: from lists.gnu.org ([209.51.188.17]:44460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mpSj8-0001mQ-6K for submit@debbugs.gnu.org; Tue, 23 Nov 2021 05:08:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpSj8-0001QI-2E for bug-guix@gnu.org; Tue, 23 Nov 2021 05:08:38 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:58414) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpSj3-0005dv-QR for bug-guix@gnu.org; Tue, 23 Nov 2021 05:08:37 -0500 IronPort-Data: A9a23:6tguRKr5h2n6qz18PvNz939ixvFeBmI8ZxIvgKrLsJaIsI5as4F+vmVJXDiDbv+JZDfyett+a4u2oxwEuJ7Uzd5gSAY//C80QiMRo6IpJ/zJdxaqZ3v6wu7rFR88sZ1GMrEsFC2FJ5Pljk/F3oPJ8D8sislkepKmULSdY3krHlc+IMscoUkLd9AR09cAbeeRU1vlVePa+6UzCXf9s9JGGjp8B5Gr9HuDiM/PVAYw5TTSUxzkUGj2zBH5BLpHTU24wuCRroN8RoZWTM6bpF21E/+wwvsjNj+luu6TnkwiWL/YNw+I4pZUc/n7xEEc/mpri/l9bqJFAatUo2zhc9RZzMhBsoKxQkEiObDWhOkGexheCSB3e6NckFPCCSXk6ZDKlhWun3zEhq8G4FsNFYcF9aN4HGBe3fMeNXYKdB/rug4c6NpXUcE934F6cpGuZdpA/ys4lHfCEPw9B4jZRLXD6Zle0StYuyyHJt6GD+JxVNalRE6oj8VzB2oq IronPort-HdrOrdr: A9a23:QURqrK80BKO5AaAIeKluk+DdI+orL9Y04lQ7vn2ZhyYlEfBw8Pre/sjztCWYtN9/YhEdcLy7VpVoBEm8yXcK2/h1AV7SZmXbUQKTRekIh7cKgQeQfxEWndQz6U4PSdkYNDSJNykdsS8k2njAL+od X-IronPort-AV: E=Sophos;i="5.87,257,1631570400"; d="scan'208";a="5304110" Received: from 91-160-117-201.subs.proxad.net (HELO ribbon) ([91.160.117.201]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Nov 2021 11:08:25 +0100 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 3 Frimaire an 230 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 23 Nov 2021 11:08:24 +0100 Message-ID: <87ilwjjiav.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=192.134.164.83; envelope-from=ludovic.courtes@inria.fr; helo=mail2-relais-roc.national.inria.fr X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emmanuel.agullo@inria.fr Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637662153; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=C5W587obzSRxXEOZ8U2cM7BFpAxFG+gYlrsb0hWnda8=; b=Tx1JbajKUfk86HqGMYHpnetUCaNhnqqXuDMFcgVP0gjm1bJ7qizg4kCsUM97rN14tKWHg0 mNlL538qTi2g4j9QNMX3L4EVYYRo34sHlQU81spsV316SzDUFW78kFdCjq6/v8bd65pPbQ f4xur2nj1e+O1ov9RBD/4sV5pmfHfnQqo2jGSkpwmXHOxQb5WefaSred2lUztsNui7nFm1 YluxY8Xl80TBB9RjTNXBNd/AP1QOiOZhcvZueaL0fNktHzsFKXYltgpGvEwdaQW0+O4mEq YwtCCvJxWmxXuLy/qqtImGQiMSA4Mjh58T23pQhltb07Y2/ZbxAEWztHqdv20A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637662153; a=rsa-sha256; cv=none; b=dXwDfsOGtzGORD5oCc3KMxsLHDeDpS8EiSDZNGAucDGbunDlDzZ8t8/aBfgg3OWggZ3PxX 2retbZLQXnvoq9d+ytX5c71G6KkyXY8eGEBWUfHEuSNuYiAfEsoERhAzyWJ3RmXu8jez9O s7w+9+u9w314XXesqRZOYNKFnP0wKlEUHByUNCDZEzCcCZdQNvo6dVOTuuBPdMsmJjyHmo bmRLQICv3zfxVIRx01Q1ctIiOAuk3kV5Kl4CqJik8rVd9KFjxwpheyBxhSRywNSS3vTzQ3 2ZZwACnX4yQFE4eig+i5e205HU8doBCDyrmRv26nmaSOHnTe0r7pme3TxVbtng== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -3.28 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 5869B3DF27 X-Spam-Score: -3.28 X-Migadu-Scanner: scn1.migadu.com X-TUID: Lh3PCshI/9Mt Hello, =E2=80=98clangd=E2=80=99 fails to find , as shown here: --8<---------------cut here---------------start------------->8--- $ printf '#include \nint foo (int x) {return x+2; }' > t.c $ guix shell -C -D hello --with-c-toolchain=3Dhello=3Dclang-toolchain clang= :extra strace guix shell: warning: transformation 'with-c-toolchain' had no effect on str= ace@5.8 guix shell: warning: transformation 'with-c-toolchain' had no effect on cla= ng@12.0.1 [env]$ clang -c t.c [env]$ clangd --check=3Dt.c I[10:02:40.349] clangd version 12.0.1 I[10:02:40.349] PID: 3 I[10:02:40.349] Working directory: /home/ludo/tmp/clangd-bug I[10:02:40.349] argv[0]: clangd I[10:02:40.349] argv[1]: --check=3Dt.c I[10:02:40.349] Entering check mode (no LSP server) I[10:02:40.349] Testing on source file /home/ludo/tmp/clangd-bug/t.c I[10:02:40.349] Loading compilation database... I[10:02:40.349] Failed to find compilation database for /home/ludo/tmp/clan= gd-bug/t.c I[10:02:40.349] Generic fallback command is: /gnu/store/nk5lp7wisgdlvds5cam= vcchgh19hnn23-clang-12.0.1/bin/clang /home/ludo/tmp/clangd-bug/t.c -fsyntax= -only -resource-dir=3D/gnu/store/hnw2acjhfpj5l2zrazj5fvq5ksy002f1-clang-12.= 0.1-extra/lib/clang/12.0.1 I[10:02:40.350] Parsing command... I[10:02:40.352] internal (cc1) args are: -cc1 -triple x86_64-unknown-linux-= gnu -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names= -main-file-name t.c -mrelocation-model static -mframe-pointer=3Dall -fmath= -errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu= x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=3Dgdb = -resource-dir /gnu/store/hnw2acjhfpj5l2zrazj5fvq5ksy002f1-clang-12.0.1-extr= a/lib/clang/12.0.1 -c-isystem /gnu/store/xl7wammzljnp0rg496n96h5m69y25isg-p= rofile/include -cxx-isystem /gnu/store/xl7wammzljnp0rg496n96h5m69y25isg-pro= file/include -internal-isystem /usr/local/include -internal-isystem /gnu/st= ore/hnw2acjhfpj5l2zrazj5fvq5ksy002f1-clang-12.0.1-extra/lib/clang/12.0.1/in= clude -internal-externc-isystem /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr= -glibc-2.31/include -fdebug-compilation-dir /home/ludo/tmp/clangd-bug -ferr= or-limit 19 -fgnuc-version=3D4.2.1 -faddrsig -x c /home/ludo/tmp/clangd-bug= /t.c I[10:02:40.352] Building preamble... I[10:02:40.368] Indexing headers... E[10:02:40.382] [pp_file_not_found] Line 1: in included file: 'stddef.h' fi= le not found I[10:02:40.382] Building AST... I[10:02:40.386] Indexing AST... I[10:02:40.386] Testing features at each token (may be slow in large files) I[10:02:40.387] All checks completed, 1 errors [env]$ ls /gnu/store/hnw2acjhfpj5l2zrazj5fvq5ksy002f1-clang-12.0.1-extra/li= b/clang/12.0.1 ls: cannot access '/gnu/store/hnw2acjhfpj5l2zrazj5fvq5ksy002f1-clang-12.0.1= -extra/lib/clang/12.0.1': No such file or directory [env]$ readlink -f $(type -P clang) /gnu/store/nk5lp7wisgdlvds5camvcchgh19hnn23-clang-12.0.1/bin/clang-12 [env]$ find -L /gnu/store/nk5lp7wisgdlvds5camvcchgh19hnn23-clang-12.0.1/ -n= ame stddef.h /gnu/store/nk5lp7wisgdlvds5camvcchgh19hnn23-clang-12.0.1/lib/clang/12.0.1/i= nclude/stddef.h [env]$ exit $ guix describe Generacio 195 Nov 22 2021 00:37:58 (nuna) guix 24aa7b3 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: 24aa7b3c21309b63cc6e8e18d6417d2cddccf6c6 --8<---------------cut here---------------end--------------->8--- Above, the directory passed as =E2=80=98-resource-dir=E2=80=99 does not exi= st: instead of =E2=80=98=E2=80=A6-clang-12.0.1-extra=E2=80=99 it should be =E2=80=98=E2= =80=A6-clang-12.0.1=E2=80=99. This directory name is determined in =E2=80=98clangd/CompileCommands.cpp=E2= =80=99: --8<---------------cut here---------------start------------->8--- std::string detectStandardResourceDir() { static int Dummy; // Just an address in this process. return CompilerInvocation::GetResourcesPath("clangd", (void *)&Dummy); } [=E2=80=A6] CommandMangler CommandMangler::detect() { CommandMangler Result; Result.ClangPath =3D detectClangPath(); Result.ResourceDir =3D detectStandardResourceDir(); Result.Sysroot =3D detectSysroot(); return Result; } [=E2=80=A6] if (ResourceDir && !Has("-resource-dir")) Cmd.push_back(("-resource-dir=3D" + *ResourceDir)); --8<---------------cut here---------------end--------------->8--- We should either fix =E2=80=98GetResourcesPath=E2=80=99 or patch the file a= bove so it returns the Clang directory name known at build time. Ludo=E2=80=99.