question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Packaging sharp with nexe as painlessly as possible

See original GitHub issue

Hey @lovell 😃

I’m currently using nexe to package a command line utility that has sharp as a dependency.

Since native modules cannot be integrated into the final executable, my build script copies sharp.node into a sub-directory next to the executable (“./sharp/”). It also generates an adapter that properly locates this copy of sharp.node from within the executable.

It works perfectly under windows. Of course, the build script has to copy the plethora of dlls that comes with sharp, but they’re simply put into the same directory as the copy of sharp.node.

However, in OSX, the .dylib files are (strangely) not in the same directory as sharp.node when sharp is built (but in a “cousin”-directory). So when I copy those files into the new sub-directory next to the packaged executable, I logically get an error about @rpath/somelib.number.dylib not being found.

So, I’m wondering…

  • why the inconsistency between windows and OSX ? Can’t the dylibs be in the same directory as sharp.node, and be referenced from sharp.node as such, so that they could be copied/moved together more easily?
  • should I expect the same issue with .dso files in linux?

I’d very much like not to have to recreate the whole node_modules hierarchy just to copy dynamic libraries if at all possible. Right now, the “copy the .node file together with dynamic libraries in the same directory” behavior is triggered by nexe itself while recursively exploring require statements (so I know for a fact a native module found that way actually is a runtime dependency and not a dev dependency). Also, I don’t have to worry about the “depth” of the dependency if I keep it flat (whether it’s in a node_module within a node_module within a node_module or not makes no difference whatsoever). I’m sure you get the idea.

Any help, pointer, workaround would be deeply appreciated.

Take care and thanks again for the herculean work you pull on sharp on a daily basis,

Julian

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jaubourgcommented, May 26, 2018

FYI I ended up reproducing the hierarchy (keeping only .dll and .node files) than pruning the build location. Not ideal but I can live with it. A compact, ready to incorporate, version would be cool.

Anyway, sorry for the late feedback 😉

1reaction
lovellcommented, Nov 24, 2017

@patrickhulce Hello, when npm install (and npm rebuild) are run, npm runs node-gyp with the binding.gyp config. It uses pkg-config to search for a globally-installed libvips. If not found, it will invoke the download_vips() function from binding.js to populate the vendor directory with the relevant libvips binaries for the detected platform.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Make Dressing Changes Less Painful - Lippincott
Do not pack the wound aggressively. Control edema to avoid reduced blood flow to the wound, which may lead to additional pain. Eliminate...
Read more >
10 Tips for Easy and Painless Progesterone in Oil (PIO) Shots
PIO shots don't have to be painful! I'm sharing my tips and tricks for easy and painless progesterone in oil shots. Pics and...
Read more >
At-Home Hog Slaughter - SDSU Extension
A dull knife is much more dangerous to use than a sharp one because ... container to dip the carcass into, heat as...
Read more >
How to Minimize the Pain of Local Anesthetic Injection for ...
Use Blunt-tipped Cannulas When Tumescing Large Areas. A sharp needle makes a skin hole entry site through which you pass a blunt-tipped cannula, ......
Read more >
Solved Sharp, Inc., a company that marketspainless - Chegg
For a limited time, save on a Chegg Study or Study Pack subscription. ... Sharp, Inc., a company that markets painless hypodermic needles...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found