Hi Tim, Tim Gesthuizen <tim.gesthui...@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.)