Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another issue with installing on Mac OS #161

Open
antonk52 opened this issue Apr 6, 2017 · 8 comments
Open

Another issue with installing on Mac OS #161

antonk52 opened this issue Apr 6, 2017 · 8 comments

Comments

@antonk52
Copy link

antonk52 commented Apr 6, 2017

I am using imagemagick-native on my server and it works like a charm. However on my local machine

  • Mac OS El Capitan 10.11.6
  • Node v6.10.1
  • npm v3.10.10

I keep running into issues. I already had installed with brew

  • pkgconfig v0.29.2
  • imagemagick v7.0.5-4

After running npm i -S imagemagick-native I ran into following error

> imagemagick-native@1.9.3 install /Users/Anton/Documents/node/bcnspots/node_modules/imagemagick-native
> node-gyp rebuild

Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
gyp: Call to 'Magick++-config --ldflags --libs' 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:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 15.6.0
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 /Users/Anton/Documents/node/bcnspots/node_modules/imagemagick-native
gyp ERR! node -v v6.10.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i"
npm ERR! node v6.10.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! imagemagick-native@1.9.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the imagemagick-native@1.9.3 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the imagemagick-native 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 imagemagick-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls imagemagick-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Anton/Documents/node/bcnspots/npm-debug.log

I attempted to add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable with

export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/7.0.5-4/lib/pkgconfig/

and now the output of npm i -S imagemagick-native is

> imagemagick-native@1.9.3 install /Users/Anton/Documents/node/bcnspots/node_modules/imagemagick-native
> node-gyp rebuild

  CXX(target) Release/obj.target/imagemagick/src/imagemagick.o
../src/imagemagick.cc:262:40: error: no member named 'FilterTypes' in
      namespace 'Magick'
            image.filterType( (Magick::FilterTypes)option_info );
                               ~~~~~~~~^
../src/imagemagick.cc:327:30: error: no matching constructor for
      initialization of 'Magick::Geometry'
  ...resizeGeometry( resizewidth, resizeheight, 0, 0, 0, 0 );
     ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:52:5: note:
      candidate constructor not viable: requires at most 4 arguments,
      but 6 were provided
    Geometry(size_t width_,size_t height_,::ssize_t xOff_=0,
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:43:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const char *geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:46:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const Geometry &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:49:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const std::string &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:119:5: note:
      candidate constructor not viable: requires single argument
      'rectangle_', but 6 arguments were provided
    Geometry(const MagickCore::RectangleInfo &rectangle_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:40:5: note:
      candidate constructor not viable: requires 0 arguments, but 6
      were provided
    Geometry();
    ^
../src/imagemagick.cc:345:34: error: no matching constructor for
      initialization of 'Magick::Geometry'
  ...cropGeometry( width, height, xoffset, yoffset, 0, 0 );
     ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:52:5: note:
      candidate constructor not viable: requires at most 4 arguments,
      but 6 were provided
    Geometry(size_t width_,size_t height_,::ssize_t xOff_=0,
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:43:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const char *geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:46:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const Geometry &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:49:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const std::string &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:119:5: note:
      candidate constructor not viable: requires single argument
      'rectangle_', but 6 arguments were provided
    Geometry(const MagickCore::RectangleInfo &rectangle_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:40:5: note:
      candidate constructor not viable: requires 0 arguments, but 6
      were provided
    Geometry();
    ^
../src/imagemagick.cc:351:33: error: no member named 'alpha' in
      'Magick::Color'
                    transparent.alpha( 1. );
                    ~~~~~~~~~~~ ^
../src/imagemagick.cc:425:15: error: no matching member function for
      call to 'density'
        image.density(Magick::Geometry(context->density, conte...
        ~~~~~~^~~~~~~
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Image.h:211:10: note:
      candidate function not viable: no known conversion from
      'Magick::Geometry' to 'const Magick::Point' for 1st argument
    void density(const Point &density_);
         ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Image.h:212:11: note:
      candidate function not viable: requires 0 arguments, but 1 was
      provided
    Point density(void) const;
          ^
../src/imagemagick.cc:646:26: error: no viable conversion from
      'Magick::Point' to 'Magick::Geometry'
        Magick::Geometry density = context->image.density();
                         ^         ~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:43:5: note:
      candidate constructor not viable: no known conversion from
      'Magick::Point' to 'const char *' for 1st argument
    Geometry(const char *geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:46:5: note:
      candidate constructor not viable: no known conversion from
      'Magick::Point' to 'const Magick::Geometry &' for 1st argument
    Geometry(const Geometry &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:49:5: note:
      candidate constructor not viable: no known conversion from
      'Magick::Point' to 'const std::string &' (aka 'const
      basic_string<char, char_traits<char>, allocator<char> > &') for
      1st argument
    Geometry(const std::string &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:119:5: note:
      candidate constructor not viable: no known conversion from
      'Magick::Point' to 'const MagickCore::RectangleInfo &' (aka
      'const MagickCore::_RectangleInfo &') for 1st argument
    Geometry(const MagickCore::RectangleInfo &rectangle_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:244:5: note:
      candidate function
    operator std::string() const;
    ^
../src/imagemagick.cc:803:11: error: no type named 'PixelPacket' in
      namespace 'Magick'; did you mean 'MagickCore::PixelPacket'?
    const Magick::PixelPacket *pixels = image.getConstPixels(x...
          ^~~~~~~~~~~~~~~~~~~
          MagickCore::PixelPacket
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/MagickCore/pixel.h:204:3: note:
      'MagickCore::PixelPacket' declared here
} PixelPacket;
  ^
../src/imagemagick.cc:803:32: error: cannot initialize a variable of
      type 'const MagickCore::PixelPacket *' (aka 'const
      MagickCore::_PixelPacket *') with an rvalue of type
      'const Quantum *' (aka 'const float *')
  ...pixels = image.getConstPixels(xValue, yValue, columnsValue, rowsValue);
     ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/imagemagick.cc:807:29: error: use of undeclared identifier
      'pixel'; did you mean 'pixels'?
        Magick::PixelPacket pixel = pixels[ i ];
                            ^~~~~
                            pixels
../src/imagemagick.cc:803:32: note: 'pixels' declared here
    const Magick::PixelPacket *pixels = image.getConstPixels(x...
                               ^
../src/imagemagick.cc:807:28: error: expected ';' after expression
        Magick::PixelPacket pixel = pixels[ i ];
                           ^
                           ;
../src/imagemagick.cc:807:17: error: no member named 'PixelPacket' in
      namespace 'Magick'
        Magick::PixelPacket pixel = pixels[ i ];
        ~~~~~~~~^
../src/imagemagick.cc:810:84: error: use of undeclared identifier
      'pixel'
  ...Nan::New<Integer>(pixel.red));
                       ^
../src/imagemagick.cc:811:84: error: use of undeclared identifier
      'pixel'
  ...Nan::New<Integer>(pixel.green));
                       ^
../src/imagemagick.cc:812:84: error: use of undeclared identifier
      'pixel'
  ...Nan::New<Integer>(pixel.blue));
                       ^
../src/imagemagick.cc:813:84: error: use of undeclared identifier
      'pixel'
  ...Nan::New<Integer>(pixel.opacity));
                       ^
../src/imagemagick.cc:874:22: error: no matching constructor for
      initialization of 'Magick::Geometry'
    Magick::Geometry resizeGeometry( rows, columns, 0, 0, 0, 0 );
                     ^               ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:52:5: note:
      candidate constructor not viable: requires at most 4 arguments,
      but 6 were provided
    Geometry(size_t width_,size_t height_,::ssize_t xOff_=0,
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:43:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const char *geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:46:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const Geometry &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:49:5: note:
      candidate constructor not viable: requires single argument
      'geometry_', but 6 arguments were provided
    Geometry(const std::string &geometry_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:119:5: note:
      candidate constructor not viable: requires single argument
      'rectangle_', but 6 arguments were provided
    Geometry(const MagickCore::RectangleInfo &rectangle_);
    ^
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/Magick++/Geometry.h:40:5: note:
      candidate constructor not viable: requires 0 arguments, but 6
      were provided
    Geometry();
    ^
../src/imagemagick.cc:884:5: error: no type named 'PixelPacket' in
      namespace 'Magick'; did you mean 'MagickCore::PixelPacket'?
    Magick::PixelPacket* pixels = image.getPixels(0, 0, image....
    ^~~~~~~~~~~~~~~~~~~
    MagickCore::PixelPacket
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/MagickCore/pixel.h:204:3: note:
      'MagickCore::PixelPacket' declared here
} PixelPacket;
  ^
../src/imagemagick.cc:884:26: error: cannot initialize a variable of
      type 'MagickCore::PixelPacket *' (aka 'MagickCore::_PixelPacket
      *') with an rvalue of type 'Quantum *' (aka 'float *')
  ...pixels = image.getPixels(0, 0, image.columns(), image.rows());
     ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/imagemagick.cc:886:5: error: no type named 'PixelPacket' in
      namespace 'Magick'; did you mean 'MagickCore::PixelPacket'?
    Magick::PixelPacket* colors = new Magick::PixelPacket[colo...
    ^~~~~~~~~~~~~~~~~~~
    MagickCore::PixelPacket
/usr/local/Cellar/imagemagick/7.0.5-4/include/ImageMagick-7/MagickCore/pixel.h:204:3: note:
      'MagickCore::PixelPacket' declared here
} PixelPacket;
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/imagemagick/src/imagemagick.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 15.6.0
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 /Users/Anton/Documents/node/bcnspots/node_modules/imagemagick-native
gyp ERR! node -v v6.10.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "-S" "imagemagick-native"
npm ERR! node v6.10.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! imagemagick-native@1.9.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the imagemagick-native@1.9.3 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the imagemagick-native 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 imagemagick-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls imagemagick-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Anton/Documents/node/bcnspots/npm-debug.log

After looking at following

#120
JustinTulloss/zeromq.node#50
#109
#98

I added following to my .profile file

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

But the output of npm i -S imagemagick-native remains the same as above.

If I try to echo the path I get the following

> echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig:

Is there something I am missing or is there a missing step of the installation process?

Thank you

@elad
Copy link
Owner

elad commented Apr 6, 2017

Hey! A few people have reported issues with this module lately. Unfortunately, I haven't used it in years because I'm no longer working on the project that required it. So I can't offer much insight - definitely not in a reasonable time - into how to make things work. :( It could be that newer versions of the compiler are more strict, that newer versions of the libraries/modules are incompatible, or really, a lot of other things.

If you can't figure out a solution, I recommend looking at native javascript modules (like Jimp) before digging deeper into C++ bindings. :) Good luck!

@cartuchogl
Copy link
Collaborator

@antonk52 could you try with imagemagick v6.9.x. 6.9.6 is the version that I use on macos 10.12.3

@antonk52
Copy link
Author

antonk52 commented Apr 6, 2017

thank you for your answers @elad and @cartuchogl

If I try to install a 6.9v, I first remove IM with brew uninstall imagemagick and then I get this

> brew install imagemagick@6.9
Error: No available formula with the name "imagemagick@6.9"
==> Searching for a previously deleted formula...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.

same for @6.9.6

But I succeeded with brew install imagemagick@6

Then when I tried to install the npm module I got the same as the first result

> npm i -S imagemagick-native

> imagemagick-native@1.9.3 install /Users/Anton/Documents/node/bcnspots/node_modules/imagemagick-native
> node-gyp rebuild

Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
gyp: Call to 'Magick++-config --ldflags --libs' 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:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 15.6.0
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 /Users/Anton/Documents/node/bcnspots/node_modules/imagemagick-native
gyp ERR! node -v v6.10.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "-S" "imagemagick-native"
npm ERR! node v6.10.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! imagemagick-native@1.9.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the imagemagick-native@1.9.3 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the imagemagick-native 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 imagemagick-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls imagemagick-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Anton/Documents/node/bcnspots/npm-debug.log

so I found where the Magick++.pc was and added following

> export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.8-3/lib/pkgconfig

But when I tried to install the npm module it gave me the same output

@zinne
Copy link

zinne commented May 28, 2017

Had the same issue with Sierra 10.12.5
What I did to get it worked:
First uninstalled all:
$ brew uninstall imagemagick
installed imagemagick v6:
$ brew install imagemagick@6 --force
check if pkgconfig is installed and set permissions:
$ brew install pkgconfig && chmod 755 /usr/local/lib/pkgconfig
Link:
$ brew link imagemagick@6 --force
do the path bla brew told me:
$ echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile

Finally reinstalling works with no errors...
$ npm install imagemagick-native --save

@nebulr
Copy link

nebulr commented Jun 28, 2017

@zinne that fixed it for me thanks. As a sidenote I had to additionally add the --force flag for the uninstall

@johnelliott
Copy link

Thank you @zinne. The exact version of imagemagick 6 got when I installed @6 was different, so I needed: export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.9-9/lib/pkgconfig/

@terion-name
Copy link

@zinne catalina, not working :(

@MoSofi
Copy link

MoSofi commented Aug 27, 2020

@terion-name were you able to get it to work on Catalina? I am also unable to get it to work on Catalina 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants