From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Templeton Subject: bug#32773: clang: missing default include paths for C++ Date: Fri, 21 Sep 2018 20:58:58 -0400 Message-ID: <87fty2wdnx.fsf@terpri.org> References: <19ece273-ea75-fc9d-4e4b-aa3a68deab6d@yahoo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3WPC-0007ir-Ae for bug-guix@gnu.org; Fri, 21 Sep 2018 21:08:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3WIA-0001bX-KF for bug-guix@gnu.org; Fri, 21 Sep 2018 21:01:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:44286) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g3WI9-0001b3-W3 for bug-guix@gnu.org; Fri, 21 Sep 2018 21:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g3WI9-0001GU-UW for bug-guix@gnu.org; Fri, 21 Sep 2018 21:01:01 -0400 In-Reply-To: <19ece273-ea75-fc9d-4e4b-aa3a68deab6d@yahoo.de> Sender: "Debbugs-submit" Resent-Message-ID: List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Tim Gesthuizen Cc: 32773@debbugs.gnu.org Hi Tim, Tim Gesthuizen writes: > As you can see from the output, clang is missing some include paths that > gcc has. Specifying a custom `CPLUS_INCLUDE_PATH' fixes the problem: > > =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > =E2=94=82 > CPLUS_INCLUDE_PATH=3D$HOME/.guix-profile/include/c++:$HOME/.guix-profile/= include/c++/x86_64-unknown-linux-gnu/ > clang++ test.cc > =E2=94=82 ./a.out > =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > > =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > =E2=94=82 Hello, World > =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > > This is already done in the package definition for the > `C_INCLUDE_PATH'. It is not done for C++ because clang does not > implement a feature or build system variable for changing it. > > Fixing this problem would probably include an upstream patch enabling a > similar feature for C++ for what is already done in C and configuring > this variable in build phase to add the same include paths that g++ has. Another solution, maybe simpler than a new environment variable, is to have clang use the C++ include path from its gcc input. On FHS systems, clang can find C++ headers using the GCC_INSTALL_PREFIX configure option, but it doesn't work under Guix because the GCC package puts headers and libraries in separate outputs. Guix already patches clang to hardcode some library directories; maybe something similar could be done for C++ headers. (I think the function to modify for this would be Linux::addLibStdCxxIncludePaths in lib/Driver/ToolChains/Linux.cpp.)