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

Can't install on Mavericks ('png.h' file not found)

n1313 opened this issue · comments

Hello. I'm on MacOS Mavericks with libpng installed via macports. Xcode is also installed. This is the output of port contents libpng:

Port libpng contains:
  /opt/local/bin/libpng-config
  /opt/local/bin/libpng16-config
  /opt/local/bin/png-fix-itxt
  /opt/local/bin/pngfix
  /opt/local/include/libpng16/png.h
  /opt/local/include/libpng16/pngconf.h
  /opt/local/include/libpng16/pnglibconf.h
  /opt/local/include/png.h
  /opt/local/include/pngconf.h
  /opt/local/include/pnglibconf.h

...and so on.

When I try to gem install phashion, this is basically what I get:

Making install in src
/bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..   -D_THREAD_SAFE -I/usr/local/include -Dcimg_use_png -Dcimg_use_jpeg -Dcimg_use_fftw3  -pthread -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c -o pHash.lo pHash.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -D_THREAD_SAFE -I/usr/local/include -Dcimg_use_png -Dcimg_use_jpeg -Dcimg_use_fftw3 -pthread -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c pHash.cpp  -fno-common -DPIC -o pHash.o
In file included from pHash.cpp:25:
In file included from ./pHash.h:50:
../CImg.h:246:10: fatal error: 'png.h' file not found
#include "png.h"
         ^
1 error generated.
make[1]: *** [pHash.lo] Error 1
make: *** [install-recursive] Error 1
mv CImg.h ../include 2>&1
*** extconf.rb failed ***

How can I fix that? Any help would be greatly appreciated.

Two options:

  1. CPPFLAGS=-I/opt/local/include gem install phashion
  2. Add something like this to you .bash_profile (depending on what shell you use, of course); export CPLUS_INCLUDE_PATH="/opt/local/include:$CPLUS_INCLUDE_PATH"

(I do not run Mavericks, so this may not work exactly right, but give it a whirl, I think it might)

@n1313 hey, sorry it took me so long to reply. I think I rigged my github notifications preferences incorrectly. :)

Did @twoofy's suggestions help at all? Are you still having issues?

commented

I am on Maverick, and have the same error when trying to run bundle install.

Option #1 from @twoofy seems to solve the issue.

@wa0x6e glad you got a solution.