4.2.0.0 Error on startup

Found a bug in R'n'D? Report it here!

Moderators: Flumminator, Zomis

Post Reply
User avatar
jm00092
Posts: 5
Joined: Mon Sep 04, 2017 9:21 am
Location: Spain
Contact:

4.2.0.0 Error on startup

Post by jm00092 »

Hi. Just checking new 4.2.0.0 and i get the following error when starting the game. In Ubuntu 18.04

Code: Select all

rocksndiamonds: warning: IMG_Load('RocksIcon32x32.png') failed: Failed loading libpng12.so.0: libpng12.so.0: cannot open shared object file: No such file or directory
rocksndiamonds: fatal error: IMG_Load('RocksFontSmall.png') failed: Failed loading libpng12.so.0: libpng12.so.0: cannot open shared object file: No such file or directory
rocksndiamonds: aborting
The file libpng12.so.0 is available in the /lib subdirectory of R&D


And the SDL packages installed in the system. I never had to change them or install nothing in prevous R&D updates

Code: Select all

ii  libsdl-image1.2:amd64                           1.2.12-8ubuntu0.1                                   amd64        Image loading library for Simple DirectMedia Layer 1.2, libraries
ii  libsdl-net1.2:amd64                             1.2.8-5                                             amd64        Network library for Simple DirectMedia Layer 1.2, libraries
ii  libsdl-sound1.2:amd64                           1.0.3-8                                             amd64        Sound library for Simple DirectMedia Layer 1.2, libraries
ii  libsdl1.2-dev                                   1.2.15+dfsg2-0.1ubuntu0.1                           amd64        Simple DirectMedia Layer development files
ii  libsdl1.2debian:amd64                           1.2.15+dfsg2-0.1ubuntu0.1                           amd64        Simple DirectMedia Layer
ii  libsdl2-2.0-0:amd64                             2.0.8+dfsg1-1ubuntu1.18.04.4                        amd64        Simple DirectMedia Layer
ii  libsdl2-dev:amd64                               2.0.8+dfsg1-1ubuntu1.18.04.4                        amd64        Simple DirectMedia Layer development files
ii  libsdl2-image-2.0-0:amd64                       2.0.3+dfsg1-1                                       amd64        Image loading library for Simple DirectMedia Layer 2, libraries
ii  libsdl2-image-dev:amd64                         2.0.3+dfsg1-1                                       amd64        Image loading library for Simple DirectMedia Layer 2, development files
ii  libsdl2-mixer-2.0-0:amd64                       2.0.2+dfsg1-2                                       amd64        Mixer library for Simple DirectMedia Layer 2, libraries
ii  libsdl2-mixer-dev:amd64                         2.0.2+dfsg1-2                                       amd64        Mixer library for Simple DirectMedia Layer 2, development files
ii  libsdl2-ttf-2.0-0:amd64                         2.0.14+dfsg1-2                                      amd64        TrueType Font library for Simple DirectMedia Layer 2, libraries
ii  libsdl2-ttf-dev:amd64                           2.0.14+dfsg1-2                                      amd64        TrueType Font library for Simple DirectMedia Layer 2, development files
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

Re: 4.2.0.0 Error on startup

Post by filbo »

Run:

$ strace -e file -o rnd.trace rocksndiamonds
$ grep libpng rnd.trace

What do you see? I see:

open("/lib/x86_64-linux-gnu/libpng12.so.0", O_RDONLY|O_CLOEXEC) = 3

-- which is perfectly as expected.

You'll either see one or more 'open ... = -1' with an error (probably ENOENT), or what looks like a successful open, or no matches at all.

If all ENOENT, what are the paths it's trying?

If successful open, run:

$ file -L /lib/x86_64-linux-gnu/libpng12.so.0
$ ldd /lib/x86_64-linux-gnu/libpng12.so.0

(substituting the pathname you saw successsfully opened). Show outputs.

> The file libpng12.so.0 is available in the /lib subdirectory of R&D

Ohhh... I would expect it to be found on your system as a whole. Two paths forward from there. One is to use the libraries shipped in the package:

$ LD_LIBRARY_PATH=/path/to/rocksndiamonds/lib rocksndiamonds

The other (and I think better) is to make sure libpng is installed on your system:

$ sudo apt install libpng12-0

(exact library package name may vary. If you're using `bash` and have completion correctly set up, type `sudo apt install libpng<TAB><TAB>`, and it should list a bunch of choices. You want the one that's all numbers, not '-dev' etc.)
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

Re: 4.2.0.0 Error on startup

Post by filbo »

Holger, are there instructions in the bundle on how to either use the libs in the bundle, or install what's needed from system repos?
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: 4.2.0.0 Error on startup

Post by Holger »

That's a problem I did not expect. Thank you, Jamie jm00092, for reporting it, and thank you, filbo, for already analyzing it.

The R'n'D binary for Linux is linked using "-rpath" (see file "src/Makefile") to use the dynamic library files shipped with R'n'D in the "lib" subdirectory (instead of those that might be installed in the system). That works as expected for the SDL libraries and also for the zip library (libz.so).

However, SDL2_image attempts to load "libpng12.so.0" at runtime, which exists on Ubuntu 16.04 (where the R'n'D binary was built), and also on older Ubuntu versions (like 12.04 and 14.04), but not at Ubuntu 18.04 and 20.04, where there is "libpng16.so" (version 1.6 of the PNG library). Therefore, I expected that this dynamic library would also be loaded from R'n'D's "lib" directory, just like SDL2_mixer should load libmodplug.so.1 and libmpg123.so.0 from that same directory.

