Solved

ImageMagick and libpng link problem

Posted on 2011-02-21
4
1,963 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

688 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