This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: introduction, fix for npm w.r.t. git, and questions


On Wed, Apr 20, 2016 at 09:30:33PM +0200, silverwind wrote:
> >I think the "correct" fix would be to get npm (or possibly the
> >JavaScript engine itself?) to stop acting as if it's in a Windows
> >environment
> You're on the right track. The root issue is that Node.js (on which
> npm runs) is a native Windows binary in pretty much all cases, as
> it's not possible to build it or v8 (the JS engine) through Cygwin's
> toolchain, at least not without numerous modifications. Node.js had
> actual support for Cygwin until 0.4.2 (which is ancient), after
> which it was dropped, presumably because of v8 build issues.
> 
> If one were to obtain a Cygwin-built Node.js binary,
> `process.platform` would be `Linux` and npm would happily feed POSIX
> paths into git.

I think, sadly, this is something that's just not intended to work.  It
does work sometimes, but it's as much luck as judgement when it does.

Fundamentally you're need a native Windows application (Node.js/v8) to
be aware of Cygwin -- possible in specific instances by using wrapper
scripts or interface layers, but impossible in general because, for a
start, a native Windows application isn't going to have linked to
cygwin1.dll -- or a native Cygwin application (in this case Git) to be
aware of Windows, which goes against the principle of Cygwin providing a
compatibility layer that means *nix source code can be compiled without
needing to care about the fact that it's actually running in a Windows
environment.

(Yes Git has some Cygwin-specific code, but I think the bits that are
actually specific to Cygwin only are very small; most of it is just
different build options to account for differences in the same way Git
has BSD or Darwin-specific build options.)

Ideally, you'd get Node.js and v8 to compile and run within Cygwin.
Having attempted a similar task for the Golang compiler, though, I'm not
expecting that to be feasible, if it isn't supported upstream, at least
without some significant effort.

Failing that, given you're using native Windows v8, Node.js and npm,
your best bet may be to use the native Windows Git client, so npm's
entire toolchain is native Windows applications rather than a mix of
native Windows and Cygwin.  It's been a while since I tried it, but I
_think_ you can generally use Cygwin Git and Windows Git on the same
working copy without any difficulties, at least if you avoid the common
pain points like line ending rewriting and symlinks.

The final option, given you have a patch for npm that apparently gets
this all working anyway, may just be to create a fork of npm yourself,
patch support for Cygwin back in, and use that instead.  If the fixes to
get Cygwin working are simple enough, it should be reasonably easy to
keep merging changes in the upstream repository to your fork.

HTH

Adam

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]