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

Support for Windows #19

Closed
DullReferenceException opened this issue Apr 10, 2014 · 72 comments
Closed

Support for Windows #19

DullReferenceException opened this issue Apr 10, 2014 · 72 comments
Milestone

Comments

@DullReferenceException
Copy link

I'd like to be able to use sharp on the Windows platform. Because libvips is available for Windows, I assume that lack of support is mostly in figuring out the build script.

Has this been investigated already? If so, what approaches have already been tried and roadblocks encountered? Knowing what's been tried so far, if anything, will help me or other potential developers come to a working solution quicker.

@lovell
Copy link
Owner

lovell commented Apr 11, 2014

Hi Jacob, I've yet to try compiling on a Windows machine but am happy to help get it working.

We'll need to add the relevant paths to the libraries and include_dirs directives in binding.gyp plus document how to install the dependencies.

<wishful-thinking> Is there a "standard" location for the .dll files on Windows machines? </wishful-thinking>

Are you using MinGW or similar?

@pierreinglebert
Copy link
Contributor

The easiest way to compile node addon on windows is to install VS Express and Python 2.7.
That worked with other addons.

@DullReferenceException
Copy link
Author

Sorry, @lovell, for not responding earlier. I started going with gm for now, but I'm still scared of the whole process spawning behavior, so I do want to continue pursuing this.

I am using MinGW. So far, this is what I've encountered and how far I've gotten:

  1. I manually copied the libvips development files to my MinGW environment.
  2. The '<!@(PKG_CONFIG_PATH="/usr/local/Library/ENV/pkgconfig/10.8:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --libs vips)' bit in the libraries property for binding.gyp is causing an error that "PKG_CONFIG_PATH is not a recognized command" or something like that. I'm guessing there's a difference in how gyp is invoking the shell maybe? To work around this, I installed pkgconfiglite and reduced this to <!@(pkg-config --libs vips). pkg-config seems to be finding the libraries it needs.
  3. Now, when building, I'm given the error "Cannot open include file: 'vips/vips.h'." Changing the include_dirs settings doesn't seem to have any effect, so I guess you have to do something different for VS builds?

I'm just now learning about gyp, so I'm slowly muddling through this. If you guys have any tips for getting past these issues, I'll be sure to document the steps and maybe update binding.gyp to work for Windows "out of the box"-ish.

@DullReferenceException
Copy link
Author

Drat. Even with a given VIPS for Windows distribution, the VS compiler chokes on some GCC-specific code in the vips/buf.h header: "'attribute' : unknown override specifier". I'll have to figure out how to coerce node-gyp into using the MinGW compiler instead of VS.

@jcupitt
Copy link
Contributor

jcupitt commented May 22, 2014

Hi, I'm the libvips maintainer. The gcc-specific code is a bug caused by a dropped patch. Paste this into vips.h or use libvips master:

jcupitt/libvips@44f8b0d

@mahnunchik
Copy link

+1

1 similar comment
@vbauer
Copy link

vbauer commented Oct 27, 2014

👍

@itsananderson
Copy link

If #74 brings in the gcc fix @jcupitt mentioned, then it sounds like at least one blocker for Windows support will be fixed as soon as that version upgrade goes in.

@jcupitt
Copy link
Contributor

jcupitt commented Oct 27, 2014

The official vips win32 builds now include a libvips.dll. Would this help? I'm told it works with VS, though I've not tried it myself.

http://www.vips.ecs.soton.ac.uk/supported/7.40/win32/

7.40.10 and later. The nofftw binary does not include libfftw and so is pure LGPL.

(background: although libvips has been able to build a DLL for quite a few years, some of the projects it wraps cannot. 7.40.10 and later leave out all these static-library-only projects and so you get a libvips.dll. This binary cannot load FITS or Matlab files.)

@owanturist
Copy link

+1

@lovell
Copy link
Owner

lovell commented Oct 27, 2014

Hello to the +1s of the Noveo Group and welcome Microsofter @itsananderson.

I'm sure the libvips.dll that includes pre-compiled dependencies will help - I didn't realise it existed.

Would anyone like to have a go at adding it to the work-in-progress shell script that is https://github.com/lovell/sharp/blob/preinstall/preinstall.sh ?

