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

"yaz-config: not found" error while installing library on Debian #40

Open
pvoisin opened this issue Oct 17, 2023 · 2 comments
Open

"yaz-config: not found" error while installing library on Debian #40

pvoisin opened this issue Oct 17, 2023 · 2 comments

Comments

@pvoisin
Copy link

pvoisin commented Oct 17, 2023

I'm dropping this here before I can propose a PR (hopefully). Originally (few months ago) I made a quick attempt to build a Docker image based on Debian (node:slim) with node-zoom2 installed. Here's the problem I've faced (still facing it today):

#9 7.685 npm ERR! /bin/sh: 1: yaz-config: not found
#9 7.685 npm ERR! gyp: Call to 'yaz-config --libs' returned exit status 127 while in binding-not-win.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
#9 7.685 npm ERR! gyp ERR! configure error 
#9 7.685 npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
#9 7.685 npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
#9 7.685 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
#9 7.685 npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
#9 7.685 npm ERR! gyp ERR! System Linux 5.15.49-linuxkit
#9 7.685 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#9 7.685 npm ERR! gyp ERR! cwd /usr/src/app/node_modules/node-zoom2
#9 7.685 npm ERR! gyp ERR! node -v v20.8.0
#9 7.685 npm ERR! gyp ERR! node-gyp -v v9.4.0
#9 7.685 npm ERR! gyp ERR! not ok

It seems that yaz-config doesn't exist (maybe it isn't shipped anymore with yaz or libyaz-dev). Instead, pkg-config yaz works and with the following trick I was able to build the image:

FROM node:slim

...

RUN \
  npm install node-zoom2 --ignore-scripts \
  && LIBS=`pkg-config yaz --libs` \
  && CFLAGS=`pkg-config yaz --cflags` \
  && sed -i -E 's#"cflags": \[.+\]#"cflags": ["'"$CFLAGS"'"]#' ./node_modules/node-zoom2/binding-not-win.gyp \
  && sed -i -E 's#"libraries": \[.+\]#"libraries": ["'"$LIBS"'"]#' ./node_modules/node-zoom2/binding-not-win.gyp \
  && npm rebuild

...

I admit this isn't very clean but, as I'm no Linux/C++/Make expert, I couldn't find another (quick) solution.

So, @dengelke, if you have any recommendation to make this fit into the project I'd be very pleased to hear about it! :)

@pvoisin
Copy link
Author

pvoisin commented Oct 17, 2023

@sylvain-ville - FYI

@dengelke
Copy link
Owner

Thanks @pvoisin for pointing this out - I'll try to create a Dockerfile using node:slim to test this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants