unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <m.othacehe@gmail.com>
To: Guix-devel <guix-devel@gnu.org>
Subject: Clang c++ include path
Date: Mon, 28 Oct 2019 09:30:22 +0100	[thread overview]
Message-ID: <87wocpz2zl.fsf@gmail.com> (raw)


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	other threads:[~2019-10-28  8:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28  8:30 Mathieu Othacehe [this message]
2019-10-28 17:58 ` Clang c++ include path 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

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=87wocpz2zl.fsf@gmail.com \
    --to=m.othacehe@gmail.com \
    --cc=guix-devel@gnu.org \
    /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).