ccls icon indicating copy to clipboard operation
ccls copied to clipboard

ccls built with msys2 may not work

Open Growlith1223 opened this issue 5 years ago • 8 comments

Program compiles successfully(no errors when compiling with either gcc or clang), but when launched, Vscode shows it can't be started and when launching manually pops up with this message. i feel like it's me being stupid and im forgetting something but i can seem to figure it out. i've tried with both building llvm/clang myself, and using MSYS2's version. all crash with the same error.

image

Expected behavior

To be able to run said application

Steps to reproduce

Doesn't matter what compiler i use, if they are successful at compiling, it crashes when launched

System information

  • ccls version (git describe --tags --long): (No names found, strange) Commit 64f9dbd
  • clang version: 8.0.0 | gcc 8.3.0
  • OS: Windows 10 Home Edition 64-bit
  • Editor: VS Code
  • Language client (and version): (not sure i understand this one)

Growlith1223 avatar Apr 11 '19 19:04 Growlith1223

That message looks odd, but it might be related to that fact, that windows use different main functions for different applications. There is a convention, that console applications use main, GUI apps- WinMain and ddls - DllMain.

You may give a try and create WinMain function (https://docs.microsoft.com/en-us/windows/desktop/learnwin32/winmain--the-application-entry-point) which will call default main. It may not work, but at least we will have some clues.

INT WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    PSTR lpCmdLine, INT nCmdShow)
{
    return main(nCmdShow, lpCmdLine);
}

or maybe try this - https://stackoverflow.com/a/49325056

myrgy avatar May 22 '19 06:05 myrgy

Hi@Growlith1223 , any progress with your issue?

myrgy avatar Jun 10 '19 12:06 myrgy

Sorry, i meant to get back to you the first day but i ended up forgetting, i've tried both solutions, using the win32 entry point compiles fine as usual, but crashes with the same error.

As for the second solution, it comes up with: https://hastebin.com/otujurudok.makefile

I should mention i've tried with various compilers and they all come up with the same error

Growlith1223 avatar Jun 11 '19 06:06 Growlith1223

I've used the program before, and it compiled and ran just fine then, but ended up losing the folder due to windows re-installation, and ever since then, haven't been able to get it to run

EDIT: I can compile literally anything else perfectly fine, i can even compile my own engine and other things perfectly fine, it's just this project i can't compile for some reason lol

Growlith1223 avatar Jun 11 '19 06:06 Growlith1223

I'll try to setup build using appveyor

myrgy avatar Jun 26 '19 13:06 myrgy

I get a similar error, I built ccls in msys2 (installed using scoop) according to the instructions and it went fine It even starts properly in the msys2 mingw64 terminal, however when I try to launch ccls from powershell running in alacritty it crashes (gdb shows "During startup program exited with code 0xc0000139", which duckduckgo tells me could be related to msys2) Double-clicking ccls.exe in explorer gives me this error image Also both of @myrgy's suggested solutions are for windows build tools and apis so I can't use them:

  • The typedefs needed for WinMain aren't present in main.cc
  • The cmake options in the stackoverflow answer linked in his answer seem to have windows-style flags, probably for link.exe. Since msys2 builds build using gnu or llvm tools (not sure which one. EDIT: it's gnu) it's irrelevant for me

ohmree avatar Aug 12 '19 21:08 ohmree

Hi! I built ccls in msys2 and get the same error when I try to start ccls. Looking for similar errors, found that if you put directly the ccls.exe in your msys64\mingw64\bin it works fine. Hope it can help!

yoacompsci avatar May 02 '21 11:05 yoacompsci

Had the same issue. ccls/Release is missing two lib files it seems: libclang.dll and libstdc++-6.dll. Works fine (like mentioned above) once you get a copy of these from msys64/mingw64/bin.

ennkp avatar Oct 23 '22 19:10 ennkp