gemini-testing / png-img

Lite libpng wrapper for node.js
MIT License
29 stars 13 forks source link

Installing without external dependencies #19

Closed smoogly closed 8 years ago

smoogly commented 9 years ago

Hi!

I've started this work from requirement to install gemini without any external dependencies, except for node and npm.

I've changed the build process to use node-pre-gyp, so that installs download ready binaries without compiling. I'm also statically linking to stdlib to elmiminate requirement for a proper version of shared stdlib installed.

Before accepting pull request we would have to agree on where to host binaries, current s3 bucket is for proof of concept only.

Results:

When statically linking I, as a C++ newbie, used chromium .gyp files from https://chromium.googlesource.com/chromium/buildtools/+/ef7f1f539cff0441c4401d8c052e54cfd01bff07/third_party/ and changed the compiler to clang. That may have been a bad decision, but as I see it works — tests are passing.

What do you think?

j0tunn commented 9 years ago

Static linking with stdlib is a bad idea? Why do you need this?

j0tunn commented 9 years ago

/cc @SevInf

smoogly commented 9 years ago

Why is it a bad idea? I'm not kidding, I have no idea why is it bad. As for why I need it, otherwise you install binary on linux and still have a dependency on stdlib being new enough. And that is an external dependency I would like to avoid.

On Thu, Oct 22, 2015 at 4:14 PM, j0tunn notifications@github.com wrote:

/cc @SevInf https://github.com/SevInf

— Reply to this email directly or view it on GitHub https://github.com/gemini-testing/png-img/pull/19#issuecomment-150257880 .

j0tunn commented 9 years ago

Because:

As for the other part of PR. As far as I know you have a problem with png-img installation on Windows. So lets stick all this stuff to Windows. Live install process on other platforms as is

smoogly commented 9 years ago

— it increases size of a module — linux binaries are 206kb vs 160kb for windows, so the overhead added by stdlib is ~40kb, which seems pretty negligible.

— it increases compilation time — true. But I don't think it matters if pre-built binaries are available. I can make it dependent on a conditional which would only be turned on in travis, so there won't be an overhead in compiling locally.

— it increases complexity of module maintanance; there could be some conflicts with stdlib used by node — This I have no knowledge about, sadly. All I see is tests are passing, so I take it as a confirmation that it works.

— it just useless because node itself have dynamic dependency on stdlib As for the other part of PR. As far as I know you have a problem with png-img installation on Windows. So lets stick all this stuff to Windows. Live install process on other platforms as is — node is probably built against an older version of stdlib than png-img currently expects. My decision to statically link to stdlib flows out of problems instaling png-img on a centos 6.5 machines (not the newest, I know, but not really obsolete). They have g++ (GCC) 4.4.7 by default.

What I'm leading at, I know it's scary to build things like this, but the advantage of having no external dependency seems like a good justification to me.

j0tunn commented 9 years ago

My decision to statically link to stdlib flows out of problems instaling png-img on a centos 6.5 machines (not the newest, I know, but not really obsolete). They have g++ (GCC) 4.4.7 by default

Ok, why can't you just install g++4.6? In fact I don't understand why can't you install Visual Studio on Windows dev machine. But ok, may be there are some issues.

So in the end:

j0tunn commented 9 years ago

@smoogly Do you plan to do something with this PR or it can be closed?

j0tunn commented 9 years ago

Also take a look at gcc compiler flag -static-libstdc++: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

smoogly commented 8 years ago

Sorry for the late response. I'll close it for now, maybe will come back to it later.