5

trying to install phash-image for node but i get this error:

> phash-image@3.1.0 install /Users/jong/Workspace/mgmtio/phash-image
> node-gyp rebuild

  CXX(target) Release/obj.target/pHash/phash.o
In file included from ../phash.cpp:4:
In file included from /usr/local/Cellar/phash/0.9.6_1/include/pHash.h:50:
/usr/local/include/CImg.h:160:10: fatal error: 'initializer_list' file not found
#include <initializer_list>
         ^
1 error generated.
make: *** [Release/obj.target/pHash/phash.o] Error 1

how do i fix this? i am on os x 10.10.3 and installed phash with homebrew

bfontaine
  • 18,169
  • 13
  • 73
  • 107
Jonathan Ong
  • 19,927
  • 17
  • 79
  • 118
  • 1
    Did you google for `initializer_list` header, did you `find /usr/include -name initializer_list` did you search for the file? – Iharob Al Asimi Apr 25 '15 at 20:40

1 Answers1

3

found out i need to add these flags:

        [
          '-mmacosx-version-min=10.7',
          '<!@(pkg-config --cflags pHash)',
          '-std=c++11',
          '-stdlib=libc++'
        ]
Jonathan Ong
  • 19,927
  • 17
  • 79
  • 118
  • 1
    Where and how do you add these flags? – Sparragus Aug 19 '15 at 17:40
  • @Sparragus, you might try adding it as follows before you run the command `CFLAGS='-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++'` – Michael Barton Dec 09 '16 at 18:29
  • What about Linux? Do you know what flags should I use? – hola Apr 20 '18 at 08:56
  • I ran into this problem (on Mac) with NPM trying to compile polyfill-service/zopfli. I tried the above suggestion with CFLAGS but hit a problem on another module: "invalid argument '-std=c++11' not allowed with C/ObjC". So I changed CFLAGS to CXXFLAGS and it worked. – Alex Mar 11 '19 at 18:12