cannot find -lMagick++-6.Q16 - c++

I try to install magick R package but I get error:
g++ -std=gnu++11 -shared -L/path/apps/R/3.5.1-20180807-test/x86_64-linux-2.6-rhel6/lib64/R/lib -L/path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/lib -Wl,--exclude-libs,libz.a -Wl,--exclude-libs,libbz2.a -Wl,--exclude-libs,libcurl.a -Wl,--exclude-libs,libpcre.a -Wl,--as-needed -o magick.so RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edit.o fonts.o options.o properties.o resize.o transformations.o -L/path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/lib/ /path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/lib/libcurl.a /path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/lib/libz.a -Wl,--exclude-libs,libz.a -Wl,--exclude-libs,libcurl.a -lidn -lssl -lcrypto -lldap -lrt -lcairo -L/path/apps/mysql/5.7.11/x86_64-linux-2.6-rhel6/lib -lmysqlclient -lpthread -lm -lrt -ldl -L/path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/lib -lxml2 -lz -lm -ldl -L/path/apps/V8/3.14/x86_64-linux-2.6-rhel6/lib64 -L/path/apps/openmpi/1.8.1/x86_64-linux-2.6-rhel6/gnu/lsf/lib -L/path/apps/imagemagick/7.0.7-8/x86_64-linux-2.6-rhel6/lib/pkgconfig -lMagick++-6.Q16 -L/path/apps/R/3.5.1-20180807-test/x86_64-linux-2.6-rhel6/lib64/R/lib -lR
/usr/bin/ld: cannot find -lMagick++-6.Q16
collect2: error: ld returned 1 exit status
make: *** [magick.so] Error 1
ERROR: compilation failed for package ‘magick’
My LIB_DIR and INCLUDE_DIR looks like that:
export LIB_DIR="$STATIC_LIB/lib/ $STATIC_LIB/lib/libcurl.a \
$STATIC_LIB/lib/libz.a -Wl,--exclude-libs,libz.a \
-Wl,--exclude-libs,libcurl.a -lidn -lssl -lcrypto -lldap -lrt \
-lcairo $MYSQL_LIBS $XML2_LIBS -L$V8_LIBS \
-L$MPI_HOME/lib \
-L/path/apps/imagemagick/7.0.7-8/x86_64-linux-2.6-rhel6/lib/pkgconfig"
export INCLUDE_DIR="$STATIC_LIB/include -I/usr/include/cairo \
-I/usr/include/pixman-1 -I/usr/include/freetype2 \
-I/usr/include/libpng12 \
-I$MPI_HOME/include \
-I/path/apps/imagemagick/7.0.7-8/x86_64-linux-2.6-rhel6/include/ImageMagick-7"
include contains:
ls /path/apps/imagemagick/7.0.7-8/x86_64-linux-2.6-rhel6/include/ImageMagick-7
Magick++ MagickCore Magick++.h MagickWand
I found this question but my lib directory contains similar set of files:
ls /path/apps/imagemagick/7.0.7-8/x86_64-linux-2.6-rhel6/lib/
ImageMagick-7.0.7 libMagickCore-7.Q16HDRI.so.4
libMagick++-7.Q16HDRI.a libMagickCore-7.Q16HDRI.so.4.0.0
libMagick++-7.Q16HDRI.la libMagickWand-7.Q16HDRI.a
libMagick++-7.Q16HDRI.so libMagickWand-7.Q16HDRI.la
libMagick++-7.Q16HDRI.so.3 libMagickWand-7.Q16HDRI.so
libMagick++-7.Q16HDRI.so.3.0.0 libMagickWand-7.Q16HDRI.so.4
libMagickCore-7.Q16HDRI.a libMagickWand-7.Q16HDRI.so.4.0.0
libMagickCore-7.Q16HDRI.la pkgconfig
libMagickCore-7.Q16HDRI.so
I'm using imagemagick 7 so why it still requires some flag/arg -lMagick++-6.Q16 from version 6?

If pkg-config and Magick++-config are not available, the magick package defaults to ImageMagick v6:
PKG_LIBS="-lMagick++-6.Q16"
So you will have to install version 6. In addition you might also report an issue asking to support version 7 in the case of a installation without pkg-config/Magick++-config.
Alternatively you can try to get pkg-config/Magick++-config working on your machine. If pkg-config/Magick++-config can be used, the flags provided from there are used directly.

I've finally managed to install magick. I compiled ImageMagick v6 from source and installed R package with following set of env variables:
STATIC_LIB="/path/static-zlib-gcc6.3"
IMAGEMAGICK_V6_HOME="/path/ImageMagick-6.9.10-10"
export LIB_DIR="$STATIC_LIB/lib/ \
-L$IMAGEMAGICK_V6_HOME/lib"
export INCLUDE_DIR="$STATIC_LIB/include \
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 \
-I$IMAGEMAGICK_V6_HOME/include/ImageMagick-6"
export PKG_CONFIG_PATH="$IMAGEMAGICK_V6_HOME/lib/pkgconfig/:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$IMAGEMAGICK_V6_HOME/lib:$LD_LIBRARY_PATH"

Related

Makefile for c++ program cannot be compiled properly

I am quite new to c++ Makefile. Recently, I am trying to re-implement the dense trajectory algorithm introduced by this paper: https://lear.inrialpes.fr/people/wang/dense_trajectories
However, I was struggling with Makefile that they provided for quite a while. The Makefile is as follows:
# set the binaries that have to be built
TARGETS := DenseTrack Video
# set the build configuration set
BUILD := release
#BUILD := debug
# set bin and build dirs
BUILDDIR := .build_$(BUILD)
BINDIR := $(BUILD)
# libraries
LDLIBS = $(addprefix -l, $(LIBS) $(LIBS_$(notdir $*)))
LIBS := \
opencv_core opencv_highgui opencv_video opencv_imgproc \
avformat avdevice avutil avcodec swscale
# set some flags and compiler/linker specific commands
CXXFLAGS = -pipe -D __STDC_CONSTANT_MACROS -D STD=std -Wall $(CXXFLAGS_$(BUILD)) -I. -I/usr/local/include -I/home/wei/ffmpeg_build/include
CXXFLAGS_debug := -ggdb
CXXFLAGS_release := -O3 -DNDEBUG -ggdb
LDFLAGS = -L/usr/local/lib -L/home/wei/ffmpeg_build/lib -pipe -Wall $(LDFLAGS_$(BUILD))
LDFLAGS_debug := -ggdb
LDFLAGS_release := -O3 -ggdb
include make/generic.mk
I can verify that my opencv2.4.2 and ffmpeg5.4.0 are successfully installed in Ubuntu 16.04, by running an example using those two libraries.
For opencv:
The lib path is: /usr/local/lib
libavcodec.a libopencv_gpu.so.2.4
libopencv_photo.so.2.4
libavdevice.a libopencv_gpu.so.2.4.2 libopencv_photo.so.2.4.2
libavfilter.a libopencv_highgui.so libopencv_stitching.so
libavformat.a libopencv_highgui.so.2.4 libopencv_stitching.so.2.4
libavutil.a libopencv_highgui.so.2.4.2 libopencv_stitching.so.2.4.2
libopencv_calib3d.so libopencv_imgproc.so libopencv_ts.so
libopencv_calib3d.so.2.4 libopencv_imgproc.so.2.4 libopencv_ts.so.2.4
libopencv_calib3d.so.2.4.2 libopencv_imgproc.so.2.4.2 libopencv_ts.so.2.4.2
libopencv_contrib.so libopencv_legacy.so libopencv_video.so
libopencv_contrib.so.2.4 libopencv_legacy.so.2.4 libopencv_video.so.2.4
libopencv_contrib.so.2.4.2 libopencv_legacy.so.2.4.2 libopencv_video.so.2.4.2
libopencv_core.so libopencv_ml.so libopencv_videostab.so
libopencv_core.so.2.4 libopencv_ml.so.2.4 libopencv_videostab.so.2.4
libopencv_core.so.2.4.2 libopencv_ml.so.2.4.2 libopencv_videostab.so.2.4.2
libopencv_features2d.so libopencv_nonfree.so libpostproc.a
libopencv_features2d.so.2.4 libopencv_nonfree.so.2.4 libswresample.a
libopencv_features2d.so.2.4.2 libopencv_nonfree.so.2.4.2 libswscale.a
libopencv_flann.so libopencv_objdetect.so pkgconfig
libopencv_flann.so.2.4 libopencv_objdetect.so.2.4 python2.7
libopencv_flann.so.2.4.2 libopencv_objdetect.so.2.4.2 python3.5
libopencv_gpu.so libopencv_photo.so
The include path is: usr/local/include:
libavcodec libavfilter libavutil libswresample opencv
libavdevice libavformat libpostproc libswscale opencv2
For ffmpeg:
The lib path is: /home/user/ffmpeg_build/lib
libavcodec.a libavfilter.a libavutil.a libfdk-aac.la libswresample.a libx265.a
libavdevice.a libavformat.a libfdk-aac.a libpostproc.a libswscale.a pkgconfig
The include path is: /home/user/ffmpeg/include
fdk-aac libavdevice libavformat libpostproc libswscale x265.h
libavcodec libavfilter libavutil libswresample x265_config.h
So when I make it with Makefile, I did not get error but it seems linking is working properly, nor is the compiled output.
I tried to directly compile with g++ command.
sudo g++ -o Video -pipe -D __STDC_CONSTANT_MACROS -D STD=std -Wall -I. -I/usr/local/include -O3 -DNDEBUG -ggdb -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_video -lopencv_imgproc -lavformat -lavdevice -lavutil -lavcodec -lswscale *.h Video.cpp
However,it returns errors as:
/tmp/ccjYmwI4.o: In function `main':
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:33: undefined reference to `cvCreateFileCapture'
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:48: undefined reference to `cvQueryFrame'
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:57: undefined reference to `cvCopy'
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:60: undefined reference to `cvShowImage'
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:61: undefined reference to `cvWaitKey'
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:53: undefined reference to `cvCreateImage'
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:70: undefined reference to `cvDestroyWindow'
/home/wei/Documents/dt/dense_trajectory_release_v1.2/Video.cpp:41: undefined reference to `cvNamedWindow'
collect2: error: ld returned 1 exit status
I have been working on this issue for several days. Any help or suggestions would be really appreciated.
Thanks
The problem comes from your linker call:
The library options (-l) must come after the code to compile or to link:
Correct:
# code in foo.cpp need function in libmylib.so
g++ foo.cpp -lmylib
# code in foo.o need function in libmylib.so
g++ foo.o -lmylib
Incorrect:
# code in foo.cpp need function in libmylib.so
g++ -lmylib foo.cpp
# code in foo.o need function in libmylib.so
g++ -lmylib foo.o

RInside and Qt examples compilation error

I'm new about RInside and I want to run the examples about QT
I get this error all the time I use "qmake" and "make" as say the README, and I really want to know what can I do about it.
$ g++ -Wl,-O1 -o qtdensity qtdensity.o main.o moc_qtdensity.o -L/usr/lib/i386-linux-gnu -Wl,--export-dynamic -fopenmp -L/usr/lib/R/lib -lR -lpcre -llzma -lbz2 -lrt -ldl -lm -lblas -llapack -L/home/user/R/i686-pc-linux-gnu-library/3.1/RInside/lib -lRInside -Wl,-rpath,/home/user/R/i686-pc-linux-gnu-library/3.1/RInside/lib -lQtSvg -lQtGui -lQtCore -lpthread
/usr/bin/ld: cannot find -llzma
collect2: ld devolvió el estado de salida 1
make: *** [qtdensity] Error 1
I thought it was because I had not the library lzma, but I intalled it and I still get the same error.
What can I do? Can you help me please?

linking clang lib allways undefined symbol

I have created an some classes I want to use with swig in order to generate ruby binding.
Everything is ok when I generate the code or compile the ruby module. But when a script load this module, there is an error:
undefined symbol: _ZTVN5clang5LexerE
I understand that this means that the problem is for the clang::Lexer. But I know I have
set the lclangLex lib for this.
here is the command I use in order to link the objects files:
clang++ -shared -o parser.so parser.o Declarations.o -L. -L/usr/lib -L. -Wl,-O1,\
--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic \
-L/usr/lib -lz -lpthread -lffi -lcurses -ldl -lm -lruby -lclangLex -lclangAST \
-lpthread -lgmp -ldl -lcrypt -lm -lc -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo \
-lLLVMTarget -lLLVMCore -lLLVMMC -lLLVMObject -lLLVMSupport
any idea ?
The problem was the order of the libs given to the linker:
-lclangAST -lclangLex -lclangBasic
lclangAST must be given before lclangLex then I just had to add lclangBasic and everything works.

Ld wrong symbol

I'm buildnig application with boost.python library. I want to link it. Here is the code:
#include <boost/python.hpp>
using namespace boost::python;
// Boost.python definitions to expose classes to Python
BOOST_PYTHON_MODULE(arrayClasses) {
}
And makefile for it:
PYTHON = /usr/include/python2.7
BOOST_INC = /usr/include
BOOST_LIB = /usr/lib
TARGET = arrayClasses
$(TARGET).so: $(TARGET).o
g++ -shared -Wl,--export-dynamic \
$(TARGET).o -L$(BOOST_LIB) -lboost_python \
-L/usr/lib/python2.7/config -lpython2.7 \
-o $(TARGET).so
$(TARGET).o: $(TARGET).cpp
g++ -I$(PYTHON) -I$(BOOST_INC) -c -fPIC $(TARGET).cpp
When I compile it I get:
g++ -shared -Wl,--export-dynamic \
arrayClasses.o -L/usr/lib -lboost_python \
-L/usr/lib/python2.7/config -lpython2.7 \
-o arrayClasses.so
/usr/bin/ld: arrayClasses.o: relocation R_X86_64_32 against `init_module_arrayClasses()' can not be used when making a shared object; recompile with -fPIC
arrayClasses.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
What's wrong is there?
You have -fPIC for your .o target, but not
for the .so target. See if adding it helps.
Edit: Ignore that. This compiles for me on a 32-bit Ubuntu system using Python 2.6 and Boost 1.44. As Ignacio Vazquez-Abrams pointed out, you should probably check if your Python and Boost libraries were compiled for the same architecture.

