Opened 2 years ago

Closed 2 years ago

#64579 closed defect (fixed)

py310-pyobjc @7.3_2 fails to build on MacOS 10.15

Reported by: Gandoon (Erik Hedlund) Owned by: danchr (Dan Villiom Podlaski Christiansen)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: Cc:
Port: py-pyobjc

Description

While attempting to upgrade py-spyder from py39-spyder to py310-spyder, the dependency py310-pyobjc fails to build on MacOS 10.15. The failure seems to happen while building pyobjc-framework-Cocoa. This makes me suspect that the failure has to do with incompatibilities between newer SDKs and the ones available on the now legacy MacOS 10.15. As py39-pyobjc builds just fine, and the build is reported as working on 10.15, I am at an impasse here. I have spent some time trying to find a workaround (a fortnight by now), but at this moment, I have yet to find one. Log attached.

Attachments (1)

py310-pyobjc-main.log (962.4 KB) - added by Gandoon (Erik Hedlund) 2 years ago.
Failed build of py310-pyobjc

Download all attachments as: .zip

Change History (9)

Changed 2 years ago by Gandoon (Erik Hedlund)

Attachment: py310-pyobjc-main.log added

Failed build of py310-pyobjc

comment:1 Changed 2 years ago by reneeotten (Renee Otten)

Owner: set to danchr
Port: py-pyobjc added; py310-pyobjc removed
Status: newassigned

upstream has released version 8.2, so perhaps updating will help.

comment:2 Changed 2 years ago by Gandoon (Erik Hedlund)

Just a small update, I didn't mention it in the original submission, the failure seems to occur in the destroot phase.
The tail end of the log file reflects this:

