Home My Page Projects Code Snippets Project Openings devtools
Summary Activity Tracker SCM

[#2328] osx: Library not loaded: @rpath/QtCore.framework/Versions/5/QtCore

Date:
2020-07-23 15:22
Priority:
3
State:
Open
Submitted by:
Charles Ballard (ccb63)
Assigned to:
Nobody (None)
branch:
py3-meson
type:
none
Summary:
osx: Library not loaded: @rpath/QtCore.framework/Versions/5/QtCore

Detailed description
Dear Charles,
I've finally got round to start playing with this. I've been hacking a bit at i2 reports to make them Qt4/Qt5 compatible. (I've not checked this in anywhere yet, but made good progress).

Anyway, now ready to start (re-)porting i2 and MG:

>>> from PySide2 import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/stuart/CCP4_NIGHTLY/ccp4-20200715/lib/python3.7/site-packages/PySide2/QtCore.cpython-37m-darwin.so, 2): Library not loaded: @rpath/QtCore.framework/Versions/5/QtCore
Referenced from: /Users/stuart/CCP4_NIGHTLY/ccp4-20200715/lib/python3.7/site-packages/PySide2/QtCore.cpython-37m-darwin.so
Reason: image not found

This is better! The libraries are there and seemingly the Frameworks, just usual OS X runtime link nonsense. I can (almost certainly) fix this.

Thanks.

Stuart
Message  ↓
Date: 2020-09-22 08:53
Sender: Oleg Kovalevskiy

So, I have tried to run Qt program with Python3 pyside2 clang build on Darwin from Jul 28. I have faced following problems:

1) ImportError: dlopen(/Users/olegkovalevskiy/ccp4-20200728/lib/python3.7/site-packages/shiboken2/shiboken2.cpython-37m-darwin.so, 2): Library not loaded: libshiboken2.cpython-37m-darwin.5.12.dylib
Referenced from: /Users/olegkovalevskiy/ccp4-20200728/lib/python3.7/site-packages/shiboken2/shiboken2.cpython-37m-darwin.so
Reason: image not found

Although library physically existed in /Users/olegkovalevskiy/ccp4-20200728/lib/python3.7/site-packages/shiboken2/
Resolved by copying from that location into $CCP4/lib/

2) ImportError: dlopen(/Users/olegkovalevskiy/ccp4-20200728/lib/python3.7/site-packages/PySide2/QtWidgets.cpython-37m-darwin.so, 2): Library not loaded: libpyside2.cpython-37m-darwin.5.12.dylib
Referenced from: /Users/olegkovalevskiy/ccp4-20200728/lib/python3.7/site-packages/PySide2/QtWidgets.cpython-37m-darwin.so
Reason: image not found

Same story as (1), library physically existed and was copied into $CCP4/lib/

3) ImportError: dlopen(/Users/olegkovalevskiy/ccp4-20200728/lib/python3.7/site-packages/PySide2/QtWidgets.cpython-37m-darwin.so, 2): Library not loaded: @loader_path/../../../../Frameworks/QtQml.framework/Versions/5/QtQml
Referenced from: /Users/olegkovalevskiy/ccp4-20200728/lib/libpyside2.cpython-37m-darwin.5.12.dylib
Reason: image not found

As libpyside2.cpython-37m-darwin.5.12.dylib have been moved to $CCP4/lib/, then @loader_path become broken. Fixed using install_name_tool by changing path to correct one. In fact, libpyside2.cpython-37m-darwin.5.12.dylib contained three broken paths to the various Qt components - all fixed with install_name_tool.


Date: 2020-07-28 12:28
Sender: Charles Ballard

CMP0042 removes the @rpath

=== modified file 'ccp4.xml'
--- ccp4.xml 2020-07-08 08:44:22 +0000
+++ ccp4.xml 2020-07-28 12:26:57 +0000
@@ -2507,7 +2507,7 @@
build="${}" install="make INSTALL_ROOT=${destdir} install" clean="${}"
supports-non-srcdir-builds="yes">
<if condition-set="darwin">
- <configure value=" -no-xcb -libdir ${prefix}/Frameworks" />
+ <configure value=" -no-xcb -libdir ${prefix}/Frameworks -no-rpath" />
</if>
<if condition-unset="darwin">
<configure value=" -qt-xcb" />
@@ -4150,6 +4150,7 @@
version="5.12.5"
hash="sha256:130a4abc9ef206e5e363e0ea91ce17c106bc1bd5bd6f6ecc5e6a7c4cb9a7800d" >
<patch file="pyside2-distutils-workaround.patch" strip="0" />
+ <patch file="pyside2-cmp0042.patch" strip="0" />
</branch>
<dependencies>
<dep package="qt5"/>

=== added file 'patches/pyside2-cmp0042.patch'
--- patches/pyside2-cmp0042.patch 1970-01-01 00:00:00 +0000
+++ patches/pyside2-cmp0042.patch 2020-07-28 12:24:50 +0000
@@ -0,0 +1,34 @@
+--- sources/shiboken2/CMakeLists.txt.old 2019-09-11 06:23:10.000000000 +0100
++++ sources/shiboken2/CMakeLists.txt 2020-07-28 13:20:59.000000000 +0100
+@@ -3,6 +3,14 @@
+ cmake_minimum_required(VERSION 3.1)
+ cmake_policy(VERSION 3.1)
+
++if(POLICY CMP0068)
++ cmake_policy(SET CMP0068 NEW)
++endif()
++
++if(POLICY CMP0042)
++ cmake_policy(SET CMP0042 OLD)
++endif()
++
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build Type")
+
+ project(shiboken2)
+--- sources/pyside2/CMakeLists.txt.old 2019-09-11 06:23:10.000000000 +0100
++++ sources/pyside2/CMakeLists.txt 2020-07-28 10:59:13.000000000 +0100
+@@ -3,6 +3,14 @@
+ cmake_minimum_required(VERSION 3.1)
+ cmake_policy(VERSION 3.1)
+
++if(POLICY CMP0068)
++ cmake_policy(SET CMP0068 NEW)
++endif()
++
++if(POLICY CMP0042)
++ cmake_policy(SET CMP0042 OLD)
++endif()
++
+ # Don't ignore targets that do not exist, inside add_dependencies calls.
+ cmake_policy(SET CMP0046 NEW)
+

Date: 2020-07-27 15:55
Sender: Charles Ballard

Trying CMP0068
https://cmake.org/cmake/help/v3.13/policy/CMP0068.html#policy:CMP0086

but also CMP0042
https://cmake.org/cmake/help/v3.13/policy/CMP0042.html#policy:CMP0042

Date: 2020-07-25 18:26
Sender: Charles Ballard

Failed for pyside, --standalone and --rpath=

Date: 2020-07-24 15:22
Sender: Charles Ballard

Brief check for qt5 seems to show -no-rpath worked

Date: 2020-07-24 13:14
Sender: Charles Ballard

Try -no-rpath for qt5 build, maybe -rpath=no

Try --standalone for pyside build (OPTION_STANDALONE in options.py, alternative is OPTION_RPATH_VALUE or similar)

Date: 2020-07-24 09:47
Sender: Charles Ballard

Known issue https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1242?filter=allissues

Date: 2020-07-23 15:24
Sender: Charles Ballard

Stuart McNicholas <stuart.mcnicholas@york.ac.uk>
|
Today, 10:17 AM
After a bit of install_name_tool magic, in better shape, as I'm sure you expected.

CCP4MGs-MBP:CCP4_NIGHTLY stuart$ ccp4-python
Python 3.7.1 (default, Jul 10 2020, 20:47:59)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PySide2 import Qt3DAnimation,Qt3DCore,Qt3DExtras,Qt3DInput,Qt3DLogic,Qt3DRender,QtCharts,QtConcurrent,QtCore,QtDataVisualization,QtGui,QtHelp,QtMacExtras,QtMultimedia,QtMultimediaWidgets,QtNetwork,QtOpenGL,QtOpenGLFunctions,QtPrintSupport,QtQml,QtQuick,QtQuickWidgets,QtRemoteObjects,QtScript,QtScriptTools,QtScxml,QtSensors,QtSql,QtSvg,QtTest,QtTextToSpeech,QtUiTools,QtWebChannel,QtWebEngine,QtWebEngineCore,QtWebEngineWidgets,QtWebSockets,QtWidgets,QtXml,QtXmlPatterns
>>>

No errors!

No Changes Have Been Made to This Item