@itsananderson
Copy link

Finally had a chance to dig in tonight. Got the preinstall.sh doing a (brittle) download and unzip of the libvips binary. Also updated the binding.gyp to conditionally use relative paths to for lib and includes.

https://github.com/itsananderson/sharp/tree/preinstall

This is definitely more proof-of-concept than anything close to being ready to ship, but at least it's a step in the right direction.

After gyp was able to start building, I hit a compile error. Apparently the VS implementation of C++11 doesn't support explicit array initializers. Fixed that (I think), by moving the array initialization into the struct's constructor body. Not super comfortable in C++, so there may be a better way to do that.

I also added a reference to <algorithm> for std:min and std:max. That should be something we can hide behind a compile time flag.

Once those issues were gone, I got a new error during linking:

..\vips-dev-7.40.11\bin\libvips-38.dll : fatal error LNK1107: invalid or corrupt file:
    cannot read at 0x2E0 [c:\sharp\build\sharp.vcxproj]

I also tried libvipsCC-38.dll, but got the same result. At this point I'm quite far outside my knowledge of C++ and node-gyp. I don't think that file is actually corrupted (tried re-downloading), but maybe gyp is expecting a .lib instead of a .dll?

@jcupitt
Copy link
Contributor

jcupitt commented Oct 29, 2014

Hi @itsananderson, yes at compile-time you need to link against lib/libvipsCC-38.dll.a. The DLL itself, in bin/libvipsCC-38.dll, is for run-time. You can also link against lib/libvipsCC-38.a if you want a static dependency.

You'll need to test carefully, unfortunately. I made the DLL on a linux machine using a cross-compiler that implements something like VC6. The DLL will link to the system msvcrt.dll for the standard library. This means that most resources (file descriptors, memory, almost anything really) must not be allocated in your main binary (which will link to the VS runtime) and freed in libvips. Or vice-versa. You can also have problems if you allocate a file handle in one binary and use it in another, since the two runtimes will have different buffers.

