Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Error when updating: Could not install package(s): libpng-dev



  • Hello gentlemen!

    I hope you are all still well! After quite a while I updated my Retropie. I am on Ubuntu 16.0.4 on an Intel NUC and on lots of packages I get this error when trying to compile:

    Installing dependencies for 'lr-pcsx-rearmed' : Playstation emulator - PCSX (arm optimised) port for libretro
    = = = = = = = = = = = = = = = = = = = = =
    
    Did not find needed package(s): libpng-dev. I am trying to install them now.
    Paketlisten werden gelesen...
    Abhängigkeitsbaum wird aufgebaut....
    Statusinformationen werden eingelesen....
    libpng12-dev ist schon die neueste Version (1.2.54-1ubuntu1.1).
    0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
    Could not install package(s): libpng-dev.
    
    

    So it basically tries to install the Ubuntu package libpng-dev which is installed already but it still yields this error?

    This libpng12-dev ist schon die neueste Version (1.2.54-1ubuntu1.1) means "It is the newest version already".


  • Global Moderator

    What's your RetroPie version ? Did you update the script before running the packages update ?



  • Yes, Ubuntu and Retropie-Setup both on the latest version.


  • Global Moderator

    It might be a wrong mapping in the installer - for distros older than Debian Stretch it maps libpng-dev to the corresponding distro package (libpng12-dev), but it looks like Ubuntu 16.04.x, although it claims is based on Debian Stretch (rel. 9), it doesn't have libpng-dev (?) as an actual package.



  • I think you are right. I get this:

    vbs@wz-retro:~$ sudo apt install libpng-dev
    Paketlisten werden gelesen... Fertig
    Abhängigkeitsbaum wird aufgebaut.
    Statusinformationen werden eingelesen.... Fertig
    Hinweis: »libpng12-dev« wird an Stelle von »libpng-dev« gewählt.
    libpng12-dev ist schon die neueste Version (1.2.54-1ubuntu1.1).
    0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
    

    This
    Hinweis: »libpng12-dev« wird an Stelle von »libpng-dev« gewählt.

    means "libpng12-dev will be chosen instead of libpng-dev".

    So I guess the check in Retropie aims at libpng-dev while Ubuntu manages to map automatically to libpng12-dev. So the package is installed but Retropie claims it is not.


  • Global Moderator

    What does cat /etc/debian_version say ?



  • vbs@wz-retro:~$ cat /etc/debian_version
    stretch/sid
    

  • Global Moderator

    @vbs Ubuntu is lying, Debian Stretch contains libpng-dev. Of course, at the time 16.04 was cut, the stretch moniker was just in testing phase and a lot changed until the official Debian Stretch release was etched (June 2017).
    Either way, we'll see how we can handle that.


  • administrators

    @mitu this broke with recent version changes I merged. I remember now I mapped 16.04 to Jessie due to this but someone's correction switched it.

    Tbh though 16.04 is too old for us to support. Best to upgrade to last LTS.



  • Oh well, ok thanks. I will consider upgrading the machine at some point. Am I right that I can ignore the error for now since it is a false error anyway?


  • administrators

    @vbs Update - I have changed the logic which should help, but you definitely should update as I cannot guarantee everything in RetroPie will work correctly (and you won't get the latest ES etc)



  • @BuZz
    Great, thanks! Didn't know I was stuck on that ES version due to Ubuntu 16. I will definetly upgrade soon! :)



  • Here's what's happening:
    Older Ubuntu and Debian versions only had libpng-dev as a virtual package that was physically provided by libpng12-dev. Newer Ubuntu and Debian versions have an actual package libpng-dev.
    The problem is that the Retropie script doesn't just check for the presence of a (virtual) package, which would work fine in this case. Instead, it explicitly checks for a package status of "installed". However, virtual packages cannot be installed and thus never return the "installed" status. It's definitely possible to solve this by re-writing the function that checks for installed packages. I will post again when I found a solution.

    Until then, here's a workaround:
    Open RetroPie-Setup/scriptmodules/helpers.sh in a text editor, find the function hasPackage(), and add the following lines in it at the top:

    	if [[ "$1" == "libpng-dev" ]]; then
    		local out=$(dpkg-query -l $1 2>/dev/null)
    		if [[ "$?" -eq 0 ]]; then
    			return 0
    		fi
    	fi
    

    This will make it check if a package "libpng-dev" exists, physical or virtual, and if yes, consider it to be installed and exit the function.


  • administrators

    @bernhard263 what are you trying to fix this on? Ubuntu 16.04?. Retropie already maps the PNG package to different packages based on distro version.

    I don't recommend anyone uses the above changes really, and I am not aware of any issue currently.



  • @BuZz I'm running the Armbian distribution on a Banana Pi board, which is built on top of Ubuntu 16.04. Why do you not recommend this workaround? It solves the problem of not being able to install the emulator cores. I never said it's pretty, but it gets the job done.


  • administrators

    @bernhard263 because you're specifying a "fix" for an unsupported board / os combo that requires editing of core files without even clarifying why it's needed to an 11 month old thread.

    It's also not the best way to accomplish it.


  • administrators

    BTW I wasn't aware there was still a mapping issue with libpng as I thought I had sorted it, but actually there's a small bug still in the rework - it maps correctly for Ubuntu 16.10 but not 16.04. I will correct the issue, but note this is an old version of Ubuntu and things are likely to break.

    Also we don't support the Banana Pi board, so I assume you're running some fork ?



  • BuZz I'm sure that you as a developer know a better way to fix this. I am not an expert by any means. But you said Ubuntu 16.04 is not supported anymore, so there will be no official fix, I had to edit the script myself and that's what I came up with. I didn't call it a "fix", I know it's a hack. It's just a temporary workaround that allows the cores to be built. Until there is a better solution, it gets the job done, that is all. Maybe it helps someone who has the same problem.


  • administrators

    @bernhard263 There is an official fix - as it was a bug from before when I fixed this for 16.10 - I just resolved it. You will get a warning popup saying it's unsupported which needs updating also actually (just the wording probably).

    https://github.com/RetroPie/RetroPie-Setup/commit/2d7297d2d20f6acaff0d0e63eaceff0e65b526b4



  • @BuZz said in Error when updating: Could not install package(s): libpng-dev:

    BTW I wasn't aware there was still a mapping issue with libpng as I thought I had sorted it, but actually there's a small bug still in the rework - it maps correctly for Ubuntu 16.10 but not 16.04. I will correct the issue, but note this is an old version of Ubuntu and things are likely to break.

    Also we don't support the Banana Pi board, so I assume you're running some fork ?

    No, I'm running the normal RetroPie and RetroPie-Setup from the official git repository. I know the Banana Pi is not supported, but I believe this has nothing to do with it, it's just a general issue with Ubuntu 16.04, as the creator of this thread had a regular Intel PC and he was running into the same problem. Anyway, that's great that you will try to fix it, thank you. A permanent solution would be much better than a a hack.


  • administrators

    @bernhard263 It should already be fixed. See above link.


Log in to reply
 

Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.