unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Tim Gesthuizen <tim.gesthuizen@yahoo.de>
To: Robin Templeton <robin@igalia.com>
Cc: 32773@debbugs.gnu.org
Subject: bug#32773: clang: missing default include paths for C++
Date: Sun, 23 Sep 2018 19:10:31 +0200	[thread overview]
Message-ID: <442d716d-abda-b079-f548-353328868839@yahoo.de> (raw)
In-Reply-To: <87fty2wdnx.fsf@terpri.org>

On 22.09.2018 02:58, Robin Templeton wrote:
> Hi Tim,
> 
> Tim Gesthuizen <tim.gesthuizen@yahoo.de> 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.

  reply	other threads:[~2018-09-23 17:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19 18:23 bug#32773: clang: missing default include paths for C++ Tim Gesthuizen
2018-09-19 18:33 ` Pjotr Prins
2018-09-19 18:47   ` Tim Gesthuizen
2018-10-08 13:51     ` fis trivial
2018-09-22  0:58 ` Robin Templeton
2018-09-23 17:10   ` Tim Gesthuizen [this message]
2019-11-13 16:56 ` bug#32773: [PATCH] Fix clang libstdc++ header location search David Truby
2019-11-13 19:50   ` Carl Dong
2019-11-14 10:30   ` Mathieu Othacehe
2019-11-14 13:22     ` David Truby
2019-11-14 13:40       ` Mathieu Othacehe
2019-11-14 16:16         ` David Truby
2019-11-14 16:54           ` Mathieu Othacehe
2019-11-14 17:03             ` David Truby
2019-11-15  8:42               ` Mathieu Othacehe
2019-11-17 11:21                 ` Mathieu Othacehe
2019-11-19 13:08                   ` David Truby
2019-11-19 15:30                     ` Mathieu Othacehe
2019-11-17 19:29         ` Ludovic Courtès
2019-11-17 19:23     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=442d716d-abda-b079-f548-353328868839@yahoo.de \
    --to=tim.gesthuizen@yahoo.de \
    --cc=32773@debbugs.gnu.org \
    --cc=robin@igalia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).