AcademySoftwareFoundation / AcademySoftwareFoundation/OpenRV
[Bug]: OpenRV loads libpng 1.5 before 1.6, which breaks io_png plugin
- Dominant language
- C++
- Stars
- 764
- Forks
- 246
- Avg merge
- 6d 12h
- Merged PRs (30d)
- 13
Description
### What happened?
In the commercial RV distribution (2022.3.1), `rv.bin` links directly against `libpng16.so`. However, the `rv.bin` that is produced by the OpenRV build does not directly link against libpng at all. The end result of this is that when OpenRV runs, it ends up loading `libpng15.so` (as a side-effect of loading its dependencies) before `libpng16.so`. Since multiple versions of `libpng` cannot coexist within the same symbol namespace, this load order breaks the functionality of the `io_png` plugin, since it apparently relies on some specific features/functionality of the newer png library version.
The end result is that OpenRV cannot read PNG files, instead producing these warning error messages when trying to load them:
```
libpng warning: Application built with libpng-1.6.20 but running with 1.5.13
ERROR: plugin 'IOpng' cannot read '/path/to/image.png': PNG: error creating read struct /path/to/image.png
INFO: trying brute force to find an image reader for image.png
```
Using `LD_PRELOAD` to force-load `libpng16.so` in OpenRV fixes this error, which confirms that the library load order is important to allowing RV to function correctly.
It seems like the solution would be to ensure that rv.bin links directly against `libpng16.so`, but we have not tested this yet, as we're getting by with `LD_PRELOAD`.
CentOS 7.8.2003
OpenRV runtime version info: `Version 2023.0.0, built on Feb 1 2023 at 11:45:25 (HEAD=9c6adc2).`
### List all the operating systems versions where this is happening
CentOS 7.8.2003
### On what computer hardware is this happening?
N/A
### Relevant console log output
```shell
libpng warning: Application built with libpng-1.6.20 but running with 1.5.13
ERROR: plugin 'IOpng' cannot read '/path/to/image.png': PNG: error creating read struct /path/to/image.png
INFO: trying brute force to find an image reader for image.png
```
### Environment variables
N/A
### Extra information
Reported here: https://github.com/AcademySoftwareFoundation/OpenRV/discussions/88
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start by inspecting the build configuration that produces rv.bin and the io_png plugin, then reproduce PNG loading on CentOS 7.8.2003 while checking the linked and loaded libpng versions. Done means rv.bin directly links to libpng16.so and the reported PNG warnings and IOpng read failure no longer occur without LD_PRELOAD.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100