This is very unfortunate :-( I hope it doesn't cause too many problems for you.

@itsananderson
Copy link

Ah, thanks. I just tried linking against lib/libvipsCC.dll.a and lib/libvipsCC.a, and it didn't complain about a corrupted file, but then it complained about unresolved symbols:

common.obj : error LNK2001: unresolved external symbol vips_foreign_is_a [c:\sh
arp\build\sharp.vcxproj]
common.obj : error LNK2001: unresolved external symbol vips_pngload_buffer [c:\
sharp\build\sharp.vcxproj]
common.obj : error LNK2001: unresolved external symbol vips_jpegload_buffer [c:
\sharp\build\sharp.vcxproj]
common.obj : error LNK2001: unresolved external symbol vips_webpload_buffer [c:
\sharp\build\sharp.vcxproj]
common.obj : error LNK2001: unresolved external symbol vips_pngload [c:\sharp\b
uild\sharp.vcxproj]
common.obj : error LNK2001: unresolved external symbol vips_magickload [c:\shar
p\build\sharp.vcxproj]
common.obj : error LNK2001: unresolved external symbol vips_jpegload [c:\sharp\
build\sharp.vcxproj]
common.obj : error LNK2001: unresolved external symbol vips_webpload [c:\sharp\
build\sharp.vcxproj]

... and so on

Basically, it's the same errors as when I completely leave out the reference to the libvips binary.

@jcupitt
Copy link
Contributor

jcupitt commented Oct 29, 2014

Yes, libvipsCC-38.dll.a has the symbols for the C++ wrapper for libvips. You'll need to link against libvips-38.dll.a to get the symbols for the base C library as well.

You'll probably find you need a few other libraries as well. There's a sample build line here:

http://www.vips.ecs.soton.ac.uk/index.php?title=Supported#Development_on_Windows

lovell added a commit that referenced this issue Oct 29, 2014
@lovell
Copy link
Owner

lovell commented Oct 29, 2014

Thanks @itsananderson, I've added the required source code changes you discovered to master.

It looks like you've made good progress with the linking side of things too, great news.

Are you able to get pkg-config working with MSVC? That should simplify the include_dirs and libraries directives in binding.gyp.

@itsananderson
Copy link

I've tried getting pkg-config working on Windows. It runs, and outputs the "right" flags, but it looks like the VS build system expects different inputs. e.g.

LINK : warning LNK4044: unrecognized option '/DMAGICKCORE_HDRI_ENABLE=0 -DMAGIC
KCORE_QUANTUM_DEPTH=16 -D_DLL -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_D
EPTH=16 -D_DLL -mms-bitfields -Ivips\include -Ivips\include\libgsf-1 -Ivips\inc
lude\libxml2 -Ivips\include -Ivips\include\ImageMagick-6 -Ivips\include -Ivips\
include\openslide -Ivips\include\pango-1.0 -Ivips\include\freetype2 -Ivips\incl
ude -Ivips\include\libpng14 -Ivips\include -Ivips\include\glib-2.0 -Ivips\lib\g
lib-2.0\include.lib'; ignored [c:\sharp\build\sharp.vcxproj]

I think manual configuration of libs and include_dirs may, unfortunately, be required (unless there's an easy way to do compatibility conversion).

Still getting a bunch of errors like this:

common.obj : error LNK2001: unresolved external symbol vips_foreign_is_a [c:\sh
arp\build\sharp.vcxproj]

These errors make it seem like a bunch of vips_* functions are missing from the libvipsCC.dll.a library (or I'm somehow linking it wrong). Not really sure how to debug this :(

@lovell
Copy link
Owner

lovell commented Oct 31, 2014

The pkg-config output you've included starts with a Windows-style /D flag but then uses *nix-style -D flags. I'm unsure which is "correct" but keeping them consistent may help.

John's comment about linking against libvips-38.dll.a instead of libvipsCC.dll.a should also help you:

You'll need to link against libvips-38.dll.a to get the symbols for the base C library as well.

Thank you for persisting with this. If we can get it working you'll have lots of new friends :)

@itsananderson
Copy link

The pkg-config outputs unix style flags, and as far as I can tell, node-gyp adds the windows flags when it creates the .vcxproj, which is why it looks weird. Updated binding.gyp is in my fork if you want to take a look. Nothing too crazy there, except calling out to .cmd scripts for pkg-config because CMD doesn't support defining PKG_CONFIG_PATH inline.

John mentioned libvips-38.dll.a, but it doesn't exist in the win32 zip. The only vips libraries I've found are libvips-38.dll, libvipsCC-38.dll, libvips.a, libvipsCC.a, libvips.dll.a, and libvipsCC.dll.a, all of which I've tried :)

@jcupitt
Copy link
Contributor

jcupitt commented Nov 4, 2014

Hi, sorry for the delay, I've been away.

Yes, pkg-config outputs flags for the compiler that was used to produce the package which made the .pc file, so mingw for the precompiled vips DLL. You won't be able to use it directly in MSVC, but it might help to see things like library ordering.

You're right, the libvips dll.a does not have the -38 in there, sorry. It should work though! I tried this link line off the vips site:

i686-w64-mingw32-g++ \
        -mms-bitfields -march=i686 \
        -I.../vips-dev-7.40.4/include \
        -I.../vips-dev-7.40.4/include/glib-2.0 \
        -I.../vips-dev-7.40.4/lib/glib-2.0/include \
        hello.cc \
        -L.../vips-dev-7.40.4/lib \
        -lvipsCC -lvips -lgsf-1 -lz -ljpeg -lxml2 -lfftw3 -lm \
        -lMagickWand-6.Q16 -llcms2 \
        -lopenslide -lpangoft2-1.0 -ltiff -lpng14 -lexif \
        -lMagickCore-6.Q16 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 \
        -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl \
        -o hello.exe

with this program:

#include <iostream>
#include <vips/vips>

int
main( int argc, char **argv )
{
        /* Check arguments.
         */
        if( argc != 3 ) {
                std::cerr << "usage: " << argv[0] << " infile outfile\n";
                exit( 1 );
        }

        try {
                vips::VImage fred( argv[1] );

                fred.invert().write( argv[2] );
        }
        catch( vips::VError e ) {
                e.perror( argv[0] );
        }

        return( 0 );
}

and it works for me, though obviously with mingw rather than MSVC. Hopefully just swap it to MSVC link syntax and you should be done.

Try a tiny vips program and see if you can get that to link.

@blowsie
Copy link

blowsie commented Nov 27, 2014

I am trying to install the latest version of sharp without any of the above mentioned modifications.

I get the following error

dules\node-gyp\b
in\node-gyp.js" rebuild
The system cannot find the path specified.
'true' is not recognized as an internal or external command,
operable program or batch file.
gyp: Call to 'which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CO
NFIG_LIBDIR || true' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modu
les\npm\node_modules\node-gyp\lib\configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:81
0:12)
gyp ERR! System Windows_NT 6.2.9200

node-gyp works fine on other projects of course, as I have VS and python installed.

Is there anything I can do to test any of these changes or help move this along?

@lovell
Copy link
Owner

lovell commented Nov 27, 2014

@blowsie Please can you try changing || true to || exit 0 on line 12 of binding.gyp.

@michaeldrotar
Copy link

+1

I also tried to npm install sharp and got a similar error to @blowsie

D:\Projects\test\node_modules\sharp>node "D:\Apps\nodejs
\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js"
 rebuild
The system cannot find the path specified.
gyp: Call to 'which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONF
IG_LIBDIR || true' returned exit status 0. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (D:\Apps\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\Apps\\nodejs\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Projects\test\node_modules\sharp
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1

I tried again, freezing the console just after the package was downloaded, and edited binding.gyp with the above change:

    'variables': {
      'PKG_CONFIG_PATH': '<!(which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONFIG_LIBDIR || exit 0):$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'
    },

Got a slightly different error:

D:\Projects\test\node_modules\sharp>node "D:\Apps\nodejs
\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js"
 rebuild
The system cannot find the path specified.
gyp: Call to 'which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONF
IG_LIBDIR || exit 0' returned exit status 0. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (D:\Apps\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\Apps\\nodejs\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Projects\test\node_modules\sharp
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1

@lovell
Copy link
Owner

lovell commented Jan 1, 2015

@michaeldrotar I think you may be experiencing a different problem to @blowsie as you're not seeing the 'true' is not recognized as an internal or external command... error. It might be that the which executable is not found/available on your system.

The which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONFIG_LIBDIR part of PKG_CONFIG_PATH is applicable for Macs only. We need to work out a portable way of making Windows ignore any error it generates, like the || true command does for Linux.

I now have in my possession a new Windows 8.1 laptop so hope to make a bit more progress with this. Please do keep adding comments to this issue about your own attempts of getting it working as these all help narrow down the problems.

(On a multi-platform note, I managed to get libvips and sharp working on an ARMv6 Raspberry Pi over Christmas. WebP support was the trickiest bit to get working.)

@Karnith
Copy link

Karnith commented Jan 19, 2015

+1
Would be great to get this working!

@connor4312
Copy link

👍 would love to move from gm to Sharp for actual good streaming support :D

@lovell
Copy link
Owner

lovell commented Apr 20, 2015

Thanks John.

There's probably an option to allow the MS C++ linker to work with C variables in DLLs but I don't know MSVC well enough. Can anyone help?

What I can do for now is temporarily wrap the new normalise code in #ifndef _WIN32 to hide it from the linker.

@jcupitt
Copy link
Contributor

jcupitt commented Apr 21, 2015

It used to be the case that DLLs just did not support external variables, only external functions.

DLLs worked like this: a set of stubs would be added to the calling object, one for each entry point in the DLL. Each stub was initialised with a JMP to linking code. At runtime, if execution hit one of these things, it would trigger the linking routine to load the DLL into memory, if it wasn't already loaded, then to search it for the target function, and then to modify the stub to be a direct jump to the target. This is straightforward to implement and means there's no need for a full run-time linker, as you find on *nixes. The downside is that it can only support simple forward linking of function calls; you can't link external variables, and you can't do things like back linking.

Perhaps the situation has improved since I last looked at this.

@jcupitt
Copy link
Contributor

jcupitt commented Apr 21, 2015

I had a quick look at the normalise function, it looks nice.

You could make it a bit more concise with vips_object_local_array(), I expect you know. For example (untested):

        VipsImage **t = (VipsImage **) vips_object_local_array(hook, 7);

        // normalize the luminance band in LAB space:
        if (vips_colourspace(image, &t[0], VIPS_INTERPRETATION_LAB, NULL) ||
                vips_extract_band(t[0], &t[1], 0, "n", 1, NULL) ||
                vips_extract_band(t[0], &t[2], 1, "n", 2, NULL) ||
                vips_stats(t[1], &t[3], NULL)) {
                return Error();
        }

        double min = *VIPS_MATRIX(stats, 0, 0);
        double max = *VIPS_MATRIX(stats, 1, 0);

        if (min == max) {
                // Range of zero: create black image
                if (vips_black(&t[4], image->Xsize, image->Ysize, 
                        "bands", 1, NULL )) {
                        return Error();
                }
        } else {
                double f = 100.0 / (max - min);
                double a = -(min * f);

                if (vips_linear1(t[1], &t[5], f, a, NULL) ||
                        vips_bandjoin2(t[5], t[2], &t[6], NULL) ||
                        vips_colourspace(t[6], &t[4], image->Type, NULL)) {
                        return Error();
                }
         }

        VipsImage *normalized = t[4];

You could also consider taking a histogram of L* and setting the range to 1% and 99%, ie. letting the top 1% and the bottom 1% over- and under-expose. This would make it less sensitive to noise and probably produce a more pleasing image in more cases.

vips_percent() does almost this, you'd swap your vips_stats() for this code:

https://github.com/jcupitt/libvips/blob/master/libvips/histogram/percent.c#L82

lovell added a commit that referenced this issue Apr 21, 2015
Hide WebP format and normalise option

Separate test runners for node and iojs
@lovell
Copy link
Owner

lovell commented Apr 21, 2015

The judgement branch should be working on Windows again and I've added a Windows CI job via AppVeyor e.g. https://ci.appveyor.com/project/lovell/sharp/build/19

@jcupitt The use of vips_object_local and vips_object_local_array will go away with #152. Your suggested improvements for normalisation are in #200, thank you.

@jcupitt
Copy link
Contributor

jcupitt commented Apr 21, 2015

Ah great ... yes, #152 should be a nice improvement to readability.

lovell added a commit that referenced this issue Apr 21, 2015
@lovell
Copy link
Owner

lovell commented Apr 23, 2015

Support for Windows now in git master - will be published to npm shortly.

@lovell
Copy link
Owner

lovell commented Apr 23, 2015

Support for Windows now available in v0.10.0 via npm https://www.npmjs.com/package/sharp

Thanks for everyone's help with this year-long task!

Please create a new issue for any problems/improvements you discover.

@lovell lovell closed this as completed Apr 23, 2015
@blowsie
Copy link

blowsie commented Apr 24, 2015

Great news! thanks everyone and @lovell 👍

@blowsie
Copy link

blowsie commented May 7, 2015

Sadly, Following the installation instructions on the readme, I get the following error

Windows: 8.1
Node : 0.12.2 (x86)
Npm: 2.7.4
Node-gyp: 1.0.3
Vips: 8.0.2

D:\Projects\myproject>npm install sharp
|
> [email protected] install D:\Projects\myproject\node_modules\sharp
> node-gyp rebuild


D:\Projects\myproject\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node
_modules\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  common.cc
  utilities.cc
  metadata.cc
  resize.cc
  sharp.cc
..\src\metadata.cc(2): fatal error C1083: Cannot open include file: 'vips/vips.h': No such file or directory [D:\Projects\myproject\node_modules\sharp\build\
sharp.vcxproj]
..\src\sharp.cc(2): fatal error C1083: Cannot open include file: 'vips/vips.h': No such file or directory [D:\Projects\myproject\node_modules\sharp\build\sha
rp.vcxproj]
..\src\utilities.cc(2): fatal error C1083: Cannot open include file: 'vips/vips.h': No such file or directory [D:\Projects\myproject\node_modules\sharp\build
\sharp.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify 
/EHsc (..\src\common.cc) [D:\Projects\myproject\node_modules\sharp\build\sharp.vcxproj]
..\src\resize.cc(6): fatal error C1083: Cannot open include file: 'vips/vips.h': No such file or directory [D:\Projects\myproject\node_modules\sharp\build\sh
arp.vcxproj]
..\src\common.cc(3): fatal error C1083: Cannot open include file: 'vips/vips.h': No such file or directory [D:\Projects\myproject\node_modules\sharp\build\sh
arp.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Projects\myproject\node_modules\sharp
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "sharp"

@lovell
Copy link
Owner

lovell commented May 7, 2015

@blowsie Is VIPS_HOME set? Does the $(VIPS_HOME)/include directory exist?

@blowsie
Copy link

blowsie commented May 7, 2015

Thanks @lovell, I did have them set, but you prompted me to restart, which did the trick. Maybe I should know by now to restart after setting variables, or maybe it should be added to the readme. :)

@lovell
Copy link
Owner

lovell commented Oct 29, 2015

The look work-in-progress branch now supports the installation of sharp on Windows without having to manually download/unpack vips-dev and without having to set/modify any environment variables.

To test it, run npm install lovell/sharp#look - please report any problems at #42.

@blowsie
Copy link

blowsie commented Oct 29, 2015

@lovell ooo, nice work!

Thanks

@lovell
Copy link
Owner

lovell commented Nov 5, 2015

As well as ease-of-installation, it looks like support for 64-bit node.exe on Windows will also be arriving in the next release v0.12.0.

What problems, if any, would anyone who has contributed here have with sharp dropping support for 32-bit Windows from that version onwards?

@blowsie
Copy link

blowsie commented Dec 3, 2015

On v0.12.0 , I'm have proxy issues with the request to dl.bintray.com I can only assume it is not npm that is making the request, because npm is proxy configurable and is working fine for everything else for me.


Update:

In bindings.js there is a request to the libvibs library @ dl.bintray.com.

I think this request should be proxy aware. How about using shelljs to obtain the npm proxy config via npm config get proxy and then configure the request

@lovell
Copy link
Owner

lovell commented Dec 3, 2015

@blowsie The request module is used for this purpose. It supports some fairly common proxy-related environment variables - see https://github.com/request/request#controlling-proxy-behaviour-using-environment-variables

Are you setting npm's https-proxy setting? If so, this might be available at install time for us to manually pass along to the request module, but I'd need to check.

@blowsie
Copy link

blowsie commented Dec 3, 2015

Yep My .npmrc file looks something like this.

proxy=http://proxy.com:43128/
https-proxy=http://proxy.com:43128/

I will try an use the environment vairables now, thanks. 👍

@blowsie
Copy link

blowsie commented Dec 3, 2015

Setting the environment variables, and restarting the machine did not work for me :(.
It did manage to break a whole plethora of other (Office 365) applications though.

Perhaps using the npm config for this is not such a bad idea.

@lovell
Copy link
Owner

lovell commented Dec 3, 2015

"It did manage to break a whole plethora of other (Office 365) applications though."

http://thenextweb.com/microsoft/2015/12/03/office-365-is-down-for-many-users-in-europe/ suggests we might not be able to take the credit for that.

"Perhaps using the npm config for this is not such a bad idea."

Will take a look, thanks for confirming.

@blowsie
Copy link

blowsie commented Dec 3, 2015

Update: using the environment variables did infact work, the reason the installation still did not work was because the file at dl.bintray.com was actually redirecting to cloudfront.net.

So using the environment variables does actually fix the problem, but may effect other applications, like "Skype for Business" in my case

@lovell
Copy link
Owner

lovell commented Dec 3, 2015

@blowsie Commit 16e0d54 should allow for the use of the https-proxy setting of .npmrc, if any. You can test via npm install lovell/sharp.

@blowsie
Copy link

blowsie commented Dec 4, 2015

@lovell Works a charm thank you very much. I look forward to the next release.

@lovell
Copy link
Owner

lovell commented Dec 4, 2015

@blowsie Great, thanks for confirming.

@lovell
Copy link
Owner

lovell commented Dec 12, 2015

@blowsie v0.12.1 now available via npm

Repository owner locked and limited conversation to collaborators Dec 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests