News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Makeobj-extended and libpng

Started by Matthew, November 05, 2020, 08:23:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Matthew

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.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Roboron

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 :-)

jonbridg

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.

Quote from: Roboron on November 05, 2020, 09:57:13 PMIf 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!

Matthew

Quote from: Roboron 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 :-)

Thank you for this suggestion. I tried it and unfortunately got the error message
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.

Quote from: jonbridg 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.

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.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Roboron

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 :-/

Matthew

#5
I have returned to trying to get makeobj-extended working again.

I noticed this week that Bridgewater-Brunel is again building a Nightly version of makeobj-extended for the first time since 2020. Unfortunately, I still get the same libpng15.so.15 error reported in OP and symlinking still doesn't work.

James, you were kindly able to fix this error in the game executable by changing the build process. If you were able to do the same for makeobj-extended, that would be helpful.

Quote from: Roboron on November 06, 2020, 04:51:17 PMCompiling makeobj is nothing difficult, specially if you are familiar with Simutrans build process.

Looking at the makefile it seems that I run make makeobj?

I can't compile anything at the moment but I will give it a try as soon as I can.

EDIT: Yes, that worked! Thank you.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。