public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Adam Dinwoodie <adam@dinwoodie.org>
To: cygwin@cygwin.com
Subject: Re: introduction, fix for npm w.r.t. git, and questions
Date: Wed, 20 Apr 2016 21:05:00 -0000	[thread overview]
Message-ID: <20160420205904.GK2345@dinwoodie.org> (raw)
In-Reply-To: <5717D8D9.2030600@gmail.com>

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

  reply	other threads:[~2016-04-20 20:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 15:31 Brian Clifton
2016-04-20 15:44 ` Eliot Moss
2016-04-20 19:30 ` Adam Dinwoodie
2016-04-20 20:37   ` silverwind
2016-04-20 21:05     ` Adam Dinwoodie [this message]
2016-04-20 22:10       ` silverwind
2016-04-20 23:14         ` Adam Dinwoodie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160420205904.GK2345@dinwoodie.org \
    --to=adam@dinwoodie.org \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).