[cfe-dev] Locating standard library when using -cc1

Marco Craveiro marco.craveiro at gmail.com
Sat Jul 14 14:06:49 PDT 2012


Daniel,

Many thanks for the prompt reply. This was extremely useful, I managed to
get my simple hello world to compile and to provide me with accurate code
completion. However, when I try the same trick with real code things don't
go so well. The steps I performed were:

- run using the GCC driver with your -### argument: clang
-fsyntax-only XYZ -###. All good.
- copy the entire command line returned and run it: all good.
- add -code-completion-at=XYZ to the command line: not so good.

I basically get lots and lots (and lots) of STL errors such as:

/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/alloc_traits.h:56:35:
error:
      in-class initializer for static data member is not a constant
expression
      static const bool __value = _S_chk<_Alloc, _Tp>(nullptr);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

These error does not appear to be triggered when I'm not
using -code-completion-at. They also do not appear with -code-completion-at
and my simple hello world, but, admittedly, the real code includes a fair
chunk of the standard library as opposed to the hello world which only
includes iostream.

Cheers

Marco

On 14 July 2012 21:22, Daniel Powell <d.c.powell at sms.ed.ac.uk> wrote:

> Hi
>
>
> I've installed llvm/clang 3.1 on my debian testing box and I must say its
>> working pretty well. I decided to be braver and use the completion mode in
>> emacs, which, if I understood things correctly, relies on the clang
>> compiler driver. The problem I have is that when I use the clang compiler
>> driver I it doesn't seem to be able to locate the standard library:
>>
> I ran into this issue myself a bit ago. I solved it by compiling normally
> (without -cc1) and use the -### argument. This will list the full commands
> used at compile time, including the arguments loading the standard library
> locations. I think it was the -internal-isystem and
> -internal-externc-isystem arguments you want to look out for, but there
> could be others.
>
> Hope that helps,
>
> Dan
>
>
> --
> --------
> Daniel Powell
> d.c.powell at sms.ed.ac.uk
> http://tinyurl.com/powelld
>
> The University of Edinburgh
> Institute for Computer Systems Architecture
>
>
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>


-- 
So young, and already so unknown -- Pauli

blog: http://mcraveiro.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120714/9ccf2995/attachment.html>


More information about the cfe-dev mailing list