Search code examples
cygwinclangclang-format

Clang-format installed via Cygwin won't run


When I try running clang-format in the Cygwin64 terminal, I get the following output:

$ clang-format
: CommandLine Error: Option 'disable-symbolication' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

I also cannot run it in Git Bash, getting the following output:

$ clang-format
      1 [main] clang-format (2208) C:\cygwin64\bin\clang-format.exe: *** fatal error - cygheap base mismatch detected - 0x180301410/0x1802FD410.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.

I only have one cygwin1.dll in C:\cygwin64\bin, and rebooting doesn't help.

clang --version gives:

$ clang --version
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-unknown-windows-cygnus
Thread model: posix
InstalledDir: /usr/bin

Solution

  • This is not much of an answer, but it's what I ended up doing. And it was a little tricky, so I'm going to document it here.

    Note, I actually downgraded doxygen, because the latest was dependent on clang-format-5

    Uninstall clang 5.0.1-2
    Uninstall doxygen 1.8.14-2 (automatically added)
    Uninstall libclang5.0 5.0.1-2
    Uninstall vim-clang-format 4.0.1-1
    Install doxygen 1.8.13-3
    

    Then (press Back)

    Uninstall clang 5.0.1-2 (automatically added)
    Uninstall doxygen 1.8.13-3 (automatically added)
    Install clang 4.0.1-1
    Install doxygen 1.8.13-3
    

    After all that, although there is no-longer an entry for clang-format, I clang-format-4.0.1 is on my computer and operational.