I have just updated my Macbook to Monterey and installed XCode 13. I’m now seeing errors when trying to link my code – for example one library needs to link to the system python2.7, but gives the error:
Keiths-MacBook-Pro:libcdb keith$ make rm -f libcdb.1.0.0.dylib
libcdb.dylib libcdb.1.dylib libcdb.1.0.dylib
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-stdlib=libc++ -headerpad_max_install_names -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk
-mmacosx-version-min=10.13 -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/usr/local/Qt-5.15.7/lib -single_module -dynamiclib -compatibility_version 1.0 -current_version 1.0.0 -install_name libcdb.1.dylib -o libcdb.1.0.0.dylib release/db.o release/KDTree.o release/db_Wlist.o release/db_VSeg.o
release/db_View.o release/db_ViaInst.o release/db_ViaGen.o
release/db_Via.o release/db_Vertex.o release/db_Vector.o
release/db_Utils.o release/db_Trapezoid.o release/db_Transform64.o
release/db_Transform.o release/db_Techfile.o release/db_Style.o
release/db_Signal.o release/db_Shape.o release/db_SegParam.o
release/db_Segment.o release/db_Rectangle.o release/db_Rect.o
release/db_QTree.o release/db_Property.o release/db_Polygon.o
release/db_PointList.o release/db_Point.o release/db_Pin.o
release/db_Path.o release/db_ObjList.o release/db_Obj.o
release/db_Net.o release/db_Mst.o release/db_Mpp.o release/db_Lpp.o
release/db_Line.o release/db_Library.o release/db_Layer.o
release/db_Label.o release/db_InstPin.o release/db_Inst.o
release/db_HVTree.o release/db_HSeg.o release/db_HierObj.o
release/db_Group.o release/db_Ellipse.o release/db_Edge.o
release/db_CellView.o release/db_Cell.o release/db_Array.o
release/db_Arc.o -F/usr/local/Qt-5.15.7/lib -L../libcpp/release -lcpp
-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
-lpython2.7 -framework QtWidgets -framework QtGui -framework AppKit -framework Metal -framework QtNetwork -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
ld: cannot link directly with dylib/framework, your binary is not an
allowed client of
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.tbd
for architecture x86_64 clang: error: linker command failed with exit
code 1 (use -v to see invocation) make: ***
[release/libcdb.1.0.0.dylib] Error 1
Given that I have recompiled (successfully) the Qt libs and the code for this library, why is it giving me this ‘your binary is not an allowed client’ error?
As far as I can see the python2.7 paths have not changed, so the error is baffling.
2
Answers
So the quick and diirty fix is to edit the Python.tdb file that is located at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/Python.framework/Versions/Current/Python.tdb
And add your library/executable targets to the clients list.
Of course, there is a reason Apple are doing this - python2 is deprecated and sooner or later they will drop it. But until they do, this works.
What fixed it for me was to drop the Python2 framework and link with the framework provided by my version of Python3 installed via Brew.
Locate your installation of Python3 by using this command in Terminal:
ls -la $(which python3)
.The framework is in the "Frameworks" folder located one level above "bin", for example: /usr/local/Cellar/[email protected]/3.9.7_1/Frameworks
Once your have the location of the Python3 framework, add it as a framework in your XCode project.
In the Build Settings, don’t forget to add:
Some functions changed in version 3 so you’ll need to update some of your Python function calls.