<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem linking to libQt5*.so (Linux)]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm trying to use a module (not written by me) on Python 3.7 that contains some libQt5*.so files that supposedly were copied over (more like "spliced") from a pre-built Qt5 package (v5.12.7), while having my own distro installation of Qt5 in /usr/lib (v5.15.0).</p>
<p dir="auto">The module in question is the Python API of the <a href="https://www.ccdc.cam.ac.uk/solutions/csd-system/components/csd/" target="_blank" rel="noopener noreferrer nofollow ugc">Cambridge Structure Database</a>, named "ccdc".<br />
ccdc doesn't require PySide2 or PyQt5 but has its own libpythonapi_support.so.1.0.0 which reaches out to the functions in the libQt5*.so files that it can find in the system.<br />
Other than the fact that it's closed source, I think the internal details of ccdc are not important.<br />
ie. I can't rewire libpythonapi_support.so.1.0.0 from the source.</p>
<p dir="auto">The problem I'm having is that <strong>the import command which loads libpythonapi_support.so.1.0.0 ends up mixing up the two paths</strong> and later ends up crashing with a segfault.<br />
I had to use gdb to find where exactly the paths get mixed up.  The call stack is pretty big, so I'm pasting only the top part which seems relevant.</p>
<pre><code>(gdb) bt
#0  0x00007ffff1ecdbc5 in QXcbScreen::topLevelAt(QPoint const&amp;) const () from /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5XcbQpa.so.5
#1  0x00007ffff589f475 in ?? () from /usr/lib/libQt5Gui.so.5
#2  0x00007ffff584d983 in QWindowSystemInterface::handleScreenAdded(QPlatformScreen*, bool) () from /usr/lib/libQt5Gui.so.5
#3  0x00007ffff1eee803 in QXcbConnection::initializeScreens() () from /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5XcbQpa.so.5
#4  0x00007ffff1ec2628 in QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) () from /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5XcbQpa.so.5
#5  0x00007ffff1ec6b66 in QXcbIntegration::QXcbIntegration(QStringList const&amp;, int&amp;, char**) () from /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5XcbQpa.so.5
#6  0x00007ffff222362d in QXcbIntegrationPlugin::create(QString const&amp;, QStringList const&amp;, int&amp;, char**) () from /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/plugins/platforms/libqxcb.so
#7  0x00007ffff586c527 in QGuiApplicationPrivate::createPlatformIntegration() () from /usr/lib/libQt5Gui.so.5
#8  0x00007ffff586d9e1 in QGuiApplicationPrivate::createEventDispatcher() () from /usr/lib/libQt5Gui.so.5
#9  0x00007ffff54a2406 in QCoreApplicationPrivate::init() () from /usr/lib/libQt5Core.so.5
#10 0x00007ffff5870a20 in QGuiApplicationPrivate::init() () from /usr/lib/libQt5Gui.so.5
#11 0x00007ffff5f6e68a in QApplicationPrivate::init() () from /usr/lib/libQt5Widgets.so.5
#12 0x00007ffff68784bf in PythonAPI::application_services() () from /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libpythonapi_support.so.1.0.0
#13 0x00007ffff691dfce in PyInit__UtilitiesLib () from /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/_UtilitiesLib.so
#14 0x00007ffff7e06ef3 in _PyImport_LoadDynamicModuleWithSpec (spec=spec@entry=0x7ffff6996710, fp=fp@entry=0x0) at ./Python/importdl.c:159
#15 0x00007ffff7e04bfb in _imp_create_dynamic_impl (module=&lt;optimized out&gt;, file=&lt;optimized out&gt;, spec=0x7ffff6996710) at Python/import.c:2174
...
</code></pre>
<p dir="auto">Going from frame #12 to #11, the call suddenly changes path to /usr/lib/libQt5Widgets.so.5 where it should have called /home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Widgets.so.5</p>
<p dir="auto">Question: <strong>Does anyone know how to get Python to load the correct</strong> ccdc/_lib/libQt5*.so <strong>files, preferably without uninstalling the package that provides the</strong> /usr/lib/libQt5*.so <strong>files?</strong><br />
I'm guessing it has to do with setting some environment variable or using some kind of tool that comes with Qt5 to "select" the installation you're using.<br />
FYI, prepending the python3.7 command with LD_LIBRARY_PATH=/home/david/.local/lib/python3.7/site-packages/ccdc/_lib gives the same error ... which is strange because python3.7 shouldn't know about anything in /usr/lib if it's run that way.</p>
<p dir="auto">Thanks in advance-<br />
David</p>
]]></description><link>https://forum.qt.io/topic/117260/problem-linking-to-libqt5-so-linux</link><generator>RSS for Node</generator><lastBuildDate>Sun, 17 May 2026 11:17:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/117260.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Jul 2020 12:14:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem linking to libQt5*.so (Linux) on Thu, 23 Jul 2020 09:09:36 GMT]]></title><description><![CDATA[<pre><code>LD_PRELOAD=/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Concurrent.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Core.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5DBus.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Gui.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Network.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5OpenGL.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Positioning.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5PrintSupport.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Sql.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Svg.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Widgets.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5XcbQpa.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Xml.so python3.7

Python 3.7.8 (default, Jul 20 2020, 18:03:39) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import ccdc
&gt;&gt;&gt;
</code></pre>
<p dir="auto">Worked like magic. 😲<br />
Thanks a lot, <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> !</p>
]]></description><link>https://forum.qt.io/post/608415</link><guid isPermaLink="true">https://forum.qt.io/post/608415</guid><dc:creator><![CDATA[DavidCY]]></dc:creator><pubDate>Thu, 23 Jul 2020 09:09:36 GMT</pubDate></item><item><title><![CDATA[Reply to Problem linking to libQt5*.so (Linux) on Wed, 22 Jul 2020 18:17:43 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">One thing you can try is to use LD_PRELOAD to preload the custom Qt version you have.</p>
]]></description><link>https://forum.qt.io/post/608291</link><guid isPermaLink="true">https://forum.qt.io/post/608291</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 22 Jul 2020 18:17:43 GMT</pubDate></item></channel></rss>