Sharp: readelf: Error: '/usr/local/lib /libvips-cpp.so': No such file

Created on 26 Oct 2016  路  19Comments  路  Source: lovell/sharp

Hey there,

I'm trying to deploy my node app on an Ubuntu server. I've set up a docker file to pull and install all the necessary files. However if I want to use sharp version 0.16 or above, I get the following error in the logs. If however I stick to sharp version 0.15 inside my package.json file, it installs everything fine.

I've completely deleted the server and tried to install this on a brand new one. I always get the same error. I looked at previous issues with a similar issue, but they don't seem to work for me (one of them is a mac specific issue, which is irrelevant to my issue on Ubuntu).

Does anyone have any suggestions what I should do to fix this problem? With my docker file, I'm installing libvips version 8.3.3.

readelf: Error: '/usr/local/lib /libvips-cpp.so': No such file
gyp: Call to 'if readelf -Ws "$(PKG_CONFIG_PATH=":$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi' returned exit status 0. while trying to load binding.gyp
npm http GET https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 4.2.0-42-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/src/imageservice/node_modules/sharp
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm http 200 https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz
npm http GET https://registry.npmjs.org/prelude-ls
npm http GET https://registry.npmjs.org/type-check
npm http 200 https://registry.npmjs.org/prelude-ls
npm http 200 https://registry.npmjs.org/type-check
npm http GET https://registry.npmjs.org/deep-is
npm http GET https://registry.npmjs.org/fast-levenshtein
npm http GET https://registry.npmjs.org/wordwrap
npm http 200 https://registry.npmjs.org/deep-is
npm http 200 https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/jsonify
npm http 200 https://registry.npmjs.org/fast-levenshtein
npm http GET https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz
npm http GET https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz
npm http 200 https://registry.npmjs.org/jsonify
npm http 200 https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz
npm http 200 https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz
npm http GET https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz
npm http GET https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz
npm http GET https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.5.tgz
npm http 200 https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz
npm http 200 https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz
npm http GET https://registry.npmjs.org/acorn
npm http 200 https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.5.tgz
npm http GET https://registry.npmjs.org/acorn-jsx
npm http GET https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz
npm ERR! weird error 1
npm http 200 https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz
npm http 200 https://registry.npmjs.org/acorn-jsx
npm http 200 https://registry.npmjs.org/acorn
npm ERR! tar.unpack error reading /root/tmp/npm-7-3dHut-Jq/1477482855073-0.8630997932050377/tmp.tgz
npm ERR! tar pack Error reading /root/tmp/npm-7-3dHut-Jq/1477482854864-0.48442938970401883/package
npm ERR! Error: ENOENT, utime '/root/tmp/npm-7-3dHut-Jq/1477482854810-0.03756607137620449/package/test'
npm ERR! If you need help, you may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /usr/src/imageservice
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-7-3dHut-Jq/1477482854810-0.03756607137620449/package/test
npm ERR! fstream_path /root/tmp/npm-7-3dHut-Jq/1477482854810-0.03756607137620449/package/test/tarray.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call setupMadeDir
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack end (/usr/lib/nodejs/fstream/lib/writer.js:319:21)
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:336:20
npm ERR! fstream_stack next (/usr/lib/nodejs/fstream/lib/writer.js:366:20)
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! addLocalDirectory Could not pack "/root/tmp/npm-7-3dHut-Jq/1477482854864-0.48442938970401883/package" to "/root/.npm/resolve-from/1.0.1/package.tgz"
npm ERR! tar pack Error reading /root/tmp/npm-7-3dHut-Jq/1477482854827-0.8885397869162261/package
npm ERR! tar pack Error reading /root/tmp/npm-7-3dHut-Jq/1477482854827-0.8885397869162261/package
npm http GET https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz
npm ERR! addLocalDirectory Could not pack "/root/tmp/npm-7-3dHut-Jq/1477482854827-0.8885397869162261/package" to "/root/.npm/flat-cache/1.2.1/package.tgz"
npm ERR! addLocalDirectory Could not pack "/root/tmp/npm-7-3dHut-Jq/1477482854827-0.8885397869162261/package" to "/root/.npm/flat-cache/1.2.1/package.tgz"
npm http GET https://registry.npmjs.org/acorn/-/acorn-4.0.3.tgz
npm http 200 https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz
npm http 200 https://registry.npmjs.org/acorn/-/acorn-4.0.3.tgz
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/usr/src/imageservice/node_modules/eslint/node_modules/shelljs/src'
npm ERR! error rolling back [email protected] { [Error: ENOTEMPTY, rmdir '/usr/src/imageservice/node_modules/eslint/node_modules/shelljs/src']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: '/usr/src/imageservice/node_modules/eslint/node_modules/shelljs/src' }
npm ERR! Error: ENOENT, open '/usr/src/imageservice/node_modules/eslint/node_modules/inquirer/lib/utils/readline.js'
npm ERR! If you need help, you may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /usr/src/imageservice
npm ERR! node -v v0
.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/src/imageservice/node_modules/eslint/node_modules/inquirer/lib/utils/readline.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! Error: ENOENT, lstat '/usr/src/imageservice/node_modules/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/dependencies.json'
npm ERR! If you need help, you may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /usr/src/imageservice
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/src/imageservice/node_modules/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/dependencies.json
npm ERR! fstream_path /usr/src/imageservice/node_modules/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/dependencies.json
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/usr/src/imageservice/node_modules/eslint/node_modules/js-yaml/dist/js-yaml.js'
npm ERR! If you need help, you may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /usr/src/imageservice
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/src/imageservice/node_modules/eslint/node_modules/js-yaml/dist/js-yaml.js
npm ERR! fstream_path /usr/src/imageservice/node_modules/eslint/node_modules/js-yaml/dist/js-yaml.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/usr/src/imageservice/node_modules/eslint/node_modules/glob/node_modules/minimatch/minimatch.js'
npm ERR! If you need help, you may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /usr/src/imageservice
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/src/imageservice/node_modules/eslint/node_modules/glob/node_modules/minimatch/minimatch.js
npm ERR! fstream_path /usr/src/imageservice/node_modules/eslint/node_modules/glob/node_modules/minimatch/minimatch.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/usr/src/imageservice/node_modules/eslint/node_modules/table/dist/validateConfig.js'
npm ERR! If you need help, you may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /usr/src/imageservice
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/src/imageservice/node_modules/eslint/node_modules/table/dist/validateConfig.js
npm ERR! fstream_path /usr/src/imageservice/node_modules/eslint/node_modules/table/dist/validateConfig.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/root/tmp/npm-7-3dHut-Jq/1477482847868-0.11803021607920527/package/data/haarcascade_frontalface_alt_tree.xml'
npm ERR! If you need help, you may report this log at:
npm ERR!
npm ERR! or email it to:
npm ERR!
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /usr/src/imageservice
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-7-3dHut-Jq/1477482847868-0.11803021607920527/package/data/haarcascade_frontalface_alt_tree.xml
npm ERR! fstream_path /root/tmp/npm-7-3dHut-Jq/1477482847868-0.11803021607920527/package/data/haarcascade_frontalface_alt_tree.xml
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http GET https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz
npm http 200 https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/src/imageservice/npm-debug.log
npm ERR! not ok code 0
The command '/bin/sh -c npm install' returned a non-zero code: 1
bug

All 19 comments

Hello, I'm assuming you need/want to use a global (perhaps custom) installation of libvips.

The salient error is:

readelf: Error: '/usr/local/lib /libvips-cpp.so': No such file
gyp: Call to 'if readelf -Ws "$(PKG_CONFIG_PATH=":$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi' returned exit status 0. while trying to load binding.gyp

What do the following commands produce?

pkg-config --libs-only-L vips-cpp
echo "[$(pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so]"

I'm having trouble ssh'ing into the server, as it's not running. I'm using Cloud66 to manage it for me. I've updated my docker file to explicitly use Node 4.6.1 (because in the logs I posted above, it mentions something about legacy node).

At least that warning is now gone, but I still have the same issue with the:
readelf: Error: '/usr/local/lib /libvips-cpp.so': No such file

I'll see if I can somehow print out the thing you just asked above and report back here.

I've placed it inside my docker file for now, not sure if this is the full output:

Step 34 : RUN echo "[$(pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so]"
[/usr/local/lib /libvips-cpp.so]

Step 35 : RUN pkg-config --libs-only-L vips-cpp
-L/usr/local/lib

Thanks, something is injecting an extra space.

A couple more please to help narrow this down:

echo "[$(pkg-config --libs-only-L vips-cpp)]"
echo "[$(pkg-config --libs-only-L vips-cpp | cut -c 3-)]"

Sure, here's you go:

Step 34 : RUN echo "[$(pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so]"
[/usr/local/lib /libvips-cpp.so]

Step 35 : RUN pkg-config --libs-only-L vips-cpp
-L/usr/local/lib

Step 36 : RUN echo "[$(pkg-config --libs-only-L vips-cpp)]"
[-L/usr/local/lib ]

Step 37 : RUN echo "[$(pkg-config --libs-only-L vips-cpp | cut -c 3-)]"
[/usr/local/lib ]

Thanks, either pkg-config or its libvips config is injecting the space. I've not seen this before.

What does the vips-cpp.pc file look like?

cat /usr/local/lib/pkgconfig/vips-cpp.pc

Here's what I got back adding that line to my docker file:

Step 38 : RUN cat /usr/local/lib/pkgconfig/vips-cpp.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: vips-cpp
Description: C++ API for vips8 image processing library
Version: 8.3.3
Requires: vips gobject-2.0
Libs: -L${libdir} -lvips-cpp

I deleted my the whole container and tried to redeploy it. I also updated the version of libvips to the latest version in my docker file. Here's the output that I get now:

npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
> [email protected] install /usr/src/imageservice/node_modules/sharp
> node-gyp rebuild
readelf: Error: '/usr/local/lib /libvips-cpp.so': No such file
gyp: Call to 'if readelf -Ws "$(PKG_CONFIG_PATH=":$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.2.0-42-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/imageservice/node_modules/sharp
gyp ERR! node -v v4.6.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
> [email protected] install /usr/src/imageservice/node_modules/faced/node_modules/opencv
> node-pre-gyp install --fallback-to-build
make: Entering directory `/usr/src/imageservice/node_modules/faced/node_modules/opencv/build'
CXX(target) Release/obj.target/opencv/src/init.o
CXX(target) Release/obj.target/opencv/src/Matrix.o
CXX(target) Release/obj.target/opencv/src/OpenCV.o
CXX(target) Release/obj.target/opencv/src/CascadeClassifierWrap.o
CXX(target) Release/obj.target/opencv/src/Contours.o
CXX(target) Release/obj.target/opencv/src/Point.o
CXX(target) Release/obj.target/opencv/src/VideoCaptureWrap.o
CXX(target) Release/obj.target/opencv/src/CamShift.o
CXX(target) Release/obj.target/opencv/src/HighGUI.o
CXX(target) Release/obj.target/opencv/src/FaceRecognizer.o
CXX(target) Release/obj.target/opencv/src/Features2d.o
CXX(target) Release/obj.target/opencv/src/BackgroundSubtractor.o
CXX(target) Release/obj.target/opencv/src/Constants.o
CXX(target) Release/obj.target/opencv/src/Calib3D.o
CXX(target) Release/obj.target/opencv/src/ImgProc.o
CXX(target) Release/obj.target/opencv/src/Stereo.o
CXX(target) Release/obj.target/opencv/src/LDAWrap.o
SOLINK_MODULE(target) Release/obj.target/opencv.node
COPY Release/opencv.node
COPY /usr/src/imageservice/node_modules/faced/node_modules/opencv/build/opencv/v6.0.0/Release/node-v46-linux-x64/opencv.node
TOUCH Release/obj.target/action_after_build.stamp
CXX(target) Release/obj.target/test_nativemat/test/nativemat.o
SOLINK_MODULE(target) Release/obj.target/test_nativemat.node
COPY Release/test_nativemat.node
make: Leaving directory `/usr/src/imageservice/node_modules/faced/node_modules/opencv/build'
npm ERR! Linux 4.2.0-42-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.6.1
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls sharp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/imageservice/npm-debug.log
The command '/bin/sh -c sudo npm install' returned a non-zero code: 1

It still has the space for some reason readelf: Error: '/usr/local/lib /libvips-cpp.so': No such file

I'll have to dig deeper into it some time this week, but if you have any suggestions, please feel free to share them!

Thanks

Thanks for checking. My best guess is that some versions of pkgconfig are inserting a trailing space at the end of their result so I'll need to add logic to trim this.

In the meantime, if you can live without your custom installation of libvips, then don't install it and let sharp download its own binaries.

I was using the docker file from the link you posted. I then changed it to use the deprecated script instead, however I still have the exact same problem. Same error.

Now I just tried by not installing libvips myself, and instead leave sharp to do whatever it does during an npm install command. Surprisingly, it now works fine.

That's so weird. I've no idea why I've been getting that error when I'm trying to install it globally. And that only started happening from version 0.16+. Anyway, thanks a lot for your help! Will clean up my docker file and stick with sharp installing the dependance of libvips. :)

v0.16.1 introduced an automated check (via readelf) to determine which version of the C++11 ABI was used to compile a globally-installed libvips-cpp.so shared library, if any.

