Setting compiler to clang is not working

65 views
Skip to first unread message

Wink Saville

unread,
Jul 22, 2016, 1:04:11 PM7/22/16
to vim-syntastic
I'm doing something wrong, I tried to do the following in my .vimrc:

  let g:syntastic_c_compiler = 'clang'

But it didn't work because I'm getting an error only gcc detects

  offset of packed bit-field 'traffic_class' has changed in GCC 4.4

I can suppress that message using

  let g:syntastic_c_compiler_options = '-Wno-packed-bitfield-compat'

So I seem to be doing something right.

But I'd rather have syntastic use clang which generally outputs better error messages.

Thanks,

Wink

LCD 47

unread,
Jul 22, 2016, 1:12:54 PM7/22/16
to vim-syntastic
On 22 July 2016, Wink Saville <wi...@saville.com> wrote:
> I'm doing something wrong, I tried to do the following in my .vimrc:
>
> let g:syntastic_c_compiler = 'clang'

That's the right (and only) way to do it. Not sure what else to
tell you without logs.

> But it didn't work because I'm getting an error only gcc detects
>
> offset of packed bit-field 'traffic_class' has changed in GCC 4.4
>
> I can suppress that message using
>
> let g:syntastic_c_compiler_options = '-Wno-packed-bitfield-compat'
>
> So I seem to be doing something right.
>
> But I'd rather have syntastic use clang which generally outputs better
> error messages.

To see how syntastic runs the checkers enable debugging and read the
logs (see ":h syntastic-debug" in recent versions of syntastic).

To change how syntastic runs the checkers set the various checker
options.

Please note that syntastic will still name the checker "gcc", even
when it's actually running "clang".

/lcd

Wink Saville

unread,
Jul 22, 2016, 1:44:05 PM7/22/16
to vim-syntastic
Thanks for the quick reply!!!

I turned on debugging:

  let g:syntastic_debug = 255

And I see this in the logs

  syntastic: 2.765984: c/gcc: g:syntastic_c_compiler = 'x86_64-elf-gcc'

So I do have this compiler and use it in this project, but where is syntastic picking this up and how would I override it.

LCD 47

unread,
Jul 22, 2016, 1:57:24 PM7/22/16
to vim-syntastic
On 22 July 2016, Wink Saville <wi...@saville.com> wrote:
> Thanks for the quick reply!!!
>
> I turned on debugging:
>
> let g:syntastic_debug = 255

It might be a good idea to read the manual before getting drowned in
irrelevant logs. For your purpose, you want 33 rather than 255.

> And I see this in the logs
>
> syntastic: 2.765984: c/gcc: g:syntastic_c_compiler = 'x86_64-elf-gcc'
>
> So I do have this compiler and use it in this project, but where is
> syntastic picking this up and how would I override it.

Then you have a plugin (or some forgotten piece of config) that sets
g:syntastic_c_compiler to that value. Syntastic itself never sets it to
anything else than "gcc" or "clang".

/lcd

Wink Saville

unread,
Jul 22, 2016, 6:42:54 PM7/22/16
to vim-syntastic

> And I see this in the logs
>
>   syntastic: 2.765984: c/gcc: g:syntastic_c_compiler = 'x86_64-elf-gcc'
>
> So I do have this compiler and use it in this project, but where is
> syntastic picking this up and how would I override it.

    Then you have a plugin (or some forgotten piece of config) that sets
g:syntastic_c_compiler to that value.  Syntastic itself never sets it to
anything else than "gcc" or "clang".

I did have a "forgotten" config, I had a .local.vimrc which set the compiler to x86_64-elf-gcc.

Thank you very much for the help.
Reply all
Reply to author
Forward
0 new messages