Idea: Pre-compiled binaries. Request for comments.
If possible I'd like to rework contextify so that it can use precompiled binaries if they are available, and then provide some as part of the package.
I've looked at node-sass for inspiration.
My motivation is that my module modest depends on contexify (via jsdom) but I really want it to be simple to install. Especially on windows, it is pretty hard or at least time-consuming to get the build chain in place to build contextify.
Opinions?
How would we maintain builds for the different platforms? The two things that concern me are:
- Increasing the download size (I have no idea what the impact would actually be).
- Maintaining the binaries. Is there an automated way to build these for different platforms, or would it require having access to windows, linux, and os x?
Would love to hear other opinions on this(maybe @domenic has some thoughts), and I'd like to do whatever makes the library easiest to work with, within reason.
The size of the contextify binary for windows_x64 is 1.1 MB. Here is a comment about one approach in a thread about pre-compiled binaries in npm. (Interesting read.)
If you do include a binary, you should say who or what built it and provided it, so the end-user can decide if they trust that person or entity. I wish there were windows nodes on Travis-CI; that would be ideal. I will gladly maintain the windows binaries--though it would be easier for me to compile them by hand then to maintain a build server for that purpose.
Another option would be for downstream authors (like me) to maintain their own precompiled contextify versions as part of their software package and offer it on a separately maintained website (not npm). This is probably what I will do if we don't include binaries in the contextify package.
At some point this will probably be fixed in npm so windows people can have their binaries, but for now it's still up in the air how to handle this.
Interesting. So the download size would probably increase by 6-7 MB or so. And I think there would definitely be issues trying to coordinate a release---you'd have to get access to all six target platforms, do a build, then get them to the person who does npm publish.
I'd be inclined against this, as Windows people really should just get their compiler toolchain working. But, the node-sass success story seems impressive. Maybe @andrew can tell us more about how that's working out?
Another package that is doing this is fibers. If you install this on linux you will see that there are binaries for darwin, linux, win32--with 32bit and 64bit for each. They are pegged to node v. 8-3. It will rebuild the binary you need if it can't find it in the /bin directory. Honestly, I think windows is the most important, since it's not that hard to get the build chain in place on other os's.
I agree with @domenic that it would be great if Windows users got their toolchain working, but from all of the installation issues with Contextify, almost all of which are due to configuration problems on the user's side, I think that's a losing battle for now.
Like @adamstallard said, it seems like providing binaries for Windows would solve the biggest chunk of installation issues. It also seems like following the fibers approach of using the binary if it's present and building from source otherwise should be an easy win at the cost of a 2MB increase in download (if we just include x86 and x64 windows binaries). If something happens where we can't get Windows binaries built, then users are no worse off than they are today.
I wrote Contextify explicitly for JSDOM, so I don't want to make a change if you think it would be detrimental to JSDOM, @domenic. If you're on board, I'd be ok with doing pre-bulit binaries for Windows. I just switched jobs and moved cities over the last week, but I'd have time next week to do some work on that. I'd also be up for merging a PR if someone else wants to tackle it.
I don't see any detriment to jsdom offhand, but I'd still like to hear from someone on projects that are already using this to see if it indeed is a net win before anyone spends their valuable time on it :). It seems possible, if not probable, that packaging pre-compiled binaries brings with it a whole new set of problems.
I've found managing the precompiled binaries to be pretty painful, I don't have easy access to windows and solaris boxes so new releases tend to be hard to get out with up to date versions of all the binaries.
I've also found it tricky to get npm to fallback to compiling on install if the precompiled binary isn't available, not sure if thats a limitation of some trick I've missed. If you can avoid it, I'd suggest trying to go without precompiling.
:+1: for this. Many of are developers don"t have python and visual studio installed
/cc @nschonni
Also, requiring Windows developers to have a build setup is not always realistic. In our case, many of our developers are web developers with no experience dealing with compiling software. On top of that, it seems like Visual Studio is required to build properly which is also not entirely realistic to expect every windows developers to have this on their computer.
node-sass is now using the same approach as fibers https://github.com/andrew/node-sass/pull/148 where a rebuild is only triggered on a new V8 release, or if the tests start failing. Binaries are maintained in a separate repo so people can PR any fixes. These new binaries are then downloaded an included in the NPM publishing step.
Please do this. VS is almost impossible to install, and me being on Windows usually means I'm not able to play with my environment right now (or I'd just be using Linux).
I agree with Laurent and SonOfLilit. It's very frustrating to discover I have to download 3.6G program just to build this one library.
For reference, the pianobar repo has a separately maintained pianobar-windows-binaries repo
node-sass is in the process of automating Windows binaries, perhaps you could look into what we are doing there
@LaurentGoderre thanks for the heads up
node-pre-gyp might help.
node-pre-gyp is a godsend for Windows users. Sqlite3 for instance uses it for "just grab the binary if it exists" and it prevents so many headaches in terms of getting Visual Studio set up correctly, with all the right MSVC++ redistributables available.
This would be amazing. +1.
+1 PLEASE.
@Pomax They are conversion so in the end it doesn't matter really.