From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Gesthuizen Subject: bug#32773: clang: missing default include paths for C++ Date: Sun, 23 Sep 2018 19:10:31 +0200 Message-ID: <442d716d-abda-b079-f548-353328868839@yahoo.de> References: <19ece273-ea75-fc9d-4e4b-aa3a68deab6d@yahoo.de> <87fty2wdnx.fsf@terpri.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g47uW-0001sp-9X for bug-guix@gnu.org; Sun, 23 Sep 2018 13:11:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g47uR-00059k-Em for bug-guix@gnu.org; Sun, 23 Sep 2018 13:11:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:46785) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g47uP-000599-SU for bug-guix@gnu.org; Sun, 23 Sep 2018 13:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g47uP-00076E-LV for bug-guix@gnu.org; Sun, 23 Sep 2018 13:11:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87fty2wdnx.fsf@terpri.org> Content-Language: en-US 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: Robin Templeton Cc: 32773@debbugs.gnu.org On 22.09.2018 02:58, Robin Templeton wrote: > 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: >> >> ┌──── >> │ >> CPLUS_INCLUDE_PATH=$HOME/.guix-profile/include/c++:$HOME/.guix-profile/include/c++/x86_64-unknown-linux-gnu/ >> clang++ test.cc >> │ ./a.out >> └──── >> >> ┌──── >> │ Hello, World >> └──── >> >> 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.) > Hi Robin, I also found that section and the environment variable while debugging clang. I did not know about that variable even though its documented and Guix uses it. I've created a debug build of clang for investigating and pointing GCC_INSTALL_PREFIX to the GCC input and not the lib part fixes the problem for me. I don't know from where this build pulls crt1.o. I will try changing GCC_INSTALL_PREFIX in the guix package definition and see whether that fixes the bug. Tim.