all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Clang c++ include path
@ 2019-10-28  8:30 Mathieu Othacehe
  2019-10-28 17:58 ` Ricardo Wurmus
  0 siblings, 1 reply; 15+ messages in thread
From: Mathieu Othacehe @ 2019-10-28  8:30 UTC (permalink / raw)
  To: Guix-devel


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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Clang c++ include path
@ 2019-11-07  3:17 Protonmail Bridge
  0 siblings, 0 replies; 15+ messages in thread
From: Protonmail Bridge @ 2019-11-07  3:17 UTC (permalink / raw)
  To: ludo, guix-devel, m.othacehe

So here’s my naive suggestion:

We should have a MAKE-CLANG-TOOLCHAIN procedure that, given a clang package, a libc package, and a libc++ package (either libc++ or libstdc++), returns a fully-working clang toolchain.

I did encounter some problems while attempting this as you can see here: https://lists.gnu.org/archive/html/bug-guix/2019-11/msg00042.html

As Mathieu pointed out in that thread, the problem is probably that clang cannot find libstdc++ headers.

My first instinct is to use C{,PLUS}_INCLUDE_PATH and friends to solve this, but I remember trying this and it not working… Perhaps this needs to be a flag at compile/configure time for clang?

By the way, getting clang to work is the last piece I need to get Bitcoin Core release builds fully working on Guix, so I’ll be focusing on this and would appreciate any help I can get from you wizards!

Cheers,
Carl Dong

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Clang c++ include path
@ 2019-10-28  8:19 Mathieu Othacehe
  0 siblings, 0 replies; 15+ messages in thread
From: Mathieu Othacehe @ 2019-10-28  8:19 UTC (permalink / raw)
  To: Guix-devel

Message-ID: <87r22xxoy6.fsf@gmail.com>
User-agent: mu4e 1.2.0; emacs 26.3

https://issues.guix.info/issue/32773,
mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang t.cpp 
t.cpp:1:10: fatal error: 'string' file not found
mathieu@meru:~/tmp$ ~/.guix-profile/bin/clang -v t.cpp 
t.cpp:1:10: fatal error: 'string' file not found
mathieu@meru:~/tmp$ ~/.guix-profile/bin/g++ -v  t.cpp
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:
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---
#include <string>
         ^~~~~~~~
1 error generated.
--8<---------------cut here---------------end--------------->8---

that's because:

--8<---------------cut here---------------start------------->8---
...
#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>
         ^~~~~~~~
1 error generated.
--8<---------------cut here---------------end--------------->8---

whereas,

--8<---------------cut here---------------start------------->8---
...
#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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-11-13 17:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-28  8:30 Clang c++ include path Mathieu Othacehe
2019-10-28 17:58 ` Ricardo Wurmus
2019-10-28 22:08   ` Mark H Weaver
2019-10-28 22:48     ` Marius Bakke
2019-11-03 14:30     ` Ludovic Courtès
2019-11-07 16:29     ` Danny Milosavljevic
2019-11-07 17:34       ` Danny Milosavljevic
2019-11-07 18:43       ` Carl Dong
2019-11-07 19:52       ` Mark H Weaver
2019-10-29 15:37   ` Mathieu Othacehe
2019-11-11 15:12   ` David Truby
2019-11-11 17:17     ` Mathieu Othacehe
2019-11-13 16:59     ` David Truby
  -- strict thread matches above, loose matches on Subject: below --
2019-11-07  3:17 Protonmail Bridge
2019-10-28  8:19 Mathieu Othacehe

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.