But as filbo showed, it attempts to load it from the system instead, and fails, if it is not there. :-(

That should not happen. I have to find out how I can force the SDL libraries to dynamically load their dependent libraries also from the R'n'D bundle's "lib" directory. (I could not find anything on this after a quick search, so I have to further investigate this issue, which apparently results in the pre-built binary for Linux being broken on recent Ubuntu systems.)
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: 4.2.0.0 Error on startup

Post by Holger »

It is also strange that this problem apparently does not occur with R'n'D 4.1.4.1 (or does it?), which also should access the PNG library from the "lib" directory. But 4.2.0.0 uses a newer version of SDL_image, which might have changed here. :-/

I also have to do some additional "strace" tests, I think...
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: 4.2.0.0 Error on startup

Post by Holger »

Holger, are there instructions in the bundle on how to either use the libs in the bundle, or install what's needed from system repos?
Oh, and to answer your question, filbo: No, there are no specific instructions for either ways, as it should just work by starting the included binary, which should then use everything from the bundle (except things like libc, libm etc., which should always be there).
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: 4.2.0.0 Error on startup

Post by Holger »

I have the suspicion that dependent libraries dynamically loaded at runtime by the SDL libraries were never loaded from the "lib" directory, but always from the system (and apparently were always there during my tests just by chance).

I will test if setting RPATH/RUNPATH also for the SDL libraries will help here (which is currently at the default value "/usr/local/lib").

Oh well... :cry:
User avatar
jm00092
Posts: 5
Joined: Mon Sep 04, 2017 9:21 am
Location: Spain
Contact:

Re: 4.2.0.0 Error on startup

Post by jm00092 »

filbo wrote: Tue Aug 18, 2020 12:33 am Run:

$ strace -e file -o rnd.trace rocksndiamonds
$ grep libpng rnd.trace

Code: Select all

openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/tls/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/tls/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/tls/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/tls/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/tls/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/tls/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/tls/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/tls/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/tls/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/tls/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/tls/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/tls/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/haswell/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/haswell/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/tls/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libpng12.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

I can confirm that the version 4.1.4.1 program works perfectly here, in another directory

I have tried to add the /lib subdierectory to the $PATH. This is at the end of the string. It does not work. Maybe order matters. I have not tried to change the order so as not to damage something else

Thanks
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: 4.2.0.0 Error on startup

Post by Holger »

I know now why R'n'D 4.2.0.0 refuses to load the PNG library from the "lib" sub-directory (because the SDL libraries in "lib" do not have the library run-path set correctly, which is needed to load further dependent libraries from the correct location), but I have absolutely no idea why this works with 4.1.4.1 (which have the same wrong run-path; these are older SDL library versions built with the old build system, but that *should* not make a difference here).

I have fixed the library path in the SDL libraries for the Linux version of R'n'D now and created a test package.

Jamie jm00092, could you please download it and give it a try? It should work out of the box by starting "./rocksndiamonds" from the extracted package directory (just as 4.1.4.1 does).

Here's the download link for the test package:

https://www.artsoft.org/RELEASES/rocksn ... st1.tar.gz

If it works for you, I will release it as a hotfix release ASAP.
jm28121977
Posts: 84
Joined: Thu Aug 16, 2018 8:04 pm
Location: England

Re: 4.2.0.0 Error on startup

Post by jm28121977 »

Hi Holger

This isn't me. It's some dude from Spain with a username that's jm followed by a load of numbers. He doesn't put kisses at the end of his posts!

Cheers
Jamie x <-- see!
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: 4.2.0.0 Error on startup

Post by Holger »

Oops! Sorry, Jamie and jm00092! :oops:

I really mixed up user account names "jm00092" and "jm28121977"! :o

Will have a closer look at the "Location" field in the future, and try to remember who has a "load of numbers" that can be interpreted as a birthday! :wink:

Sorry again for the confusion!
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

Re: 4.2.0.0 Error on startup

Post by filbo »

> I have tried to add the /lib subdierectory to the $PATH.

$PATH is the path for binaries. $LD_LIBRARY_PATH is what causes the binary to look elsewhere (an additional location) for shared objects. As I wrote:

Code: Select all

$ LD_LIBRARY_PATH=/path/to/rocksndiamonds/lib rocksndiamonds
This worked for me to run the downloaded 4.2.0.0 bundle *with* the bundled libpng12.so.0 (despite my system also having that file elsewhere in its libraries, since I'm running an old OS release). That is, `strace` clearly showed me that R'n'D loaded the one in the unpacked archive directory, not the system one.

So if you have that much curiosity, besides trying Holger's updated 4.2.0.1 bundle, also try 4.2.0.0 with LD_LIBRARY_PATH...

====

In fact, `strace` showed me a bunch of interesting differences. Holger, maybe these will mean something to you? I'm not trying to imply this is a problem, just trying to understand what I see...

Running the downloaded 4.2.0.0 binary (without LD_LIBRARY_PATH), vs. the one I built, first of all it uses libSDL2{,_image,_mixer,_net}-2.0.so.0 from the bundle rather than system versions.

Second, it also uses the provided libz.so.1, which was mildly surprising. I assume all of these are due to RPATH.

Third, when I specifically run with LD_LIBRARY_PATH, it uses additional libraries from the bundle: libpng12.so.0 and libmodplug.so.1 (music files).

Fourth, my build uses a whole bunch of other system libraries. I think this probably represents my (system-provided) SDL2 being built for every possible back-end, while you've built it specifically for X11, pulseaudio, and PNG. These include libraries related to system interfaces: ffi (foreign function interface), glib (gresources), lzma, pcre, readline, tinfo; related to display servers: wayland, xkb; audio: asound, fluidsynth, jack, mad (MPEG audio decoder), vorbis; and 2D graphics formats: jbig, jpeg, tiff, webp.

I notice that the only audio & graphical formats included in the current .zip are .wav and .png. But surely that binary can run levels supplied from other archives, which have all sorts of formats; so probably the provided SDL2 libs know how to dynamically load the needed libraries. I just didn't provoke it to that.
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

Re: 4.2.0.0 Error on startup

Post by filbo »

(BTW Holger did you see PMs I sent?)
User avatar
jm00092
Posts: 5
Joined: Mon Sep 04, 2017 9:21 am
Location: Spain
Contact:

Re: 4.2.0.0 Error on startup

Post by jm00092 »

Holger wrote: Tue Aug 18, 2020 10:25 pm
Jamie jm00092, could you please download it and give it a try? It should work out of the box by starting "./rocksndiamonds" from the extracted package directory (just as 4.1.4.1 does).

Here's the download link for the test package:

https://www.artsoft.org/RELEASES/rocksn ... st1.tar.gz

If it works for you, I will release it as a hotfix release ASAP.
Hi. Thanks for solving it so quickly

I can confirm the test release now works perfectly, on Ubuntu 18.04
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: 4.2.0.0 Error on startup

Post by Holger »

I can confirm the test release now works perfectly, on Ubuntu 18.04
Great! Just released this hotfix as version 4.2.0.1! :D
Post Reply