Opened 2 years ago

Closed 18 months ago

#64312 closed defect (fixed)

iaito: ld: cannot link directly with dylib/framework, your binary is not an allowed client of /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks//Python.framework/Python.tbd

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: i0ntempest
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: Cc:
Port: iaito

Description

https://build.macports.org/builders/ports-12_x86_64-builder/builds/8008/steps/install-port/logs/stdio

ld: cannot link directly with dylib/framework, your binary is not an allowed client of /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks//Python.framework/Python.tbd for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Change History (16)

comment:1 Changed 2 years ago by i0ntempest

Never seen this before, why is it trying to link python in the sdk?

comment:2 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Yes, that would be the question!

I see in the build log the following flags:

-F/opt/local/Library/Frameworks ... -F/opt/local/Library/Frameworks/Python.framework -framework Python

-framework Python would mean "link with the first Python.framework found in all of the Frameworks directories".

-F/opt/local/Library/Frameworks would mean "look for frameworks in /opt/local/Library/Frameworks". There is a Python.framework in there, however it has many versions. Which version would it use? As far as know, it uses whichever one the Current symlink points to. MacPorts doesn't provide a Current symlink within the Python.framework so I think effectively that means this Python.framework is not found.

-F/opt/local/Library/Frameworks/Python.framework would mean "look for frameworks in /opt/local/Library/Frameworks/Python.framework" which makes no sense since there aren't any frameworks within the Python.framework. Therefore this flag doesn't do anything useful.

The Python.framework that -framework Python finds, then, must be the system one.

comment:3 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Installing the port on 10.15.7, I see:

$ otool -L /Applications/MacPorts/iaito.app/Contents/MacOS/iaito.bin
/Applications/MacPorts/iaito.app/Contents/MacOS/iaito.bin:
	/opt/local/Library/Frameworks/Python.framework/Versions/3.9/Python (compatibility version 3.9.0, current version 3.9.0)
	/opt/local/lib/libr_core.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_config.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_cons.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_io.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_flag.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_asm.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_debug.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_hash.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_bin.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_lang.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_parse.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_bp.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_egg.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_reg.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_search.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_syscall.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_socket.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_fs.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_anal.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_magic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_util.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libr_crypto.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.16)
	@rpath/libshiboken2.cpython-39-darwin.5.15.dylib (compatibility version 5.15.0, current version 5.15.2)
	@rpath/libpyside2.cpython-39-darwin.5.15.dylib (compatibility version 5.15.0, current version 5.15.2)
	/opt/local/libexec/qt5/lib/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.15.0, current version 5.15.2)
	/opt/local/libexec/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.15.0, current version 5.15.2)
	/opt/local/libexec/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.15.0, current version 5.15.2)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.40.150)
	/System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 212.5.15)
	/opt/local/libexec/qt5/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.15.0, current version 5.15.2)
	/opt/local/libexec/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.15.0, current version 5.15.2)
	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 902.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)

Note both /opt/local/Library/Frameworks/Python.framework/Versions/3.9/Python (compatibility version 3.9.0, current version 3.9.0) and /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.16).

comment:4 Changed 2 years ago by i0ntempest

I just tried to build this on my system and I can't reproduce this, and the old log with failed build is now gone. I'll revbump this (as radare2 was updated) and see if it still fails.

comment:5 Changed 2 years ago by i0ntempest

Resolution: fixed
Status: assignedclosed

Cleared macOS 10.15 to 11 buildbots, I guess this is fixed. Now wait for 12

comment:6 Changed 2 years ago by i0ntempest

Resolution: fixed
Status: closedreopened

Oops didn't mean to close. Will close if it clears macOS 12.
EDIT: actually macOS 12 buildbot doesn't seem to be building anything righht now?

Last edited 2 years ago by i0ntempest (previous) (diff)

comment:7 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

The 12 x86_64 builder is no longer bootable after attempting to update it to 12.2. I continue to investigate.

The build still fails on the 12 arm64 builder: https://build.macports.org/builders/ports-12_arm64-builder/builds/41889/steps/install-port/logs/stdio

comment:8 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

As to why the system is not allowing you to link with the system's python 2.7 framework, the reason may well be that we have learned that python 2.7 will be removed in macOS 12.3, so now is a great time to stop trying to use it.

comment:9 Changed 2 years ago by i0ntempest

But it never needed Python 2 framework, it has always been linking just MacPorts Python 3 without problems for me. You can see in the log it's Project MESSAGE: Using Python.framework at /opt/local/Library/Frameworks, and nowhere other than the final error message does it mention this Python.tbd in the SDK. I probably need to remove this SDK framework path from framework search paths but I'll need to figure out how first. There's no mention of /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks being in framework search paths in the log either.

comment:10 in reply to:  9 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to i0ntempest:

But it never needed Python 2 framework, it has always been linking just MacPorts Python 3 without problems for me.

I showed above that it links with both MacPorts Python 3 and system Python 2 frameworks.

You can see in the log it's Project MESSAGE: Using Python.framework at /opt/local/Library/Frameworks, and nowhere other than the final error message does it mention this Python.tbd in the SDK. I probably need to remove this SDK framework path from framework search paths but I'll need to figure out how first. There's no mention of /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks being in framework search paths in the log either.

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks is presumably a default framework search path. Your goal should probably not be to try to remove that, but to correct the other wrong frameworks paths that are being specified. I showed above how it arrives at the decision to link with the system's framework rather than the intended MacPorts one.

comment:11 Changed 2 years ago by i0ntempest

I have removed -F/opt/local/Library/Frameworks/Python.framework as you said it isn’t doing anything, now we’re left with just -F/opt/local/Library/Frameworks -framework Python which I think is correct?
Anyway I’ll open a ticket upstream and ask the devs there as well.

comment:12 in reply to:  11 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to i0ntempest:

I have removed -F/opt/local/Library/Frameworks/Python.framework as you said it isn’t doing anything, now we’re left with just -F/opt/local/Library/Frameworks -framework Python which I think is correct?
Anyway I’ll open a ticket upstream and ask the devs there as well.

I explained why -F/opt/local/Library/Frameworks/Python.framework isn't doing anything either.

Upstream might not have any suggestions, since it's probably only due to MacPorts' unusual layout of Python frameworks that the issue arises.

comment:13 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

I explained why -F/opt/local/Library/Frameworks/Python.framework isn't doing anything either.

er.. I meant I explained why -F/opt/local/Library/Frameworks -framework Python isn't doing anything either:

-F/opt/local/Library/Frameworks would mean "look for frameworks in /opt/local/Library/Frameworks". There is a Python.framework in there, however it has many versions. Which version would it use? As far as know, it uses whichever one the Current symlink points to. MacPorts doesn't provide a Current symlink within the Python.framework so I think effectively that means this Python.framework is not found.

I see now that MacPorts does make a Current symlink, and some other symlinks, if you use sudo port select python. We of course don't want ports to rely on the effects of port select so we should not use -F/opt/local/Library/Frameworks -framework Python.

The change you made in [8e747cce4e1f62e58370c8b2a9a7a1c87678b2fa/macports-ports] made it fail to build on all OS versions:

fatal error: 'Python.h' file not found
#include <Python.h>
         ^~~~~~~~~~

I would have thought that the INCLUDEPATH and LIBS that you removed were the only thing allowing it to find the right MacPorts python framework in the first place.

The change you made in [ea78373ca1ae8405bb9fe3b860c6dfd04ac207b2/macports-ports] allowed it to build on 10.15.x and 11.x (I'm not sure why) but not other OS versions and it's still linking with both the MacPorts python 3.9 framework and the system's python 2.7 framework.

comment:14 Changed 2 years ago by i0ntempest

Right now the situation is basically the same as before, just that pkgconfig is taking care of the INCLUDEPATH and LIBS args I removed. I’m kinda lost right now…

comment:16 Changed 18 months ago by i0ntempest

Resolution: fixed
Status: reopenedclosed

In 6c32cbb7ce3727ef7ad00fd71cd30f4580721b70/macports-ports (master):

iaito: 5.7.8, upstream discontinued python support

Closes: #65477
Closes: #64312

Note: See TracTickets for help on using tickets.