Solved

ImageMagick and libpng link problem

Posted on 2011-02-21
4
1,875 Views
Last Modified: 2012-05-11
When I compile ImageMagick, ./configure --prefix=/home/mmj works just fine. But when I execute "make", I got the following errors:

magick/.libs/libMagickCore.so: undefined reference to `png_longjmp'
magick/.libs/libMagickCore.so: undefined reference to `png_set_longjmp_fn'

The problem is that, when I compile, it's using the libpng1.5 but when I do make, it's linking to libpng1.4. libpng1.5 is installed locally under /home/mmj/lib and /home/mmj/include.

lib:
 libpng15.a
 libpng15.la
 libpng15.so -> libpng15.so.15.0.0
 libpng15.so.15 -> libpng15.so.15.0.0
 libpng15.so.15.0.0
 libpng.a -> libpng15.a
 libpng.la -> libpng15.la
 libpng.so -> libpng15.so

include:
libpng15/
pngconf.h  png.h  pnglibconf.h

How can I make sure that "make" will use the correct version libpng as well?

Thanks!
0
Comment
Question by:mybluegrass
  • 2
  • 2
4 Comments
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 34949469
when I compile, it's using the libpng1.5 - are you sure? Do the compile lines contain -I/home/mmj/include? You should ensure that they do, if they don't already. However if you were using 1.4 headers, you should have got missing prototype warnings for png_longjmp and png_set_longjmp_fn (always assuming the warning level was set high enough).
You need to ensure the lines that load the shared  objects contain the gcc flag -L/home/mmj/lib. That is back to the configure stage, but first you should get a record of how make works now. make clean; make 2>&1 | tee hee will give you a record of your original make session in the file hee.
Now re-do configure as follows:
LDFLAGS=-L/home/mmj/lib ./configure --prefix=/home/mmj. This will force make to load with -L/home/mmj/lib but possibly not any other loader flags that ./configure used to generate. (I've only used this with CFLAGS, and certainly what I specified then entirely replaced the original flags). So try make again, and if it fails to make the shared objects then refer to hee and see what ld flags you are missing.
BTW you should probably do a make distclean before re-running ./configure (and every time you do)
0
 
LVL 3

Expert Comment

by:eappiah
ID: 34949470
Depening on your disitrubition there can be a "better" way to select this.

check pkg-config and for .pc files
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 500 total points
ID: 34949556
Yes you could try export PKG_CONFIG_PATH=/home/mmj/lib/pkgconfig before running ./configure. That might work well. You are still best to run make distclean first. Check first that you do have the directory /home/mmj/lib/pkgconfig and that it contains libpng.pc (which should be a symbolic link to libpng15.pc)
pkgconfig is independent of distributions BTW - it has nothing to do with distributors' packages
0
 
LVL 3

Expert Comment

by:eappiah
ID: 34949818
@duncan_roe
Sorry I didn't mean to imply that pkg-config was dist specific.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now