Mailing List Archive


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

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



Many thanks for responses.

I may not have mentioned: this program has been compiled several times, and was running for more than 3 years. So it seems unlikely that I made a fundamental mistake. I got the response about object order on the magick forum too; I have tried putting the configure script which generates the library references after the .o files, but it makes no difference.

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

The -L parameter adds /usr/local/lib to the directories to be searched; I do not understand the relation to the three libraries. Should there be files with this name in /usr/local/lib? There are not; the following are the files including "Magic" in their names...

------------------------------------------------------------------
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

Stop.
make: stopped in /usr/home/horigome/c

.... so far no progress. I have to get this sorted out. Where would I find an ld expert (paid or otherwise)? Grateful for any suggestions.

Brian Chandler

On 2018-08-05 09:49, Joe Foran wrote:
Hi Brian,

The linker is giving this error because it cannot find the functions in
question.
The order in which the object files are provided to the linker is very
important.
They should be specified in order of most specific (application object
files)
to most general (library object files).
In the makefile you provide on the forum thread, you have lines like|
$(CC) $(LDFLAGS) test.o cutoutbg.o boundingbox.o -o $@|
||||

|The LDFLAGS variable contains the necessary information about the
ImageMagick library files and should come after the application object
files. i.e. ||$(CC) test.o cutoutbg.o boundingbox.o |||$(LDFLAGS) -o $@||
||

You will need to do this everywhere LDFLAGS is referenced.
Does this help?

Joe


On 2018/08/05 3:55, Brian Chandler wrote:
Hello! I'm looking for help with a software problem. I have a small C++
program to do some basic image manipulation (basic, but very specific),
using the Imagemagick++ library; it ran on my webserver (at pair.com
hosting) for years, but stopped because of an "upgrade". I cannot now
recompile, cannot really understand the problem, and can't seem to get
any help either from pair.com or the Imagemagick forum. Here's my
question in full:

https://www.imagemagick.org/discourse-server/viewtopic.php?f=23&t=34332&sid=364f3a5fa340bcbb3d0057542983ff5f


It looks as though the loader has some problem. Unfortunately the forum
responses I've received don't suggest to me that the helpers know any
more than I do. Obviously the best answer is a change to the makefile,
or similar, that makes the library work again. But failing that, I would
try to install the library in my own server space, giving up on the one
provided by Pair.com. The worst option I suppose is to rewrite the
program to use something else, but I hope it doesn't come to that.

Can anyone suggest where to start? If I need to provide other
information, then sorry, but just say. Thanks!

Brian Chandler








Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links