- MSVC 2015, cl should report > 19.*
- Python 2 (required by libuv to get gyp) - python 3 will not work, see the issue
- Git (required by libuv to get gyp)
- You might need the Windows 10 SDK to be installed (unverified, please drop me a comment in #810, specially if you are in Windows8 or lower.)
Assuming you have all of the above, just get my work branch
git clone https://github.com/equalsraf/neovim.git cd neovim git checkout tb-win32-any
Building Neovim dependencies
Before we can build Neovim we need to build some static dependencies, from the Neovim src folder do the following
mkdir .deps cd .deps cmake ..\third-party\ cmake --build . --config Release
If CMake complains that it cannot find Python, include the path to python.exe like this
Go back to the main Neovim source directory and do the following
mkdir build cd build cmake .. cmake --build . --config Release
nvim.exe should be in the bin/ folder. The windows version does not have a Terminal UI right now so you will need to use one of the available Neovim remote UIs (Atom, neovim-qt, python-client, ??).
Running the tests
The unit tests are not working, but the functional tests are. Some will fail for sure. After calling the initial cmake you can
cmake --build . --target functionaltest --config Release
Most likely this WILL GET STUCK. Check TEST_FILE to call a specific test.
Sometimes when building libuv, gyp will fail to use the correct version of visual studio and attempt to use another instead, e.g.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please ins tall Visual Studio 2010 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...". [E:\repos\neovim\.deps\build\src\l ibuv\uv_dtrace_provider.vcxproj] NMAKE : fatal error U1077: 'call' : return code '0x1'
You can force the correct version with an environment variable
e.g. if you see errors like this you are using multiple runtimes across different libraries
error LNK2005: ___scrt_acquire_startup_lock already defined in LIBCMTD.lib
See http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx bottom line is you must NOT mix runtimes, i.e. all components MUST be built using the same runtime - right now I am using /MT or /MTd for Neovim (usually /MTd since builds default to Debug). Also some tricks to try and debug issues here
- Also /VERBOSE:LIB may be helpful
- Do not mix static (/MT) from different MSVC compilers, the result will not be pretty (e.g. undefined reference to snprintf)
Another variation of the same issue is
Debug Assertion Failed (_osfile(fh) & FOPEN)
This one trickier because it is a runtime exception, rather than a compile time error.
CMake build fails and the output is useless
When using the VS generator raise verbosity like this
cmake --build . -- /verbosity:detailed.
Another alternative is to use cmake with the nmake generator, add
-G "NMake Makefiles" to the initial cmake commands, but requires the cl/nmake commands to be in your PATH (e.g. call vcvarsall32.bat). Use nmake VERBOSE=1 to build.