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


  • 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.


  • @BuZz I have just tried it, works like a charm. Thank you! Something else I noticed, every time I'm running retropie-setup I now get a popup window saying "Raspbian/Debian Jessie and Ubuntu versions below 16.04 are no longer supported". Did you just add that? This did not happen before.

  • administrators

    @bernhard263 I mentioned that above.


  • Hi I am having this same error showing on x86 I've run through the tutorial but used mint latest 32bit (using an old thin client) not sure what I can do can't get any emulators installed due to libpng-dev ....
    Thanks

  • administrators

    @bhuthogg start a new topic providing details of your set up. Including OS version. Retropie version etc.


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.