LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-03-2015, 06:10 AM   #1
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Rep: Reputation: 25
libPNG version conflicts, how to solve?


My Slackware64 14.1 box came with libpng version 1.4 and I have just DL'd the latest version, 1.6 (which has installed under /usr/local, whereas the others, 1.4, 1.2, 3.0, are under /usr). I am trying to compile one of the contrib/example files as such:

gcc pngpixel.c -o pngpixel -I/usr/local/include -L/usr/local/lib -lpng16 -lm
which seems to work until I try to run the program, which gives me this error message:
pngpixel: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory
The library in question, libpng16.so.16 is definitely in /usr/local/lib.
Can someone please tell me what I am doing wrong? Thanks.

Last edited by rdx; 12-03-2015 at 06:15 AM.
 
Old 12-03-2015, 07:40 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
you may need to set LD_LIBRARY_PATH to /usr/local/lib
the problem is that your app cannot find that lib.
 
1 members found this post helpful.
Old 12-03-2015, 02:04 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Don't forget to run ldconfig (as root) after installing something. You can even see what does it do:

Code:
ldconfig -v | less
 
1 members found this post helpful.
Old 12-03-2015, 02:23 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
And make sure that /usr/local/lib is in the /etc/ld.so.conf file
 
1 members found this post helpful.
Old 12-03-2015, 02:29 PM   #5
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Original Poster
Rep: Reputation: 25
Quote:
Originally Posted by pan64 View Post
you may need to set LD_LIBRARY_PATH to /usr/local/lib
the problem is that your app cannot find that lib.
That almost worked! I had to export LD_LIBRARY_PATH too, small detail. Thanks.
 
Old 12-03-2015, 02:37 PM   #6
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Original Poster
Rep: Reputation: 25
Quote:
Originally Posted by NevemTeve View Post
Don't forget to run ldconfig (as root) after installing something. You can even see what does it do:

Code:
ldconfig -v | less
Okay, that didn't work UNTIL I added that path to /etc/ld.so.conf and now it does, Thanks.
 
Old 12-03-2015, 02:37 PM   #7
rdx
Member
 
Registered: Apr 2007
Location: Dallas
Distribution: Slackware64 14.2
Posts: 283

Original Poster
Rep: Reputation: 25
Quote:
Originally Posted by Keith Hedger View Post
And make sure that /usr/local/lib is in the /etc/ld.so.conf file
Excellent, I think that's the answer I was looking for, Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] libpng error: Incompatible libpng version in application and library Stragonian Slackware 10 11-18-2011 11:06 AM
[SOLVED] Build problem hard to solve : zeroradiant and libpng 1.4 (libpng compatibility pb) naaman Linux - Software 1 01-01-2011 04:03 AM
Libpng version mismatch narc Linux - Software 0 08-19-2004 08:48 AM
possible conflicts after instal libpng.so.3! HELP edisson Linux - Software 2 05-02-2002 03:01 PM
How do I solve IRQ-Conflicts? Firew Linux - Software 3 09-15-2001 04:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration