Solved

ImageMagick and libpng link problem

Posted on 2011-02-21
4
1,944 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Desktop suggestion for Dell Inspiron 3043 13 67
Can't connect to FTP 18 111
Redhat upgrade 1 49
Edit smb.conf-file in Samba om a ReadyNAS 3 20
rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
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…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

730 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