freetype should version symbols
Migrated from: [SAVANNAH-57179]
Anonymous reported:
On different linux systems with different freetype versions the freetype library names (SONAME) are:
- CentOS 7.5, freetype 2.4.11, libfreetype.so.6
- CentOS 7.7, freetype 2.8, libfreetype.so.6
- Fedora 29, freetype 2.9.1, libfreetype.so.6
The problem is that it is not possible when building and linking against a version of freetype to capture the necessary libfreetype version needed at runtime, because freetype does not use symbol versioning. When the linker can't capture it, packaging mechanisms like rpmdeps can't extract the correct dependency either. This leads to problems at runtime with undefined symbols when the freetype version installed is too old. See e.g https://bugreports.qt.io/browse/QTBUG-74324
New versions of freetype should use symbol versioning to eliminate this problem.
For reference, the Qt project has used a mechanism that versions just a single symbol that will automatically be used by applications and libraries that link with Qt. That way the linker will record a requirement on having at least the version that was built against. This is simpler for C++ applications that generate a lot of symbols, so I don't know if such a mechanism makes sense for freetype, but I thought I'd mention it. For a C library there are problably few enough added symbols that it is easy to version them all.
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=6de8c0aa09d4bb31ae927f7a98be47f5773acd70
Note: I have also recorded an issue related to this in the redhat bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1769279