From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Othacehe Subject: Clang c++ include path Date: Mon, 28 Oct 2019 09:30:22 +0100 Message-ID: <87wocpz2zl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:53234) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP0Q9-0007bE-7T for guix-devel@gnu.org; Mon, 28 Oct 2019 04:30:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP0Q7-0004l0-V5 for guix-devel@gnu.org; Mon, 28 Oct 2019 04:30:37 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:37848) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iP0Q7-0004kO-P7 for guix-devel@gnu.org; Mon, 28 Oct 2019 04:30:35 -0400 Received: by mail-wm1-x32d.google.com with SMTP id q130so8100213wme.2 for ; Mon, 28 Oct 2019 01:30:35 -0700 (PDT) Received: from meru (lfbn-ann-1-367-71.w86-200.abo.wanadoo.fr. [86.200.83.71]) by smtp.gmail.com with ESMTPSA id z13sm10608118wrm.64.2019.10.28.01.30.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 01:30:33 -0700 (PDT) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Guix-devel Hello, When running clang on a c++ program, it cannot find c++ std libraries. That's because, those libraries path are hardcoded inside g++ compiler and clang cannot find them. This has already been discussed here: https://issues.guix.info/issue/32773, without reaching a solution. Running this program, --8<---------------cut here---------------start------------->8--- #include int main() { return 0; } --8<---------------cut here---------------end--------------->8--- I have this error: --8<---------------cut here---------------start------------->8--- mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang t.cpp #include ^~~~~~~~ t.cpp:1:10: fatal error: 'string' file not found 1 error generated. --8<---------------cut here---------------end--------------->8--- that's because: --8<---------------cut here---------------start------------->8--- mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang -v t.cpp ... #include "..." search starts here: #include <...> search starts here: /gnu/store/933ijsm5wwjkvlh963lc3pxc7i3dfxcp-profile/include /gnu/store/i2vzqb02gxcm5c2zix92lq3ay73kbl9s-clang-8.0.0/lib/clang/8.0.0/include /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/include End of search list. #include ^~~~~~~~ t.cpp:1:10: fatal error: 'string' file not found 1 error generated. --8<---------------cut here---------------end--------------->8--- whereas, --8<---------------cut here---------------start------------->8--- mathieu@meru:~/tmp$ ~/.guix-profile/bin/g++ -v t.cpp ... #include "..." search starts here: #include <...> search starts here: /gnu/store/933ijsm5wwjkvlh963lc3pxc7i3dfxcp-profile/include /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++ [1] /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++/x86_64-unknown-linux-gnu [2] /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++/backward [3] /gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/include /gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/include-fixed /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/include ... --8<---------------cut here---------------end--------------->8--- Hardcoding the paths [1], [2] and [3] into clang would solve the issue, but it might not be the better way to proceed. WDYT? Mathieu