6885	:info:destroot Building pyobjc-core...
6886	:info:destroot Installing 'pyobjc-core' using '/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10'
6887	:info:destroot Building pyobjc-framework-Cocoa...
6888	:info:destroot Installing 'pyobjc-framework-Cocoa' using '/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10'
6889	:info:destroot Traceback (most recent call last):
6890	:info:destroot   File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py310-pyobjc/work/ronaldoussoren-pyobjc-4bc28cd/setup.py", line 233, in <module>
6891	:info:destroot     main()
6892	:info:destroot   File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py310-pyobjc/work/ronaldoussoren-pyobjc-4bc28cd/setup.py", line 229, in main
6893	:info:destroot     build_project(project, sys.argv[1:])
6894	:info:destroot   File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py310-pyobjc/work/ronaldoussoren-pyobjc-4bc28cd/setup.py", line 213, in build_project
6895	:info:destroot     subprocess.check_call(
6896	:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
6897	:info:destroot     raise CalledProcessError(retcode, cmd)
6898	:info:destroot subprocess.CalledProcessError: Command '['/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10', 'setup.py', '--no-user-cfg', 'install', '--prefix=/opt/local/Library/Frameworks/Python.framework/Versions/3.10', '--root=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py310-pyobjc/work/destroot']' returned non-zero exit status 1.
6899	:info:destroot Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py310-pyobjc/work/pyobjc-7.3" && /opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 setup.py --no-user-cfg install --prefix=/opt/local/Library/Frameworks/Python.framework/Versions/3.10 --root=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pyobjc/py310-pyobjc/work/destroot
6900	:info:destroot Exit code: 1
6901	:error:destroot Failed to destroot py310-pyobjc: command execution failed
6902	:debug:destroot Error code: CHILDSTATUS 93808 1
6903	:debug:destroot Backtrace: command execution failed
6904	:debug:destroot     while executing
6905	:debug:destroot "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
6906	:debug:destroot     invoked from within
6907	:debug:destroot "command_exec -callback portprogress::target_progress_callback destroot"
6908	:debug:destroot     (procedure "portdestroot::destroot_main" line 2)
6909	:debug:destroot     invoked from within
6910	:debug:destroot "$procedure $targetname"

Apart from several warnings, the rest of the actual build phase seems to have been correctly executed prior to the stopped on Error. The Building pyobjc-core... initially seemed to indicate to me that a build stage failed, but if I read the log correctly, this is indeed in the destroot phase, thus I don't think it is directly related to older closed tickets such as #63084 or #63087, as they both failed in the build phase. Please advice if I am wrong in that assumption.

As far as I understand it, the destroot phase should perform an install procedure in the build directory, after the completion of which the whole package is moved into its final positions.
Could this have something to do with which user is performing the operation? I performed the build as root (sudo), and several of the steps are indeed performed as or chowned to the user macports.

Last edited 2 years ago by Gandoon (Erik Hedlund) (previous) (diff)

comment:3 Changed 2 years ago by Gandoon (Erik Hedlund)

Further update

A more likely culprit might be the race conditions that have been mentioned in the Qt issue tracking system e.g. here: ​https://bugreports.qt.io/browse/PYSIDE-1760 and here: ​https://codereview.qt-project.org/c/pyside/pyside-setup/+/388252. Race conditions in pyobjc have been reported, fixed, and merged in September 2021 (v8.0 or 8.2), so maybe reneeotten is correct in suggesting updating the port.

Last edited 2 years ago by Gandoon (Erik Hedlund) (previous) (diff)

comment:4 Changed 2 years ago by Gandoon (Erik Hedlund)

Workaround found

I found a workaround now. The issue seems to be at least related to setuptools. By reverting to distutils the destroot phase and install worked.
I also used the previously mentioned patch to solve the race conditions. The patch alone did not solve the issue. In the end I tested to revert the errors one by one, confirming that they passed the destroot and eventually reverted every framework component to distutils, and the port finally built and installed.

Example from patch-setuptools-distutils.diff as distributed by MacPorts:

. . .
diff --git pyobjc-framework-AVFoundation/pyobjc_setup.py pyobjc-framework-AVFoundation/pyobjc_setup.py
--- pyobjc-framework-AVFoundation/pyobjc_setup.py
+++ pyobjc-framework-AVFoundation/pyobjc_setup.py
@@ -23,9 +23,9 @@ from setuptools import Extension as _Ext
 from setuptools import setup as _setup
 from setuptools.command import build_ext, build_py, develop, egg_info, install_lib, test

-from distutils import log
-from distutils.errors import DistutilsError, DistutilsPlatformError
-from distutils.command import build, install
+from setuptools._distutils import log
+from setuptools._distutils.errors import DistutilsError, DistutilsPlatformError
+from setuptools._distutils.command import build, install
. . .

So essentially, by not doing this, I got it to work.

Remains to see if it works as expected…

Last edited 2 years ago by Gandoon (Erik Hedlund) (previous) (diff)

comment:5 Changed 2 years ago by mfacorcoran

py310-pyobjc also fails to build for me on macos 11.6.4, also apparently at the destroot stage. From the log the errors seem to be

:info:destroot     import distutils.command.install_scripts as orig
:info:destroot ImportError: cannot import name 'install_scripts' from 'setuptools._distutils.command' (/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/__init__.py)

comment:6 Changed 2 years ago by reneeotten (Renee Otten)

the port should be updated to its latest version, which will possible/likely eliminate the issues ; see #64766. Not sure whether or not the maintainer is working on this, but if not I might take a stab at it in the next days myself.

comment:7 Changed 2 years ago by Gandoon (Erik Hedlund)

I just built the upgraded py310-pyobjc @8.4.1_0 and it built just fine on the same system used when the ticket was submitted. So, this ticket may be ok to close now.

comment:8 Changed 2 years ago by danchr (Dan Villiom Podlaski Christiansen)

Resolution: fixed
Status: assignedclosed

In c54715f8f27864fd2e41dcb8488c72ac90b03884/macports-ports (master):

py-pyobjc: reinstate missing patches

This reinstates patches accidentally deleted in the recent upgrade. Of
note, this reinstates the changes to suppress -Werror, hopefully
fixing the build on older platforms.

Closes: #64579
Closes: #64948
Closes: #64989
Closes: #65000

Note: See TracTickets for help on using tickets.