?
Solved

ImageMagick and libpng link problem

Posted on 2011-02-21
4
Medium Priority
?
1,982 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 35

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 35

Accepted Solution

by:
Duncan Roe earned 2000 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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

764 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