Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Cygwin #873

Closed
PhilipDaniels opened this issue Jun 20, 2014 · 33 comments
Closed

Windows: Cygwin #873

PhilipDaniels opened this issue Jun 20, 2014 · 33 comments

Comments

@PhilipDaniels
Copy link

@PhilipDaniels PhilipDaniels commented Jun 20, 2014

When attempting to compile under Cygwin (64 bit, gcc 4.9.0, CMake 2.8.11.2) the "make cmake" steps fails with the following error.

[  2%] Performing build step for 'libuv'
make[5]: Entering directory '/c/Users/Phil/repos/neovim/.deps/build/src/libuv-build'
make[6]: Entering directory '/c/Users/Phil/repos/neovim/.deps/build/src/libuv-build'
  CC       src/libuv_la-fs-poll.lo
In file included from /c/Users/Phil/repos/neovim/.deps/build/src/libuv/include/uv.h:61:0,
                 from /c/Users/Phil/repos/neovim/.deps/build/src/libuv/src/fs-poll.c:22:
/c/Users/Phil/repos/neovim/.deps/build/src/libuv/include/uv-unix.h:145:9: error:     unknown type name 'pthread_barrier_t'
 typedef pthread_barrier_t uv_barrier_t;

Makefile:1474: recipe for target 'src/libuv_la-fs-poll.lo' failed

Justin Keyes replied on the mailing list:
"It's unlikely to compile on cygwin, in the near term or possibly ever. It might not even be desirable, because a cygwin-compatible frontend can talk to a MinGW-compiled or MSVC-compiled backend (nvim process) over TCP."

Alas, I don't have the knowledge to fix this so there is unlikely to be much progress from me. However, I would like to point out that Cygwin currently does have its own Vim and it would be great if it could have its own neovim as well without having to jump through hoops.

There is a related issue regarding compiling under MinGW/MSVC: #696

@justinmk justinmk added this to the vNext milestone Jun 20, 2014
@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented Jun 20, 2014

Cheers

It seems it is having issues building libuv, you might be interested in #810 that deals with mingw, also there is this old issue about cygwin in libuv - joyent/libuv#845 that suggests libuv does not build in cygwin due to a lack of pthread compatibility in cygwin.

@nowox
Copy link

@nowox nowox commented Jan 29, 2015

I do have exactly the same issue with neovim and cygwin. It would be great to find a workaround

@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented Jan 29, 2015

@nowox the issue above mentions another one - JuliaLang/julia#8902 that talks about cross compile (have not checked in depth). I don't have a cygwin environment here, do you have any idea if that is possible?

@tkelman
Copy link

@tkelman tkelman commented Feb 17, 2015

If you can build in MSYS (1 or 2), or cross-compile from Linux to Windows using MinGW-w64, then generally you can cross-compile from Cygwin to MinGW as well - use x86_64-w64-mingw32-gcc or i686-w64-mingw32-gcc after installing the appropriate mingw64 Cygwin packages. Might require some minor build system tweaks to make it understand how to do cross-compilation properly.

@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented Feb 17, 2015

We can cross compile from Linux to Windows with a Mingw cross compiler, I have not tested with MSYS in a while - I think the dependencies were failling to build, but this was a long time ago.

@tkelman
Copy link

@tkelman tkelman commented Feb 17, 2015

Is that on master or all in #810 still? Might just try the same cross-compile recipe under Cygwin and see if it works.

Also for Travis use in #810 you may find this PPA useful: https://launchpad.net/~tobydox/+archive/ubuntu/mingw-x-precise

@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented Feb 17, 2015

Is that on master or all in #810 still? Might just try the same cross-compile recipe under Cygwin and see if it works.

In #810.

@aikeru
Copy link

@aikeru aikeru commented May 26, 2015

Having a cygwin (or perhaps an MSYS2) neovim package accessible to users is a huge deal, especially since "terminal vim" on Windows isn't a priority for neovim. I use cygwin vim almost exclusively (gvim on rare occaisions).

