guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clang c++ include path


From: Mathieu Othacehe
Subject: Clang c++ include path
Date: Mon, 28 Oct 2019 09:30:22 +0100
User-agent: mu4e 1.2.0; emacs 26.3

Hello,

When running clang on a c++ program, it cannot find c++ std libraries.
That's because, those libraries path are hardcoded inside g++ compiler
and clang cannot find them.

This has already been discussed here:
https://issues.guix.info/issue/32773, without reaching a solution.

Running this program,

--8<---------------cut here---------------start------------->8---
#include <string>

int main()
{
  return 0;
}
--8<---------------cut here---------------end--------------->8---

I have this error:

--8<---------------cut here---------------start------------->8---
mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang t.cpp 
#include <string>
         ^~~~~~~~
t.cpp:1:10: fatal error: 'string' file not found
1 error generated.
--8<---------------cut here---------------end--------------->8---

that's because:

--8<---------------cut here---------------start------------->8---
mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang -v t.cpp 
...
#include "..." search starts here:
#include <...> search starts here:
 /gnu/store/933ijsm5wwjkvlh963lc3pxc7i3dfxcp-profile/include
 /gnu/store/i2vzqb02gxcm5c2zix92lq3ay73kbl9s-clang-8.0.0/lib/clang/8.0.0/include
 /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/include
End of search list.
#include <string>
         ^~~~~~~~
t.cpp:1:10: fatal error: 'string' file not found
1 error generated.
--8<---------------cut here---------------end--------------->8---

whereas,

--8<---------------cut here---------------start------------->8---
mathieu@meru:~/tmp$ ~/.guix-profile/bin/g++ -v  t.cpp
...
#include "..." search starts here:
#include <...> search starts here:
 /gnu/store/933ijsm5wwjkvlh963lc3pxc7i3dfxcp-profile/include
 /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++ [1]
 
/gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++/x86_64-unknown-linux-gnu
 [2]
 /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/include/c++/backward [3]
 
/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/include
 
/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/include-fixed
 /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/include
...
--8<---------------cut here---------------end--------------->8---

Hardcoding the paths [1], [2] and [3] into clang would solve the
issue, but it might not be the better way to proceed. WDYT?

Mathieu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]