Cant make mod_wsgi-3.3 in trying to use it with xampp and django

raz#T43:~/Downloads/mod_wsgi-3.3$ sudo ./configure --with-apxs=/opt/lampp/bin/apxs --with-python=/usr/bin/python2.6
checking Apache version... 2.2.14
configure: creating ./config.status
config.status: creating Makefile
raz#T43:~/Downloads/mod_wsgi-3.3$ sudo make
/opt/lampp/bin/apxs -c -I/usr/include/python2.6 -DNDEBUG mod_wsgi.c -L/usr/lib -L/usr/lib/python2.6/config -lpython2.6 -lpthread -ldl -lutil -lm
/opt/lampp/build/libtool --silent --mode=compile gcc -prefer-pic -O3 -Wl,--rpath -Wl,/opt/lampp/lib -Wl,--rpath -Wl,/opt/lampp/lib/mysql -I/opt/lampp/include -L/opt/lampp/lib -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include -I/opt/lampp/include -I/opt/lampp/include -I/usr/include/python2.6 -DNDEBUG -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
mod_wsgi.c:135: fatal error: Python.h: No such file or directory
compilation terminated.
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
I cant find what's wrong. Any one have an idea? Python seams to work in all other regards
You need to install the 'dev' package for Python installation you are using.
Error message is described in:
http://code.google.com/p/modwsgi/wiki/InstallationIssues#Missing_Python_Header_Files