My use case is that I have plugins with native components compiled under cygwin used by vim as well as using all of the terminal-related goodness you get from bash shell in POSIX environment (ie: running under tmux or connecting via ssh or using *nix tools).
In switching to neovim, what I'm hoping for would be to just copy my .vimrc to .nvimrc load it up and go!

Would contributing to the bounty on this issue be a good way to help achieve this use case for neovim?

@justinmk
Copy link
Member

@justinmk justinmk commented May 26, 2015

No, sorry. If someone wants to take ownership of cygwin compatibility, it's welcome, but I don't know anyone who has interest in it. I use Windows 40 hrs/week and I can tell you that msysgit with ancient bash 3.x causes me less pain than cygwin.

Neovim will certainly support set shell=/foo/bar/cygwin, so you can still use cygwin tools via :! from the GUI.

all of the terminal-related goodness you get from bash shell in POSIX environment (ie: running under tmux or connecting via ssh

How is ssh related to cygwin-native nvim?

Re: tmux, it would be better to spend efforts trying to support :term on Windows than trying to support cygwin.

or using *nix tools).

You can use the cygwin unix tools via :! in the GUI, by setting &shell as appropriate.

@tkelman
Copy link

@tkelman tkelman commented May 27, 2015

msysgit with ancient bash 3.x causes me less pain than cygwin

Seriously? When was the last time you used cygwin? It's much nicer than it used to be. In fact the "msys1 was so awful broken and unmaintained that we desperately needed a replacement" project MSYS2 is a very lightly modified fork of latest cygwin at its core.

@aikeru the limiting factor is most likely libuv here. Libuv won't build on Cygwin, while the error message you get is pthread-related, that can be fixed (libuv has some workarounds for OS X and BSD which also don't have pthread_barrier) - what can't be fixed so easily is the lack of async IO in cygwin's posix layer.

As I said a few months ago, generally if you can cross-compile something from Linux-to-MinGW-w64 you can cross-compile it from Cygwin with a very similar process.

@nowox
Copy link

@nowox nowox commented May 27, 2015

Frankly speaking I think that NeoVim has the huge potential to become a noble successor to Vim, but it has to be as multiplatform as Vim is. If NeoVim depends on libuv and libuv is not multiplatform this sounds like a failure of the NeoVim's implementation. In this case workarounds must be found to get an emulation layer of what NeoVim requires in libuv.

Cygwin has much evolved since the begining and it is a fairly stable POSIX emulation platform now. I am using it everyday without much trouble. I really think that NeoVim has to be accessible to this platform and on any platform even the non-POSIX ones. This is what Vim is and this is what NeoVim has to be.

@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented May 27, 2015

Cygwin has much evolved since the begining and it is a fairly stable POSIX emulation platform now. I am using it everyday without much trouble. I really think that NeoVim has to be accessible to this platform and on any platform even the non-POSIX ones. This is what Vim is and this is what NeoVim has to be.

At this point #810 compiles with MSVC/MSYS2/Mingw. There is no reason why you can't set the proper &shell settings to point to your Cygwin shell and tools i.e. a Neovim version built in other environment should still work with the Cygwin tools.

@nowox while I understand, and agree with you (this being one of the reasons I hang around), it would be equally effective to submit patches for reintroducing Cygwin support in libuv since that also helps support other Neovim components like the lua-client.

As I said a few months ago, generally if you can cross-compile something from Linux-to-MinGW-w64 you can cross-compile it from Cygwin with a very similar process.

@tkelman I took a quick glance at JuliaLang/julia, if mingw packages are available for Cygwin then one could call CMake with the same parameters as the Mingw build (and cross fingers, hoping the shell does not confuse CMake)

My time around Windows boxes is limited, so I can't test for all possible combinations of compiler/environment. If anyone can give it a spin on Cygwin and let us know that would be nice 😜

@tkelman
Copy link

@tkelman tkelman commented May 27, 2015

patches for reintroducing Cygwin support in libuv

My best shot was at tkelman/libuv@641887f - unfortunately all the epoll, inotify, etc async io syscalls are not present. You could maybe try grafting together parts of the cygwin posix API with using the native win32 IOCP API for async functionality, but it would be messy and probably ill-advised.

if mingw packages are available for Cygwin

The cross-compilers are available. Not many libraries are though, but you can build them. It may take a few patches but it's certainly worth a shot. There's even some code in libuv that helps with distinguishing cygwin's named pipes, so you can use native console programs (like a mingw-compiled neovim, in theory) interactively in cygwin's mintty.

@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented May 27, 2015

The cross-compilers are available. Not many libraries are though, but you can build them.

Thats fine we build third-party libs statically anyway.

@PhilipDaniels
Copy link
Author

@PhilipDaniels PhilipDaniels commented May 27, 2015

@tkelman There are a couple of libraries I came across recently called libevent and libev http://software.schmorp.de/pkg/libev.html which abstract away from epoll etc. Sorry, I don't know if they work on Cygwin and you may have a struggle to get them accepted into libuv.

@PhilipDaniels
Copy link
Author

@PhilipDaniels PhilipDaniels commented May 27, 2015

The POSIX APIs that are unsupported in Cygwin can be seen here https://cygwin.com/cygwin-api/std-notimpl.html

@tkelman
Copy link

@tkelman tkelman commented May 27, 2015

libevent is available for cygwin, though as I understand it libuv [edit: since 2012, see below] was designed as a replacement for libevent rather than to be used alongside / on top of it. libuv doesn't strictly use posix API's, it uses specific code paths for Linux vs different flavors of BSD vs Win32.

@tkelman
Copy link

@tkelman tkelman commented May 27, 2015

Or rather, libuv formerly used libev on unix, up until 2012 - see http://nikhilm.github.io/uvbook/introduction.html#background and joyent/libuv#485

@aikeru
Copy link

@aikeru aikeru commented May 27, 2015

@justinmk just in case it wasn't clear, I meant, you can have a Windows machine running cygwin's sshd daemon. If you live in cygwin, *nix style paths work /foo/bar/baz as do symbolic links, for example. If cygwin/vim wants to call out to ruby/python/etc., cygwin has python/ruby/etc. packages and these work and behave as though they were all playing together nicely in a *nix style environment. I can have my tmux (or screen) + vim + OS-as-an-IDE workflow, even on Windows. *nix and Windows tools seem to handle stdin/out diffrerently but they work fine if they're all under cygwin.
I'm not a Linux system programmer (more a .NET business programmer) so there are aspects of this I don't fully understand, but the difference is tangible when using tools-compiled-on-Windows-for-Windows vs tools-compiled-on-Cygwin.

The Windows shell is so horribly terrible and any knowledge of *nix tooling ports over since I use Linux or Mac OS at home. I actually have a PowerShell script that download cygwin, and all the packages I need so I can just plug in and go.

Libuv is also used by node.js (didn't they write that anyhow?), and I understand that the MSYS2 folks have a way to compile node.js under that. I've played with it, and if I can get NeoVim there I'd be thrilled. NeoVim's goals are hugely important to Vim's continued success and adoption. Without NeoVim, I'm forced to consider other editors with vim binding implementations, because there's just too much productivity-saving stuff out there that's difficult to achieve with vim without good async/multi-thread support - that said, there's nothing else quite like vim/cygwin or vim/MSYS2 on Windows.

@cosminadrianpopescu
Copy link

@cosminadrianpopescu cosminadrianpopescu commented Sep 13, 2015

I also subscribe to this. NeoVim should also work on cygwin.

I use cygwin pretty much in the same way as @justinmk: tmux, vifm, some python servers, vim, ssh (putty doesn't even comes close). You cannot possibily replace this with anything windows command prompt + gvim + neovim (MSVS build) has to offer. Unfortunatelly I don't have the time to contribute code to such a big project but I do contribute money to it (10$ / a month). If anybody wants to take the cygwin issue I am also willing to contribute money for this specific issue.

I hope that finally we will have a cygwin native implementation of neovim. Until then, unfortunatelly I cannot do the switch from VIM (I cannot have neovim at home and on my servers and VIM at work).

@rhopping73
Copy link

@rhopping73 rhopping73 commented Nov 24, 2015

What's great about threads like this, I always learn something new about vim that makes me love it even more. I wish all the best to neovim, but for now I will also stick with cygwin/vim when on my Windows host.

@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented May 3, 2016

Thanks @njman for linking the libuv issue here.

I did a quick test off the master branch, I can confirm libuv builds in cygwin. In fact most of our dependencies build in cygwin right of the master branch. I don't have more time right now but the biggest issues I found concerned the lua dependencies (and also jemalloc but that one is optional)

More extensive notes

@nowox
Copy link

@nowox nowox commented Sep 1, 2016

Still no news for Cygwin?

@equalsraf
Copy link
Contributor

@equalsraf equalsraf commented Sep 1, 2016

@nowos no, AFAIK no one is working on cygwin support in libuv, or in supporting async io in cygwin

Cross compile realy seems to be the best option here. At least to get a working libuv.

@justinmk justinmk modified the milestones: unplanned, todo Jan 9, 2017
@justinmk justinmk changed the title Compiling under Cygwin Windows: Cygwin Jan 9, 2017
@justinmk
Copy link
Member

@justinmk justinmk commented Apr 6, 2017

Moving this to "todo" milestone, since libuv may add now supports cygwin: libuv/libuv#1287

@sohnryang
Copy link
Contributor

@sohnryang sohnryang commented Jul 13, 2017

Then how can I build neovim in cygwin?
If I try to build it with make CMAKE_BUILD_TYPE=RelWithDebInfo, it fails.

It seems it can't build lua-related component.

@ZyX-I
Copy link
Contributor

@ZyX-I ZyX-I commented Jul 13, 2017

@sohnryang You need to post build log. And in any case I find it easier to build if you ignore top-level Makefile and install all dependencies separately, then build like any other CMake project.

@justinmk
Copy link
Member

@justinmk justinmk commented Jul 13, 2017

You'll need a recent libuv as well.

@sohnryang
Copy link
Contributor

@sohnryang sohnryang commented Jul 26, 2017

See issue #7079.

@sohnryang
Copy link
Contributor

@sohnryang sohnryang commented Feb 4, 2018

I think neovim can be built with cygport now. See https://github.com/cascent/neovim-cygwin

@justinmk
Copy link
Member

@justinmk justinmk commented Feb 12, 2018

Hoping that @cascent or others can share patches and/or instructions to build on cygwin.

Meanwhile https://github.com/cascent/neovim-cygwin is enough to close this issue.

Update: Added @cascent's answer below to the wiki.

@justinmk justinmk closed this Feb 12, 2018
@cascent
Copy link

@cascent cascent commented Feb 13, 2018

install all dependencies the normal way, then build neovim the normal way for a random CMake application (i.e. do not use the makefile that automatically downloads and build dependencies)

the cygport repo contains cygport files (like APKBUILD, PKGBUILD, etc.) for all the dependencies not available in the cygwin distribution, and describes any special commands or arguments needed to build. the cygport definitions also try to describe the required dependencies for each one.
unless custom commands are provided, cygport just calls autogen/cmake, make, make install, etc. in a clean, consistent way.

what's in my repo was built on cygwin 2.9.0. newer libuv should require slightly less patching and some ssp stuff changed in cygwin 2.10.0 so that might change things too when building neovim

@krishnakumarg1984
Copy link

@krishnakumarg1984 krishnakumarg1984 commented Dec 2, 2018

Would it be possible for the experts here to upload future neovim releases as binaries to the cygwin repository?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet