hhatto / pgmagick

pgmagick is a yet another boost.python based wrapper for GraphicsMagick/ImageMagick.
MIT License
147 stars 33 forks source link

Failure to build on OS X 10.11 #3

Closed russss closed 8 years ago

russss commented 8 years ago

OS X 10.11.2 pgmagick 0.6 GraphicsMagick 1.3.23 boost 1.59.0

Fails to build with this error:

    ./src/_Image.cpp:68:10: error: no matching member function for call to 'def'
            .def("adaptiveThreshold", &Magick::Image::adaptiveThreshold, Magick_Image_adaptiveThreshold_overloads_2_3())

I've worked around this by commenting out line 68 in _Image.cpp, as I don't need that method.

hhatto commented 8 years ago

Thanks for reporting.

OS X 10.11.2 pgmagick 0.6 GraphicsMagick 1.3.23 boost 1.59.0

build success on same environment. (install from homebrew and source)

$ brew untap hhatto/pgmagick
$ brew cleanup
$ brew tap hhatto/pgmagick
$ brew install pgmagick
russss commented 8 years ago

I did try the homebrew tap but it failed with the same error (I don't really want to try it again because I currently have a working setup :).

Building again from a fresh checkout causes the same problem - but I have just noticed this:

$ python ./setup.py build
include header path: /usr/local/include/GraphicsMagick/
boost lib: boost_python-mt
library path: /usr/local/lib/libGraphicsMagick++
GraphicsMagick version: 1.3.20
...

setup.py sees the graphicsmagick version as 1.3.20, but I'm fairly sure 1.3.23 is installed:

$ GraphicsMagick-config --version
1.3.23
$ GraphicsMagick++-config --version
1.3.23
$ pkg-config --modversion GraphicsMagick++
1.3.23
$ which GraphicsMagick-config
/usr/local/bin/GraphicsMagick-config

Further digging shows that it's getting the version from the .pc file in an older version of graphicsmagick which is at /usr/local/Cellar/graphicsmagick/1.3.20. The build process then tries to build against the currently-installed version, which is 1.3.23.

This is because of /usr/local/Cellar/graphicsmagick being added to search_include_dirs in setup.py. If there's more than one version of graphicsmagick installed it'll probably return the oldest version first, which seems wrong.

Not sure why that code is scanning the include dirs for .pc files, or whether it's ever right to use a homebrew-installed version of graphicsmagick which isn't linked (homebrew will link the .pc files to /usr/local/lib/pkgconfig/).

I can work around this by changing line 128 of setup.py to search search_pkgconfig_dirs before search_include_dirs:

_version = get_version_from_pc(search_pkgconfig_dirs + search_include_dirs, GMCPP_PC)

After this change it builds successfully.

jcfigueiredo commented 8 years ago

@russss unfortunately I couldn't reproduce/fix with your steps but I'm getting the same errors. What I've done to have a working environment was:

brew uninstall boost
brew uninstall boost-python
brew install homebrew/versions/boost155 --with-thread-unsafe --build-from-source --with-python
LDFLAGS="-L/usr/local/opt/boost155/lib" CFLAGS="-I/usr/local/opt/boost155/include" pip install pgmagick

Hope it helps until we have a fix.

hhatto commented 8 years ago

I can work around this by changing line 128 of setup.py to search search_pkgconfig_dirs before search_include_dirs:

_version = get_version_from_pc(search_pkgconfig_dirs + search_include_dirs, GMCPP_PC)

After this change it builds successfully.

improved to pc file search logic. fix in afb317c6de459079d5c0877e1b59f4cbc01e8773 , and version 0.6.1 released.