The International Simutrans Forum

 

Author Topic: Makeobj-extended and libpng  (Read 256 times)

0 Members and 1 Guest are viewing this topic.

Offline Matthew

  • *
  • Posts: 439
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Makeobj-extended and libpng
« on: November 05, 2020, 08:23:43 PM »
In the course of studying the bulk goods bug, I had to use makeobj-extended. Neither of the versions provided by Bridgewater-Brunel worked.

The Linux executable said that it needed libpng15.so.15.
The Windows executable failed silently when run in PowerShell. When run in Cmd.exe, the system reported that it needed libpng16.dll to be installed.

According to the libpng website, the "15" and "16" mean libpng versions 1.5 and 1.6 respectively. Both are still supported. Versions 1.4 and earlier should not be used, though they receive some security fixes.

Neither file is easily available. For Linux, the libpng team directed me to Debian, but it only provides packages for libpng 1.2 and 1.6. I was able to find RPMs for 1.5 from a random website, but they are not useful for me as an Ubuntu (.deb) user. For Windows, the official libpng website has no suggestions and the "libpng for Windows" repository suggested by Google is still on 1.2.

So it looked as though I was going to have to build libpng from source in order to use makeobj-extended. I was able to work around this because I found an old (23 May 2019) version of makeobj-extended and used that instead. (This older version does not support the mixed-load-prohibition feature, but luckily that was the feature I wanted to remove, so this was temporarily acceptable.)

In the long-run, I could surely learn to compile libpng. But this incident has raised several questions in my mind.

Firstly, basic sanity checks. Can anyone point out to me where I have gone wrong, please? Do I just need to add an existing libpng to my PATH in Windows or the Linux equivalent? Or alternatively, can anyone reproduce the problem?

Secondly, why was makeobj-extended was asking for these versions? The version of libpng distributed with Extended source code is 1.2.52 from 2014. I could not find a reference to libpng15 or libpng16 in the Extended source repository. So why did it specifically ask for these versions?

Thirdly, if I haven't made a daft mistake, what can be done to prevent others having the same issue? Because a search through the forum suggests that libpng versioning problems have occurred before. In my opinion, makeobj-extended users should not be expected to know how to compile other software from source. We want to make life as easy as possible for artists, who are scarcer than coders. I have some ideas for possible solutions but I guess I should find answers to the questions above first.

Offline Roboron

  • Devotee
  • *
  • Posts: 176
    • Las Galácticas Aventuras de Komoyo Diga
  • Languages: ES, EN
Re: Makeobj-extended and libpng
« Reply #1 on: November 05, 2020, 09:57:13 PM »
If you have libpng16, you cand do a symbolic link to it and call it libpng15. It's a hacky solution but it works most of the time :-)

Offline jonbridg

  • *
  • Posts: 75
  • Languages: EN
Re: Makeobj-extended and libpng
« Reply #2 on: November 05, 2020, 11:31:39 PM »
Hi, I also use Ubuntu and had this issue. My solution was to download libpng15 (1.5.30) from sourceforge and install it at usr/local/libpng/lib using make. There are 'simple' instructions included, but if memory serves it needed some attention to make it work.

If you have libpng16, you cand do a symbolic link to it and call it libpng15. It's a hacky solution but it works most of the time :-)
That sounds a lot easier!

Offline Matthew

  • *
  • Posts: 439
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Re: Makeobj-extended and libpng
« Reply #3 on: November 06, 2020, 02:58:19 PM »
If you have libpng16, you cand do a symbolic link to it and call it libpng15. It's a hacky solution but it works most of the time :-)

Thank you for this suggestion. I tried it and unfortunately got the error message
Code: [Select]
version `PNG15_0' not found
Others have had the same experience, so it seems that something (libpng? makeobj?) is checking for the 'correct' version of libpng.

Hi, I also use Ubuntu and had this issue. My solution was to download libpng15 (1.5.30) from sourceforge and install it at usr/local/libpng/lib using make. There are 'simple' instructions included, but if memory serves it needed some attention to make it work.

Yes, I am sure that it would be possible for me to build libpng 1.5 myself. But I still think that this is an unreasonable demand for Simutrans-Extended artists, who already have to understand Git, either Blender 3.79 (with its utterly abysmal UI) or making 3D images in a pixel editor, .dat files, makeobj, perhaps TileCutter, and probably other things I've forgotten.....

However, the fact that you had the same problem is actually encouraging, since this suggests I have not made an elementary mistake, so thank you for this information.

Although I am no coder, I speculate that makeobj-extended is demanding specific versions of libpng because they were the versions that were installed on the systems where it (makeobj) was built. So even though the Sim-Ex source code includes libpng 1.2, what matters is the version present in Bridgewater-Brunel's library directory (on Ubuntu, this would be in /usr/lib/x86_64-linux-gnu/). For Windows, it will be the version of libpng that is present in Bridgewater-Brunel's cross-compilation library directory. If so, this means that Simutrans-Extended has a dependency that varies depending on which OS, and which version of that OS, James has installed and updated on Bridgewater-Brunel.  :-[

I know that there's a good reason behind pretty much quirk in Simutrans. Most often, the good reason is just "nobody has volunteered to tackle this problem"!  :D

But unless there is another good reason, it seems to me that it might be more sensible to distribute a recent and supported version of libpng with Extended, both in source code and in the packages. This is permitted under both the Artistic Licence 1.0 (for Simutrans-Extended) and the ZLib licence (for libpng). This is the 'Windows way'. I know it is not traditionally the 'Linux way'. But it is libpng, not Simutrans, that is incompatible with more recent versions of itself and therefore violates the assumptions of the Linux way. It is unfair to make artists pay the price of this.

It seems to me that this would be best implemented as part of the CMake build process project, once that project has reached its initial goal of being able to compile Simutrans itself on multiple platforms.

Offline Roboron

  • Devotee
  • *
  • Posts: 176
    • Las Galácticas Aventuras de Komoyo Diga
  • Languages: ES, EN
Re: Makeobj-extended and libpng
« Reply #4 on: November 06, 2020, 04:51:17 PM »
Then the next "easy" solution is to compile makeobj against your libpng system version. Compiling makeobj is nothing difficult, specially if you are familiar with Simutrans build process. I think that's better than compiling a specific version of libpng, that idea would only be good if we couldn't access makeobj's source code :-/