Closed vigo332 closed 6 years ago
Hi,
we don't support Boost in custom directories - only in system ones - right now - but it should be easy to provide this functionality. IMHO it should be enough to alter setup.py
include_dirs
is defined)
if 'BOOST_INC' in os.environ:
include_dirs.append(os.environ['BOOST_INC'])
setup.py
and Ln 125-143 to see how the boost_python library name is detected) or accept library_dirs
(Ln 14) and libraries
(Ln 145) from env similar to include_dirspython setup.py install
as for compiling from source you probably want to pass -DPGMAGICK_LIB_GRAPHICSMAGICK*
defines (see compiler output from Pip case) to support newer methods and signatures. As a side-effect this should solve the problem with adaptiveThreshold
Hi, @komackaj
Thanks very much for the heads-up. I am able to compile from source using the following modified Makefile.
1 CC = g++ 2 FLAGS = -Wall 3 INCS = -I$(PYTHONPATH)/../include/python2.7 -I$(MAGICK_HOME)/include/GraphicsMagick -I$(BOOST_INC) 4 5 SO = _pgmagick.so 6 LIBS = -lboost_python -lGraphicsMagick -L$(MAGICK_HOME)/lib -L$(BOOST_LIB) 7 LINK_FLAGS = -fPIC -shared 8 CPPFLAGS =-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_26 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_24 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_22 -DPGMAGICK_LIB_GRAPHICSMAGI CK_1_3_20 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6 -DPGMAGICK_LIB_GRAPHICSMAGICK _1_3_x
124 $(SO): $(OBJS) 125 $(CC) $(CPPFLAGS) $(LIBS) $(LINK_FLAGS) -o $(SO) $^ 126 127 .cpp.o: 128 $(CC) $(CPPFLAGS) $(FLAGS) $(INCS) $(LINK_FLAGS) -o $@ -c $< 129 130 clean: 131 rm -rf $(OBJS) $(SO)
Hi, Developer,
I am working on RedHat 6.9 x86_64 with python/2.7.x-anaconda, ImageMagic 7.0.7-4 Q16 and GraphicsMagick 1.3.27. I tried to pip install pgmagick and manual source install, but came across the error with boost python.
For pip install,
the BOOST_INC env variable is not honored as the following error: Collecting pgmagick Using cached pgmagick-0.7.2.tar.gz Building wheels for collected packages: pgmagick Running setup.py bdist_wheel for pgmagick ... error Complete output from command /home2/s167891/.conda/envs/catmaid/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-Qb9ny7/pgmagick/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpKPGmqZpip-wheel- --python-tag cp27: adding extra include directory /home2/s167891/installs/GraphicsMagick/include adding extra library directory /home2/s167891/installs/GraphicsMagick/lib adding extra pkgconfig directory /home2/s167891/installs/GraphicsMagick/lib/pkgconfig include header path: /home2/s167891/installs/GraphicsMagick/include/GraphicsMagick boost lib: boost_python library path: /home2/s167891/installs/GraphicsMagick/lib/libGraphicsMagick++ Found version 1.3.27 in file /home2/s167891/installs/GraphicsMagick/lib/pkgconfig/GraphicsMagick++.pc GraphicsMagick version: 1.3.27 running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/pgmagick copying pgmagick/init.py -> build/lib.linux-x86_64-2.7/pgmagick copying pgmagick/_version.py -> build/lib.linux-x86_64-2.7/pgmagick copying pgmagick/api.py -> build/lib.linux-x86_64-2.7/pgmagick running build_ext building 'pgmagick._pgmagick' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/src gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home2/s167891/.conda/envs/catmaid/include/python2.7 -I/home2/s167891/installs/GraphicsMagick/include/GraphicsMagick -I/home2/s167891/.conda/envs/catmaid/include/python2.7 -c ./src/_DecorationType.cpp -o build/temp.linux-x86_64-2.7/./src/_DecorationType.o -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_26 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_24 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_22 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_20 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x -D_LIBRARY_VERSION="1.3.27" cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ ./src/_DecorationType.cpp:1:28: fatal error: boost/python.hpp: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1
Failed building wheel for pgmagick Running setup.py clean for pgmagick Failed to build pgmagick Installing collected packages: pgmagick Running setup.py install for pgmagick ... error Complete output from command /home2/s167891/.conda/envs/catmaid/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-Qb9ny7/pgmagick/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-Wp2z41-record/install-record.txt --single-version-externally-managed --compile: adding extra include directory /home2/s167891/installs/GraphicsMagick/include adding extra library directory /home2/s167891/installs/GraphicsMagick/lib adding extra pkgconfig directory /home2/s167891/installs/GraphicsMagick/lib/pkgconfig include header path: /home2/s167891/installs/GraphicsMagick/include/GraphicsMagick boost lib: boost_python library path: /home2/s167891/installs/GraphicsMagick/lib/libGraphicsMagick++ Found version 1.3.27 in file /home2/s167891/installs/GraphicsMagick/lib/pkgconfig/GraphicsMagick++.pc GraphicsMagick version: 1.3.27 running install running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/pgmagick copying pgmagick/init.py -> build/lib.linux-x86_64-2.7/pgmagick copying pgmagick/_version.py -> build/lib.linux-x86_64-2.7/pgmagick copying pgmagick/api.py -> build/lib.linux-x86_64-2.7/pgmagick running build_ext building 'pgmagick._pgmagick' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/src gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home2/s167891/.conda/envs/catmaid/include/python2.7 -I/home2/s167891/installs/GraphicsMagick/include/GraphicsMagick -I/home2/s167891/.conda/envs/catmaid/include/python2.7 -c ./src/_DecorationType.cpp -o build/temp.linux-x86_64-2.7/./src/_DecorationType.o -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_26 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_24 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_22 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_20 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6 -DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x -D_LIBRARY_VERSION="1.3.27" cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ ./src/_DecorationType.cpp:1:28: fatal error: boost/python.hpp: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1
Command "/home2/s167891/.conda/envs/catmaid/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-Qb9ny7/pgmagick/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-Wp2z41-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Qb9ny7/pgmagick/
But my boost/python.hpp file is there in my $BOOST_INC directory.
I also tried to manually make from source.
I changed the Makefile with INCS = -I$(PYTHONPATH)/../include/python2.7 -I$(MAGICK_HOME)/include/GraphicsMagick -I$(BOOST_INC) The BOOST_INC is honored, all other objects seem to compile except the _Image.cpp, I have the following no matching function error with it. ` g++ -Wall -I/cm/shared/apps/python/2.7.x-anaconda/lib/../include/python2.7 -I/home2/s167891/installs/GraphicsMagick/include/GraphicsMagick -I/cm/shared/apps/boost/gcc/1.61.0/include -o _Image.o -c _Image.cpp In file included from /cm/shared/apps/boost/gcc/1.61.0/include/boost/python/handle.hpp:10:0, from /cm/shared/apps/boost/gcc/1.61.0/include/boost/python/args_fwd.hpp:10, from /cm/shared/apps/boost/gcc/1.61.0/include/boost/python/args.hpp:10, from /cm/shared/apps/boost/gcc/1.61.0/include/boost/python.hpp:11, from _Image.cpp:1: /cm/shared/apps/boost/gcc/1.61.0/include/boost/python/cast.hpp: In function ‘void boost::python::detail::assert_castable(boost::type*)’:
/cm/shared/apps/boost/gcc/1.61.0/include/boost/python/cast.hpp:73:20: warning: typedef ‘must_be_a_complete_type’ locally defined but not used [-Wunused-local-typedefs]
typedef char must_be_a_complete_type[sizeof(T)];
^
In file included from /cm/shared/apps/boost/gcc/1.61.0/include/boost/python/data_members.hpp:15:0,
from /cm/shared/apps/boost/gcc/1.61.0/include/boost/python/class.hpp:17,
from /cm/shared/apps/boost/gcc/1.61.0/include/boost/python.hpp:18,
from _Image.cpp:1:
/cm/shared/apps/boost/gcc/1.61.0/include/boost/python/make_function.hpp: In function ‘boost::python::api::object boost::python::detail::make_function_aux(F, const CallPolicies&, const Sig&, const keyword_range&, NumKeywords)’:
/cm/shared/apps/boost/gcc/1.61.0/include/boost/python/make_function.hpp:58:32: warning: typedef ‘assertion’ locally defined but not used [-Wunused-local-typedefs]
` Other *cpp files are compiled except the _Image.cpp.
I tried gcc 5.4.0 /4.8.0, boost 1.54/1.61, no luck. It seems that it was reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835722 but no obvious resolution is provided. Please help. Thanks