[mythtv-commits] Ticket #9447: MacOS X - Qt binaries log spam
MythTV
noreply at mythtv.org
Thu Mar 1 21:37:54 UTC 2012
#9447: MacOS X - Qt binaries log spam
-------------------------------------------------+-------------------------
Reporter: Craig Treleaven <ctreleaven@…> | Owner: nigel
Type: Bug Report | Status:
Priority: minor | accepted
Component: Ports - OSX | Milestone: unknown
Severity: medium | Version:
Keywords: | 0.24-fixes
| Resolution:
| Ticket locked: 0
-------------------------------------------------+-------------------------
Comment (by mythtv@…):
This issue is being caused by Qt loading its plugins from the `.osx-
packager/build/plugins` directory due to a misconfigured plugins path, as
returned by [[https://qt-
project.org/doc/qt-4.8/qlibraryinfo.html|QLibraryInfo::Location(QLibraryInfo::PluginsPath)]].
It appears to become more of an issue with later versions of Qt, as with
4.8 at least it results in a application crash for me.
The documentation covering [[https://qt-project.org/doc/qt-4.8/deployment-
mac.html#qt-plugins|plugins]] as part of Deploying an Application on Mac
OS X suggests the use of a [[https://qt-project.org/doc/qt-4.8/qt-
conf.html|qt.conf]] file in order to adjust the plugins path to be within
the application bundle. However, placing a `qt.conf` file within
`<app_bundle>/Contents/Resources`, as suggested, is not picked up. The
reason for this is that the code within
`QLibraryInfoPrivate::findConfiguration()`, whose role is to locate and
parse the `qt.conf` file during initialisation, contains a check for
whether the `QCoreApplication` has been initialised:
{{{
if (!QFile::exists(qtconfig) && QCoreApplication::instance()) {
...
}
}}}
and the `iso8859_codecs` global static array of [[https://qt-
project.org/doc/qt-4.8/qtextcodec.html|QTextCodec]] objects, which are
implemented as plugins, in `mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp`
is initialised before reaching `main()` and consequently before the
`QApplication` instance has been initialised.
The attached patches move the `iso8859_codecs` array into the
`decode_text()` function within
`mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp`, as this appears to be the
only function that requires the array and through relocating its
initialisation is deferred until the function is called, which will be
after the `QApplication` has been initialised. This change allows the
`QLibraryInfoPrivate::findConfiguration()` function to be called later and
consequently it behaves as expected and a [[https://qt-
project.org/doc/qt-4.8/qt-conf.html|qt.conf]] file placed within
`<app_bundle>/Contents/Resources` will be correctly detected. The `osx-
packager.pl` script is then modified to copy the plugins from `.osx-
packager/build/plugins` to `<app_bundle>/Contents/Resources` and to
rewrite the embedded dynamic library references to refer to the copies of
Qt libraries within the bundle, and an empty
`<app_bundle>/Contents/Resources/qt.conf` file is generated to indicate to
Qt that it should not be using the installation prefix path it was
compiled with.
The loading of the plugins from `.osx-packager/build/plugins` and
consequently the processing of the embedded dynamic library references to
the version of Qt libraries within `.osx-packager/build/lib` when combined
with the rewritten references to Qt libraries within the packaged
executables within the application bundle are the root cause of `"loading
two sets of Qt binaries"` errors. Copying the plugins into the application
bundle and rewriting their dynamic library references and then actually
loading them is what ensures only one set of Qt binaries are ever loaded.
--
Ticket URL: <http://code.mythtv.org/trac/ticket/9447#comment:6>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
More information about the mythtv-commits
mailing list