[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32773: clang: missing default include paths for C++
From: |
Tim Gesthuizen |
Subject: |
bug#32773: clang: missing default include paths for C++ |
Date: |
Sun, 23 Sep 2018 19:10:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 22.09.2018 02:58, Robin Templeton wrote:
> Hi Tim,
>
> Tim Gesthuizen <address@hidden> 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.