Find the answer to your Linux question:
Results 1 to 6 of 6
I've run into this issue several times over the years. The most recent example: My son is fired up to play Cube2 so I fetched the binary and installed it ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630

    My reoccurring libpng nightmare...


    I've run into this issue several times over the years. The most recent example: My son is fired up to play Cube2 so I fetched the binary and installed it without incident. When I attempt to run:
    Code:
    $ libpng warning: Application was compiled with png.h from libpng-1.4.5
    libpng warning: Application  is  running with png.c from libpng-1.2.40
    libpng error: Incompatible libpng version in application and library
    could not load texture packages/textures/notexture.png
    could not find core textures
    I've spent many hours over the years googling and attempting to resolve this with other applications and games with limited success but there never seems to be a fix that consistently works.
    Code:
    $ ls -l /usr/lib/libpng*.so
    lrwxrwxrwx 1 root root 11 Jul 22 01:20 /usr/lib/libpng.so -> libpng14.so
    lrwxrwxrwx 1 root root 18 Oct 14  2010 /usr/lib/libpng12.so -> libpng12.so.0.40.0
    lrwxrwxrwx 1 root root 18 Jul 22 01:20 /usr/lib/libpng14.so -> libpng14.so.14.8.0
    My first thought is to symlink the old libpng to the newest version but that creates other problems as other applications need the older version. So, just for giggles, I tried again...
    Code:
    # mv libpng12.so old_libpng12.so
    # ln -s libpng14.so.14.8.0  libpng12.so
    ...but still get the same error. I've tried uninstalling libpng altogether and re-compiling but this makes no difference either. I don't understand why some Linux apps needing libpng want to use the older libpng version when the newer version is clearly available to it in /usr/lib.

    Any help or suggestions appreciated.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Have you tried putting the older version of libpng in /usr/local/lib, then when you run the game, do "export LD_LIBRARY_PATH=/usr/local/lib" first?

  3. #3
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Thanks atreyu. Your response set me on a course that eventually enabled me to find a solution that is satisfactory for my particular situation.

    The problem I kept running into was not being able to find a way for libpng12 and libpng14 to live together harmoniously. Many Linux games, (Cube2, VVVVVV, SuperTux and others) need libpng14 whereas my mainstay apps (Firefox, IceWM and Slim) need libpng12. I tried putting each in various locations... separately in /lib, /usr/lib, /usr/local/lib and every app would always want to find libpng12 first no matter where it was. I eventually put libpng12 in its own directory in /usr/lib and symlinked the existing libpng14.so to libpng12.so.0 in /usr/lib. This made Slim and all the games happy but Firefox and IceWM still complained of needed libpng12. I fixed both by telling them where libpng12 was relocated. For firefox:
    Code:
     LD_PRELOAD=/usr/lib/libpng12/libpng12.so /usr/bin/firefox
    ...and for IceWM:
    Code:
     LD_PRELOAD=/usr/lib/libpng12/libpng12.so /usr/bin/icewm-session
    Now, all apps are happily running with their preferred libpng versions. Perhaps not the most elegant solution but it's working for me. Thanks for your input.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Seems I spoke too soon. The games that need libpng14 have found libpng12 in the special directory I created for it. I guess telling Firefox and IceWM where it is gets configured somewhere so every other app calling on libpng will find it there too. Why can't libpng14 be backward compatible to libpng 12 like other libs are. I shouldn't have to make a choice between Firefox and Cube2.

    My nightmare continues...
    Linux Mint + IceWM Registered: #371367 New Members: click here

  6. #5
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    The only thing I can figure is, somewhere along the way, I misconfigured something and it has been with me ever since. I've noticed Linux Mint doesn't seem to have libpng14, only libpng12! Yes, I did try symlinking libpng14 to libpng12 but that is backwards from how these things appear to work and no, it didn't solve the problem.

    I've beat my head against the wall over this long enough. For the first time in years, I'm going to re-install CRUX due to my inability to troubleshoot an issue.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  7. #6
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Code:
    #!/bin/bash
    
    # This here's a very messy "Rube Goldberg" contraption to satisfy Cube2's need 
    # for libpng14 on a system that has other applications requiring libpng12.
    
    cd /usr/lib &&
    
    mv libpng12* hold &&
    
    ln -s libpng14.so.14.8.0 libpng12.so.0 &&
    
    LD_PRELOAD=/usr/lib/libpng12.so.0
    
    cd /usr/local/games/sauerbraten/
    
    ./sauerbraten_unix &&
    
    rm /usr/lib/libpng12.so.0 &&
    
    cd /usr/lib/hold &&
    
    mv libpng12* ../
    ...and it actually works.
    Linux Mint + IceWM Registered: #371367 New Members: click here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •