Loading ...
Sorry, an error occurred while loading the content.

Clang and clang_complete plugin / Cygwin

Expand Messages
  • Michael Ludwig
    Cygwin has started distributing the Clang compiler in January: [ANNOUNCEMENT] New package: llvm/clang-3.0-1 http://cygwin.com/ml/cygwin/2012-01/msg00453.html I
    Message 1 of 3 , Apr 4, 2012
    • 0 Attachment
      Cygwin has started distributing the Clang compiler in January:

      [ANNOUNCEMENT] New package: llvm/clang-3.0-1
      http://cygwin.com/ml/cygwin/2012-01/msg00453.html

      I installed the Cygwin clang packages and the clang_complete Vim
      plugin from Github.

      http://www.vim.org/scripts/script.php?script_id=3302
      https://github.com/Rip-Rip/clang_complete

      Then a simple test:

      #include <iostream>
      int main(void) {
      std:: // <= second colon triggers completion
      }

      But alas, no completion; instead, an error; calling :messages reveals:

      E486: Muster nicht gefunden: 686

      That means "Pattern not found".

      The error list for clang_complete contains:

      tmp.cpp|| unknown argument: '-mtune=generic'
      tmp.cpp|| unknown argument: '-march=i686'

      I have grepped the plugin source for these options: they're not there.
      I don't have them in my environment variables either. There's some
      Python code coming with the plugin; haven't understood out how it all
      ties together. Is anyone using this plugin on Cygwin and has figured
      out how to avoid running into this error?

      Michael

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Michael Ludwig
      ... I got it working! :) And it rocks big time! ... The gcc feature has to be removed because it gets it wrong: let g:clang_auto_user_options= path,
      Message 2 of 3 , Apr 6, 2012
      • 0 Attachment
        Michael Ludwig schrieb am 05.04.2012 um 01:35 (+0200):
        >
        > I installed the Cygwin clang packages and the clang_complete Vim
        > plugin from Github.
        >
        > http://www.vim.org/scripts/script.php?script_id=3302
        > https://github.com/Rip-Rip/clang_complete
        >
        > Then a simple test:
        >
        > #include <iostream>
        > int main(void) {
        > std:: // <= second colon triggers completion
        > }
        >
        > But alas, no completion; instead, an error; calling :messages reveals:
        >
        > E486: Muster nicht gefunden: 686
        >
        > That means "Pattern not found".
        >
        > The error list for clang_complete contains:
        >
        > tmp.cpp|| unknown argument: '-mtune=generic'
        > tmp.cpp|| unknown argument: '-march=i686'

        I got it working! :) And it rocks big time!

        The issue was the following:

        :help clang_complete-auto_user_options

        | An example of custom option sources is bundled with clang_complete and
        | called "gcc". This source runs gcc to get a list of include paths. The
        | list of include paths for each of supported filetypes (c, cpp, objc
        | and objcpp) is cached on a disk and can be removed by calling
        | ClearGCCIncludeCaches() function (for changes to take affect one needs
        | to reread buffers using the :edit command or something equivalent).
        | Default: "path, .clang_complete, gcc"

        The "gcc" feature has to be removed because it gets it wrong:

        let g:clang_auto_user_options='path, .clang_complete'

        The reason is that the "gcc" feature does the following:

        echo | cpp -v -x c++
        echo | cpp -v -x c

        The last line of the cpp output has the unwanted options:

        COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=i686'

        Not sure how exactly that ends up as part of the clang options.
        Maybe some parsing bug.

        Michael

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Michael Ludwig
        ... It rocks even more using libclang instead of the clang executable. In order for that to happen, I downloaded the Vim tarball and recompiled as follows:
        Message 3 of 3 , Apr 6, 2012
        • 0 Attachment
          Michael Ludwig schrieb am 06.04.2012 um 16:47 (+0200):
          > Michael Ludwig schrieb am 05.04.2012 um 01:35 (+0200):
          > >
          > > I installed the Cygwin clang packages and the clang_complete Vim
          > > plugin from Github.

          > I got it working! :) And it rocks big time!

          It rocks even more using libclang instead of the clang executable.
          In order for that to happen, I downloaded the Vim tarball and
          recompiled as follows:

          ./configure --prefix=/usr/local \
          --with-features=huge \
          --enable-pythoninterp \
          --enable-gui=no --without-x \
          --enable-multibyte \
          --with-tlib=ncursesw

          I added these, but they're not necessary for libclang to work:

          --enable-perlinterp \
          --enable-rubyinterp \

          Clang completion in Vim, this is huge!

          Michael

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        Your message has been successfully submitted and would be delivered to recipients shortly.