I’m encountering a problem with an internal application. As such I won’t be able to post the package.json file that would be truly useful in debugging this. However, on a long dependency chain with npm, I’m seeing the following issues.
Its needing to compile some native dependencies by the looks.
> cwebp-bin@4.0.0 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/cwebp-bin
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/cwebp-bin/vendor/cwebp ENOENT
⚠ cwebp pre-build test failed
ℹ compiling from source
✔ cwebp built successfully
> gifsicle@3.0.4 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/gifsicle
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/gifsicle/vendor/gifsicle ENOENT
⚠ gifsicle pre-build test failed
ℹ compiling from source
✔ gifsicle built successfully
> mozjpeg@5.0.0 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor/cjpeg ENOENT
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: autoreconf -fiv && ./configure --disable-shared --disable-dependency-tracking --with-jpeg8 --prefix="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" --bindir="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" --libdir="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" && make -j2 && make install -j2
Command failed: autoreconf -fiv
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /hab/pkgs/core/autoconf/2.69/20170513214252/bin/autoconf --force
configure.ac:23: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /hab/pkgs/core/autoconf/2.69/20170513214252/bin/autoconf failed with exit status: 1
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
> optipng-bin@3.1.4 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor/optipng ENOENT
⚠ optipng pre-build test failed
ℹ compiling from source
✖ Error: ./configure --with-system-zlib --prefix="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor" --bindir="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor" && make install
Command failed: ./configure --with-system-zlib --prefix="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor" --bindir="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor"
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
> pngquant-bin@4.0.0 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/pngquant-bin
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/pngquant-bin/vendor/pngquant ENOENT
⚠ pngquant pre-build test failed
ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at Promise.all.then.arr (/hab/cache/src/forest-portal-0.1.0/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pngquant-bin@4.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pngquant-bin@4.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-06-14T06_43_24_580Z-debug.log
Now I am running into the following, and I don’t know how I can change the configure file to change that /usr/bin/file reference:
> mozjpeg@5.0.0 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor/cjpeg ENOENT
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: autoreconf -fiv && ./configure --disable-shared --disable-dependency-tracking --with-jpeg8 --prefix="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" --bindir="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" --libdir="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" && make -j2 && make install -j2
Command failed: ./configure --disable-shared --disable-dependency-tracking --with-jpeg8 --prefix="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" --bindir="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor" --libdir="/hab/cache/src/forest-portal-0.1.0/node_modules/mozjpeg/vendor"
./configure: line 8221: /usr/bin/file: No such file or directory
./configure: line 13605: PKG_PROG_PKG_CONFIG: command not found
./configure: line 13784: syntax error near unexpected token `libpng,'
./configure: line 13784: `PKG_CHECK_MODULES(libpng, libpng, HAVE_LIBPNG=1,'
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
It looks like node is compiling some packages for you because it couldn’t find local dependencies. Either node, or the config/make of the library being built, is more than likely manipulating one of the ENV vars that lets your app find the necessary libraries and headers during the build process.
I would see if you can generate .harts for optipng and pngquant, and add those to your pkg_deps. That’s probably what you want, rather than having your package build them through npm every time you rebuild.
This is an interesting case. It looks like the intent of the gifsicle module is to ensure that the binary is always present on the system, and does this by providing a pre-compiled version that is vendored, falling back to compilation if it can’t find an appropriate version.
This is problematic in the hab world, because the vendored gifsicle binary for linux-x86_64 has a package interpreter of /lib64/ld-linux-x86-64.so.2 which doesn’t exist in the studio.
If you fall back to letting it compile, I’m guessing you’ll need to add (at a minimum) core/autoconf, core/automake, and core/gcc to the pkg_build_deps, as well as core/glibc to the pkg_deps.
Habitat already gives you the “presence” guarantees of the gifsicle module though, so you could skip it as dependency and run gifsicle directly if you don’t need to support this app outside of a Habitat build.
gifsicle is the simple case. It would be nice if I could provide the binary instead of compiling, but the compilation works as is.
More complicated cases are the compilations that are continuing to fail:
> optipng-bin@3.1.4 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor/optipng ENOENT
⚠ optipng pre-build test failed
ℹ compiling from source
✖ Error: ./configure --with-system-zlib --prefix="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor" --bindir="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor" && make install
Command failed: ./configure --with-system-zlib --prefix="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor" --bindir="/hab/cache/src/forest-portal-0.1.0/node_modules/optipng-bin/vendor"
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
> pngquant-bin@4.0.0 postinstall /hab/cache/src/forest-portal-0.1.0/node_modules/pngquant-bin
> node lib/install.js
⚠ spawn /hab/cache/src/forest-portal-0.1.0/node_modules/pngquant-bin/vendor/pngquant ENOENT
⚠ pngquant pre-build test failed
ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at Promise.all.then.arr (/hab/cache/src/forest-portal-0.1.0/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pngquant-bin@4.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pngquant-bin@4.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-06-21T05_22_16_738Z-debug.log