andy-5 / wslgit

Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)
MIT License
1.19k stars 59 forks source link

Error: "The application was unable to start correctly (0xc000007b)" #49

Closed aalaap closed 5 years ago

aalaap commented 5 years ago

I keep getting the following Windows error whenever I run wslgit.exe:

The application was unable to start correctly (0xc000007b)

Some searching suggested that it is usually the result of mixing 32-bit and 64-bit environments. However, I'm using a 64-bit Windows 10 Pro build 17134.286, so that's probably not it.

The output of wslconfig.exe /l is as follows:

Windows Subsystem for Linux Distributions:
Ubuntu (Default)

It's the one from the store, installed just a couple of months ago. I am able to run wsl.exe from a command line just fine, but not wslgit.exe.

andy-5 commented 5 years ago

Maybe you've got a corrupted download? Have you tried re-downloading wslgit?

aalaap commented 5 years ago

I've downloaded it a few times, once using the browser and once using a download manager. It still doesn't work. I'll try and older version now.

Update: It's the same error with versions 0.5.0, 0.4.0 in addition to the latest 0.6.0.

andy-5 commented 5 years ago

As a reference, the md5sum of the latest release (0.6.0) is:

$ md5sum wslgit.exe 
a4ae947f701e8eeadf8c5d2208f80e6f  wslgit.exe
aalaap commented 5 years ago

The MD5 sum does match.

a4ae947f701e8eeadf8c5d2208f80e6f wslgit-0.6.0.exe
dd3a666dfc1ddf852657031621cf4a6f wslgit-0.5.0.exe
89c7a9403e5fa360659195cb1df2b078 wslgit-0.4.0.exe
andy-5 commented 5 years ago

Yes, unfortunately I've no idea what else could cause this error.

aalaap commented 5 years ago

Thanks for the help.

For the time being, I've resorted to creating a batch script called wslgit.cmd, containing the following:

@wsl git %*

I set the Visual Studio Code git.path to this script and it seems to be working just fine.

Update: Don't do this.

andy-5 commented 5 years ago

Yes, this may work for some cases, but some commands may need WSL paths be translated to their Windows equivalent (or VS Code learned to handle WSL paths?)

If you want to investigate the error further, this answer on StackOverflow suggests to use a tool called dependency walker.

aalaap commented 5 years ago

Ah, of course. I knew there had to be a catch.

I tried Dependency Walker and it gave me a list of several hundred "missing" files related to "API-Win-Core...". Looking those up suggested that they're some SDK files, which aren't to be included as normal Windows DLLs. These represent some 'architectural changes' between versions of Windows... and that's where I gave up.

Basically, I'll have to stick to using Git for Windows.

andy-5 commented 5 years ago

Those files are an implementation detail of the Windows API, and it seems DependencyWalker does not properly handle them. So these should actually be fine.

But the linked answer points to a new tool which should handle them correctly: https://github.com/lucasg/Dependencies

Maybe you can use that tool to find out if there are any actual problems.

aalaap commented 5 years ago

I tried the new Dependencies tool. Even that didn't work at first, giving a missing ClrPhlib error, the solution to which was installing the Microsoft Visual C++ Redistributable for Visual Studio 2017. Dependencies worked after that, but upon inspecting wslgit.exe, it reported no errors - nothing missing or misconfigured.

Then, I went back and simply tried to run wslgit.exe as is and it worked! 😄

Thanks again for your help. I am uninstalling Git for Windows for the last time, hopefully!

andy-5 commented 5 years ago

Great! Glad I could help. So it seems the latest Microsoft Visual C++ Redistributable for Visual Studio 2017 is required also for wslgit.

aalaap commented 5 years ago

Yeah, it's probably worth mentioning in the README. The first thing I think of with an error such as this is a missing DLL, but seeing that you didn't mention any redistributable requirement in the docs, I assumed something else was the problem.

andy-5 commented 5 years ago

Yes, I will add it to the README soon.

Up until now I was unaware of this dependency, there haven't been any issues so far (because most people probably have these libraries installed as part of some other software). The reason for the dependency is likely the fact that Rust on Windows uses Microsoft's linker to link the final executable.

Thank you for reporting and investigating this issue.