Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Compile/load problem with graphics library



Given your initial description of a small, specific, old C++ program, I
would rewrite it in commandline calls, or PHP (which has a nice
imagemagick wrapper, and from memory worked smoothly, and has lots of
docs, e.g. http://php.net/manual/en/book.imagick.php and
http://phpimagick.com/ )

(Having said that, I'm just skimming the manual, and the comments are
all people struggling to get ImageMagick installed!)

> One big problem is that I simply cannot understand the mass of subtly 
> different library names involved. The configure script generates the 
> following for the libraries to be searched:
> 
> -L/usr/local/lib -lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16

This is the horrible bit about C++ on unix.

For the files you list, each of the *.so ones will link to one of the
others; for the three you need (*) it looks like you have only one
version installed. So that is easy. (And, also, the files you need are
there.) For the others you'd expect the *.so to be linking to the most
recent version, and you obviously have a lot of different versions
installed.

(*): GraphicsMagick is a branch; the branch was quite a while ago, and I
think the projects have diverged a bit.

So the -L tells it where to look at the -lXXX will expand out to libXXX.so.

The last time I had to mess around with this I think I gave up and used
static linking: E.g.
https://www.systutorials.com/5217/how-to-statically-link-c-and-c-programs-on-linux-with-gcc/

But there was also something about LD_LIBRARY_PATH, and then there are
flags you can give to the gcc linker that makes it tell you more
verbosely what it is doing.

Like I said, unless your script is very complex, or is bringing in other
libraries not available in your scripting language of choice, I would
rather rewrite.

In fact I would still rewrite, but in C++11 or later, and starting from
the closest example C++ script that comes with imagemagick, to be sure I
have the installation working.

Darren

> libGraphicsMagick++.a           libGraphicsMagickWand.so.2.7.3
> libGraphicsMagick++.so          libGraphicsMagickWand.so.2.7.4
> libGraphicsMagick++.so.12       libGraphicsMagickWand.so.2.8.0
> libGraphicsMagick++.so.12.1.0   libGraphicsMagickWand.so.2.8.1
> libGraphicsMagick++.so.12.1.1   libGraphicsMagickWand.so.2.8.2
> libGraphicsMagick++.so.12.2.0   libGraphicsMagickWand.so.2.9.0
> libGraphicsMagick++.so.12.3.0   libMagick++-6.Q16.a
> libGraphicsMagick++.so.12.3.1   libMagick++-6.Q16.la
> libGraphicsMagick++.so.12.3.2   libMagick++-6.Q16.so
> libGraphicsMagick.a             libMagick++-6.Q16.so.6
> libGraphicsMagick.so            libMagick++-6.Q16.so.6.0.0
> libGraphicsMagick.so.3          libMagickCore-6.Q16.a
> libGraphicsMagick.so.3.15.0     libMagickCore-6.Q16.la
> libGraphicsMagick.so.3.15.1     libMagickCore-6.Q16.so
> libGraphicsMagick.so.3.16.0     libMagickCore-6.Q16.so.2
> libGraphicsMagick.so.3.17.0     libMagickCore-6.Q16.so.2.0.0
> libGraphicsMagick.so.3.17.2     libMagickWand-6.Q16.a
> libGraphicsMagick.so.3.18.0     libMagickWand-6.Q16.la
> libGraphicsMagickWand.a         libMagickWand-6.Q16.so
> libGraphicsMagickWand.so        libMagickWand-6.Q16.so.2
> libGraphicsMagickWand.so.2      libMagickWand-6.Q16.so.2.0.0
> 
> GraphicsMagick:
> config
> 
> ImageMagick-6.9.1:
> config-Q16
> 
> ImageMagick-6.9.4:
> config-Q16
> ------------------------------------------------------------------
> 
> ---- Latest error: with the library files after the .o files ----
> horigome@kulle% make imagetrim
> g++ imagetrim.o boundingbox.o `Magick++-config --ldflags --libs` -o 
> imagetrim
> imagetrim.o: In function `main':
> imagetrim.cpp:(.text+0x3c1): undefined reference to 
> `Magick::Image::read(std::__cxx11::basic_string<char, 
> std::char_traits<char>, std::allocator<char> > const&)'
> imagetrim.cpp:(.text+0x783): undefined reference to 
> `Magick::Image::write(std::__cxx11::basic_string<char, 
> std::char_traits<char>, std::allocator<char> > const&)'
> imagetrim.cpp:(.text+0xd55): undefined reference to 
> `Magick::Image::write(std::__cxx11::basic_string<char, 
> std::char_traits<char>, std::allocator<char> > const&)'
> collect2: error: ld returned 1 exit status
> *** Error code 1
> 


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links