If it's OK with you, I'd like to keep this issue open to remind me to add logic to handle the extra whitespace some versions of pkgconfig appear to be adding (although I've not yet been able to reproduce this - will try via https://hub.docker.com/r/marcbachmann/libvips/).

Ahhh okay, fair enough.

I can share my docker file if you want. I didn't use marcbachmann's directly, instead I copied everything within it and added it to my own docker file (I need to install a few different things, so my base file is ubuntu).

It's also not the cleanest or the most efficient, but I can still share it if it would help you.

"I can share my docker file"

Yes please.

Here you go. It mainly installs libvips, opencv, nodejs 4.6.1 and the Go programming language.

#FROM marcbachmann/libvips:8.2.3
FROM ubuntu:14.04

ENV LIBVIPS_VERSION_MAJOR 8
ENV LIBVIPS_VERSION_MINOR 4
ENV LIBVIPS_VERSION_PATCH 1
ENV LIBVIPS_VERSION $LIBVIPS_VERSION_MAJOR.$LIBVIPS_VERSION_MINOR.$LIBVIPS_VERSION_PATCH

# Install dependencies
RUN \
    apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
    automake build-essential curl \
    gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg-turbo8-dev libpng12-dev \
    libwebp-dev libtiff5-dev libgif-dev libexif-dev libxml2-dev libpoppler-glib-dev \
    swig libmagickwand-dev libpango1.0-dev libmatio-dev libopenslide-dev libcfitsio3-dev \
    libgsf-1-dev fftw3-dev liborc-0.4-dev librsvg2-dev && \

    # Build libvips
    cd /tmp && \
    curl -O http://www.vips.ecs.soton.ac.uk/supported/$LIBVIPS_VERSION_MAJOR.$LIBVIPS_VERSION_MINOR/vips-$LIBVIPS_VERSION.tar.gz && \
    tar zvxf vips-$LIBVIPS_VERSION.tar.gz && \
    cd /tmp/vips-$LIBVIPS_VERSION && \
    ./configure --enable-debug=no --without-python $1 && \
    make && \
    make install && \
    ldconfig && \

    # Clean up
    apt-get remove -y curl automake build-essential && \
    apt-get autoremove -y && \
    apt-get autoclean && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


WORKDIR /

# Install opencv for face detection
RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y unzip wget build-essential \
        cmake git pkg-config libswscale-dev \
        python3-dev python3-numpy \
        libtbb2 libtbb-dev libjpeg-dev \
        libpng-dev libtiff-dev libjasper-dev

RUN cd \
    && wget https://github.com/opencv/opencv/archive/2.4.13.zip \
    && unzip 2.4.13.zip \
    && cd opencv-2.4.13 \
    && mkdir build \
    && cd build \
    && cmake .. \
    && make -j3 \
    && make install \
    && cd \
    && rm 2.4.13.zip


WORKDIR /

RUN apt-get update \
    && apt-get install -y curl \
    && apt-get install -y git

RUN set -ex \
  && for key in \
    9554F04D7259F04124DE6B476D5A82AC7E37093B \
    94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
    0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
    FD3A5288F042B6850C66B31F09FE44734EB7990E \
    71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
    DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
    B9AE9905FFD7803F25714661B63B535A4C206CA9 \
    C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
  ; do \
    gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$key"; \
  done


ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 4.6.1

RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
  && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
  && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
  && grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
  && tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
  && rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
  && ln -s /usr/local/bin/node /usr/local/bin/nodejs

WORKDIR /


# Install Golang for primitive
RUN apt-get update && apt-get install -y --no-install-recommends \
    g++ \
    gcc \
    libc6-dev \
    make \
    pkg-config \
    && rm -rf /var/lib/apt/lists/*

ENV GOLANG_VERSION 1.7.3
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 508028aac0654e993564b6e2014bf2d4a9751e3b286661b0b0040046cf18028e

RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
    && echo "$GOLANG_DOWNLOAD_SHA256  golang.tar.gz" | sha256sum -c - \
    && tar -C /usr/local -xzf golang.tar.gz \
    && rm golang.tar.gz

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH

COPY go-wrapper /usr/local/bin/



WORKDIR /

RUN apt-get update && apt-get install -y --no-install-recommends \
    npm \
    pkg-config


# Install primitive
RUN mkdir -p go
ENV GOPATH=$HOME/go
ENV PATH=$PATH:$GOPATH/bin
RUN go get -u github.com/fogleman/primitive


WORKDIR /

RUN echo "[$(pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so]"

RUN pkg-config --libs-only-L vips-cpp

RUN echo "[$(pkg-config --libs-only-L vips-cpp)]"
RUN echo "[$(pkg-config --libs-only-L vips-cpp | cut -c 3-)]"

RUN cat /usr/local/lib/pkgconfig/vips-cpp.pc



# Create app directory
RUN mkdir -p /usr/src/imageservice
WORKDIR /usr/src/imageservice

# Install app dependencies
COPY package.json /usr/src/imageservice/
RUN sudo npm install

# Bundle app source
COPY . /usr/src/imageservice

EXPOSE 80 3001
CMD [ "npm", "start" ]

This looks like a bug in v0.26 of pkg-config, which ships with Ubuntu 14.04. Changing to pkg-config v0.29 as shipped in Ubuntu 16.04 works fine. I'll add something to handle the extraneous whitespace all the same. Thanks for reporting.

Ah, well now it all makes sense why I was having issues. :)

Commit 594085b on the quill branch should fix this. This will be in v0.17.0.

v0.17.0 now available with this fix.

Was this page helpful?
0 / 5 - 0 ratings