westonplatter / phashion

Ruby wrapper around pHash, the perceptual hash library for detecting duplicate multimedia files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alpine docker: pHash.h:60:24: fatal error: sys/sysctl.h: No such file or directory

dennisvandehoef opened this issue · comments

When installing version 1.2.0 in a Docker container running ruby:2.5.0-alpine I get the error.

As readable on https://dev.alpinelinux.org/irclogs/%23alpine-linux-2015-04.log
the fix might be easy, or alredy be in the latest version of pHash.

2015-04-21 23:50:24 I’m running into issues with https://github.com/gH0StArthour/pHash-0.9.6/blob/master/src/pHash.h#L60
2015-04-21 23:50:38 pHash.h:60:24: fatal error: sys/sysctl.h: No such file or directory
2015-04-21 23:51:34 Sounds like it’s a musl thing
2015-04-22 00:25:15 ericflo - install linux-headers & patch the sources to include linux/sysctl.h
2015-04-22 00:37:13 ok will take a look at that, not too sure what all that entails
2015-04-22 01:04:21 ericflo - find #include <sys/sysctl.h> in the header giving you the error - make a patch to replace it with #include <linux/sysctl.h>

Dockerfile to reproduce this error, that also installs the linux-headers

FROM ruby:2.5.0-alpine

RUN apk --no-cache update && apk add --update alpine-sdk tzdata linux-headers
RUN gem update --system && gem install bundler
RUN gem install phashion -v '1.2.0'

It seems for me that is missing some native extensions like imagemagick, libpng-dev, and libjpeg-dev.
Try adding it in your Dockerfile, it could solve this problem.

I tried to provide a minimal docker file, for easy/fast testing.
I have them included in my real docker.

If I add imagemagick-dev libpng-dev libjpeg ist still does not work.
Tried imagemagic 7 and imagemagic 6 ( imagemagick6-dev), libjpeg sadly is not provided in a dev version.

commented

@dennisvandehoef Have you found the solution for this?

Anybody found a solution to this?