Skip to content

Building on windows does not work as described in wiki #964

Open
@Frederico-Esch

Description

@Frederico-Esch

The build steps described here: wiki/Project-Setup do not work anymore.

Somethings I did to actually build it.

  • Mingw apparently does not work as explained there, and I could not make it work anyway.
  • I could build ccls, building llvm from source, but I had to change somethings
  1. Make sure you do not have any clang in your path, be it from Visual Studio or llvm-binaries (I don't know if this step is necessary, but for me it was causing some conflict)
  2. Build llvm with:
git clone https://github.com/llvm/llvm-project.git --depth=1
cd llvm-project
cmake -Sllvm -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PROJECTS=clang
ninja -C Release clangFormat clangFrontendTool clangIndex clangTooling clang

Somethings to take note, the -H flag does not exist anymore, it is now -S, building llvm was pretty straight-forward if you knew about the flag deprecation.

  1. Build ccls with:
git clone https://github.com/MaskRay/ccls.git
cd ccls

git submodule init
git submodule update

cmake -S. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_PREFIX_PATH="E:/Aplicativos/llvm-project/Release"
ninja -C Release

I had to initialize and update the submodule to actually make it work. About the cmake call, I had to change the -H to -S as stated before, and another relevant thing was setting both the CXX and C compiler to clang, since if you don't define CMAKE_C_COMPILER it will automatically use MSVC and it will conflict and abort the build.

I don't know how to push a fix to wiki so I'm just submitting a issue with the fix that worked for me, if anyone wants to validate by trying to replicate it and update the wiki I'd be thankful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions