ozra / mmap-io

Clean straight forward mmap-bindings for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm install fails on Windows

ImOnALampshade opened this issue · comments

commented

NPM install fails on windows with message:

> mmap-io@1.0.0 postinstall C:\Users\howard\data\Workspace\node-named-pipe-test\node_modules\mmap-io
> make ls

'make' is not recognized as an internal or external command,
operable program or batch file.
npm WARN named-pipe-test@1.0.0 No description
npm WARN named-pipe-test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mmap-io@1.0.0 postinstall: `make ls`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mmap-io@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\howard\AppData\Roaming\npm-cache\_logs\2018-02-24T07_42_20_854Z-debug.log

Not sure if this is the same issue, but I get a build error of error C3861: 'uv_get_osfhandle': identifier not found

Whoops, found that my issue is the same as #11 -- need to update my node.js. Would be good to document the version required; currently the package.json says "node": ">=0.10.0"

After installing Node 8.9.4 I am seeing the same issue as the OP: 'make' is not recognized as an internal or external command. Seems to be triggered by the postinstall script in package.json. What is make ls for?

commented

I ended up making my own package after not getting any response on this issue, you can view it on my profile (node-filemap).

Well I need both unix and windows support, so I might take a shot at forking mmap-io and doing a PR if I can get it to play nice.

commented

Fair enough - if not, I'm supporting both windows and unix with my package - I use mmap-io on unix and node-filemap on windows, then try { requrie(...) }

Would have liked to fork mmap-io and add windows support, but the API seems too closely tied to *nix. So I've thrown together a very minimal module that fits my requirements here instead.

Feel free to PR - or fork for own sake. Make is the traditional build tool. I'm rather preoccupied atm, but I try to be swift to merge PRs with fixes. Including the tiniest like version reqs in spec. Cheers!

Oh, and it should already work for win, btw. If you install make.

commented

You shouldn't be required make on windows, node gyp should handle everything.

Yes, it could definitely be worked out, it's up for grabs!

If anyone has the minutes to take this on, I suggest this approach (which I would accept):

  • Look in the Makefile for the few things needed — not many are essential for function
  • The LS-source files could be eliminated, and the built js be used as originals instead from now on, this removes one build step, and the dependency on an esoteric language in favour of plain JS.

I'm close to a deadline on a massive project, so I have no coding-time away from that atm., but these changes should be fairly easy for anyone feeling inclined.

On Windows I use chocolatey to install nodejs-lts v8.11.1, miniconda 4.3.21 (Python-2), vcbuildtools 2015.4, and cyg-get 1.2.1

Using cyg-get I install a typical set of tools for C programming: make, gcc, autoconf, automake, bison, flex, etc.

Under the bash shell I export a PYTHON variable to reference the Miniconda's python.exe:

export PYTHON=$(cygpath -m /cygdrive/c/ProgramData/Miniconda2/python)

$ git clone https://github.com/ozra/mmap-io.git

$ cd mmap-io

$ npm install --save

There are a few gripes in the build, I think about pointer vs integer word sizes.

$ npm test

The test seems affirmative (with one small cosmetic problem at the end) but am really just starting to put time into evaluating it more closely, including some additional tests for sparse file and vm mapping support.

mmap-io@1.0.0 test C:\mmap-io
node ./test.js

mmap in test is { PROT_READ: 1,
PROT_WRITE: 2,
PROT_EXEC: 4,
PROT_NONE: 0,
MAP_SHARED: 1,
MAP_PRIVATE: 2,
MADV_NORMAL: 0,
MADV_RANDOM: 1,
MADV_SEQUENTIAL: 2,
MADV_WILLNEED: 3,
MADV_DONTNEED: 4,
PAGESIZE: 4096,
map: [Function],
advise: [Function],
incore: [Function],
sync_lib_private__: [Function],
sync: [Function] }
mmap.PAGESIZE = 4096 tries to overwrite it with 47
now mmap.PAGESIZE should be the same: 4096 silently kept
file size 5074
buflen 1 = 5074
Give advise with 2 args
Give advise with 4 args

Buffer contents, read byte for byte backwards and see that nothing explodes:

read out of bounds test
buflen test 5-arg map call = 5074
buflen test 4-arg map call = 5074
Pass faulty arg - caught deliberate exception: mmap: size (arg[0]) must be an integer
Pass wrong page-size as offset - caught deliberate exception: mmap failed, 40
Pass faulty arg to advise() - caught deliberate exception: advice(): (arg[1]) must be an integer
Now for some write/read tests
Creates file
open write buffer
fd-write = 8
open read bufer
verify write and read
Write/read verification seemed to work out
sync() tests x 4

  1. Does explicit blocking sync to disk
  2. Does explicit blocking sync without offset/length arguments
  3. Does explicit sync to disk without blocking/invalidate flags
  4. Does explicit sync with no additional arguments
    Failed to remove test-file ./tmp-mmap-file

All done

I'll remove the dependency on GNU Make for the next update, I'll see what else I manage to squeeze into time.

I've removed dependency on GNUMake, but the build commands still rely on a bunch of "common POSIX apps", so might require a basic setup on windows anyway. Try and see. I'm closing, so open new issue if required.