marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.35k stars 217 forks source link

failed to resolve path [@rpath/libpyside6.abi3.6.2.dylib] #1431

Closed emign closed 2 years ago

emign commented 2 years ago

Describe the bug

ERROR: Could not resolve RPath [@rpath/libpyside6.abi3.6.2.dylib] in file [/Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/PySide6/QtNetwork.abi3.so], and could not find any likely intended reference.
[0] File: /Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/PySide6/QtNetwork.abi3.so
  Commands:
    <MachOCommand (Load command 0 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 1 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 2 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 3 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 4 / cmd LC_DYLD_INFO_ONLY)>
    <MachOCommand (Load command 5 / cmd LC_SYMTAB)>
    <MachOCommand (Load command 6 / cmd LC_DYSYMTAB)>
    <MachOCommand (Load command 7 / cmd LC_UUID)>
    <MachOCommand (Load command 8 / cmd LC_BUILD_VERSION)>
    <MachOCommand (Load command 9 / cmd LC_SOURCE_VERSION)>
    <LoadCommand path='@rpath/libpyside6.abi3.6.2.dylib'>
    <LoadCommand path='@rpath/libshiboken6.abi3.6.2.dylib'>
    <LoadCommand path='@rpath/QtNetwork.framework/Versions/A/QtNetwork'>
    <LoadCommand path='@rpath/QtCore.framework/Versions/A/QtCore'>
    <LoadCommand path='/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration'>
    <LoadCommand path='/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit'>
    <LoadCommand path='/usr/lib/libc++.1.dylib'>
    <LoadCommand path='/usr/lib/libSystem.B.dylib'>
    <MachOCommand (Load command 18 / cmd LC_FUNCTION_STARTS)>
    <MachOCommand (Load command 19 / cmd LC_DATA_IN_CODE)>
    <MachOCommand (Load command 20 / cmd LC_CODE_SIGNATURE)>
    <RPath path='@loader_path'>
    <RPath path='@loader_path/Qt/lib'>
  RPath commands:
    <RPath path='@loader_path'>
    <RPath path='@loader_path/Qt/lib'>
  Calculated RPath:
    /Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/PySide6/Qt/lib
Traceback (most recent call last):
  File "/Users/username/PycharmProjects/spendenlauf/venv/bin/cxfreeze", line 8, in <module>
    sys.exit(main())
  File "/Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/cx_Freeze/cli.py", line 365, in main
    freezer.Freeze()
  File "/Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 648, in Freeze
    self._post_freeze_hook()
  File "/Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 859, in _post_freeze_hook
    self.darwinTracker.finalizeReferences()
  File "/Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/cx_Freeze/darwintools.py", line 621, in finalizeReferences
    raise DarwinException(
cx_Freeze.exception.DarwinException: finalizeReferences() failed to resolve path [@rpath/libpyside6.abi3.6.2.dylib] in file [/Users/username/PycharmProjects/spendenlauf/venv/lib/python3.9/site-packages/PySide6/QtNetwork.abi3.so].

To Reproduce Just build this Qt6 App on my M1-Mac:

from PySide6.QtWidgets import QMainWindow, QApplication

from qt.main_window import Ui_MainWindow

class Main_Window(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

if __name__ == '__main__':
    app = QApplication()
    main_window = Main_Window()
    main_window.show()
    app.exec()

Desktop (please complete the following information):

marcelotduarte commented 2 years ago

1) Can you test the pyside6 sample?

2) What is your setup.py for your sample?

3) How to install the module qt used in your sample?

emign commented 2 years ago

Thank you for answering. The sample produces the same output. I did the following with the pyside6-sample you linked:

  1. python3 -m venv ./venv
  2. source venv/bin/activate
  3. pip install pyside6
  4. pip install cx_freeze
  5. cxfreeze -c test_pyside6.py --target-dir dist

This is the output:

ERROR: Could not resolve RPath [@rpath/libpyside6.abi3.6.2.dylib] in file [/Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/PySide6/QtCore.abi3.so], and could not find any likely intended reference.
[0] File: /Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/PySide6/QtCore.abi3.so
  Commands:
    <MachOCommand (Load command 0 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 1 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 2 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 3 / cmd LC_SEGMENT_64)>
    <MachOCommand (Load command 4 / cmd LC_DYLD_INFO_ONLY)>
    <MachOCommand (Load command 5 / cmd LC_SYMTAB)>
    <MachOCommand (Load command 6 / cmd LC_DYSYMTAB)>
    <MachOCommand (Load command 7 / cmd LC_UUID)>
    <MachOCommand (Load command 8 / cmd LC_BUILD_VERSION)>
    <MachOCommand (Load command 9 / cmd LC_SOURCE_VERSION)>
    <LoadCommand path='@rpath/libpyside6.abi3.6.2.dylib'>
    <LoadCommand path='@rpath/libshiboken6.abi3.6.2.dylib'>
    <LoadCommand path='@rpath/QtCore.framework/Versions/A/QtCore'>
    <LoadCommand path='/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration'>
    <LoadCommand path='/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit'>
    <LoadCommand path='/usr/lib/libc++.1.dylib'>
    <LoadCommand path='/usr/lib/libSystem.B.dylib'>
    <MachOCommand (Load command 17 / cmd LC_FUNCTION_STARTS)>
    <MachOCommand (Load command 18 / cmd LC_DATA_IN_CODE)>
    <MachOCommand (Load command 19 / cmd LC_CODE_SIGNATURE)>
    <RPath path='@loader_path'>
    <RPath path='@loader_path/Qt/lib'>
  RPath commands:
    <RPath path='@loader_path'>
    <RPath path='@loader_path/Qt/lib'>
  Calculated RPath:
    /Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/PySide6/Qt/lib
Traceback (most recent call last):
  File "/Users/username/Desktop/pyside-sample/venv/bin/cxfreeze", line 8, in <module>
    sys.exit(main())
  File "/Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/cx_Freeze/cli.py", line 365, in main
    freezer.Freeze()
  File "/Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 648, in Freeze
    self._post_freeze_hook()
  File "/Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/cx_Freeze/freezer.py", line 859, in _post_freeze_hook
    self.darwinTracker.finalizeReferences()
  File "/Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/cx_Freeze/darwintools.py", line 621, in finalizeReferences
    raise DarwinException(
cx_Freeze.exception.DarwinException: finalizeReferences() failed to resolve path [@rpath/libpyside6.abi3.6.2.dylib] in file [/Users/username/Desktop/pyside-sample/venv/lib/python3.9/site-packages/PySide6/QtCore.abi3.so].

full_output.log

Same happens with python 3.10 btw:

cx_Freeze.exception.DarwinException: finalizeReferences() failed to resolve path [@rpath/libpyside6.abi3.6.2.dylib] in file [/Users/username/Desktop/pyside-sample/venv/lib/python3.10/site-packages/PySide6/QtCore.abi3.so].
marcelotduarte commented 2 years ago

Try the sample with the setup.py python setup.py build Another option is: python setup.py bdist_mac

Gaming32 commented 2 years ago

The same error occurs when doing that.

superzw commented 2 years ago

@emign Have you resolved this issue?

Lukikrew commented 2 years ago

same issue for me using this setup on my mac. running python setup.py bdist_mac

`from cx_Freeze import setup, Executable

build_options = {'packages': ["shiboken6","PySide6"], 'excludes': []}

import sys base = 'Win32GUI' if sys.platform=='win32' else None

executables = [ Executable('main.py', base=base, target_name = 'app') ]

setup(name='app', version = '1.6', description = 'None yet', options = {'build_exe': build_options}, executables = executables) `

Josh596 commented 2 years ago

@emign I believe this issue is due to dots in the filename and pathlib not knowing how to handle such. https://stackoverflow.com/questions/54356159/how-to-deal-with-multiple-dots-in-a-file-name-with-python-pathlib

marcelotduarte commented 2 years ago

I'm reopening this issue since the author closed it without clarifying how he solved the problem and others continue to comment.

I made a patch to try to solve it. I used the pyside6 sample and got a result using GHA. Please test: pip install --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze

marcelotduarte commented 2 years ago

pyside6-0-test_pyside6-macosx-10 15-x86_64-3 10

Josh596 commented 2 years ago

@marcelotduarte What version of PySide6 did you use?

marcelotduarte commented 2 years ago
  Python 3.10.4 (main, May  4 2022, 08:44:58) [Clang 12.0.0 (clang-1200.0.32.29)]
  Package            Version     Location                                                                     Installer
  ------------------ ----------- ---------------------------------------------------------------------------- ---------
  cx-Freeze          6.12.0.dev0 /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  packaging          21.3        /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  pip                22.1.1      /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  pyparsing          3.0.9       /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  PySide6            6.3.0       /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  PySide6-Addons     6.3.0       /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  PySide6-Essentials 6.3.0       /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  setuptools         60.10.0     /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
  shiboken6          6.3.0       /Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages pip
Lukikrew commented 2 years ago

I found out:

  1. Create an venv

  2. run pip install cx-freeze

  3. run pip install -U git+https://github.com/marcelotduarte/cx_Freeze.git@refs/pull/887/head

then it will compile. I can install all my other needed libaries without any issue, and it compiles well.

However, as soon as I am installing python-opencv in the venv it throws this error:

„This may be caused by including modules in the zip file that rely on binary libaries with the same name“

marcelotduarte commented 2 years ago

@Lukikrew After v6.5.3 has too many changes. To help to solve this issue I need tests using binary wheels:

pip install --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze

or compiling from sources:

pip install -U git+https://github.com/marcelotduarte/cx_Freeze.git@develop

Lukikrew commented 2 years ago

@marcelotduarte thank you, actually it works without any issues with the develop pip :)

marcelotduarte commented 2 years ago

To test the PR #1521 you can use the binary wheels: pip install --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze or compiling from sources: pip install -U git+https://github.com/marcelotduarte/cx_Freeze.git@develop

For my tests in GHA it works very well. pyside6 sample works with bdist_mac and build_exe. It works for pyside2 too.

marcelotduarte commented 2 years ago

cx_Freeze 6.11.1 has just been released. pip install --upgrade cx_Freeze