Background: I write code with Xcode purely for scientific research purposes, that runs only on my machine, never delivered as an application. I share the project and source code with a few collaborators to run on their machines only. I've done this for years. I keep Xcode up to date because the core functionality is implemented in C++ (with an Objective-C GUI) and I want to stay up-to-date on the C++ features. This is basically a simulation modeling system, which uses separate "plug-in" dylibs from separate Xcode projects for specific models. This has been working great for more than a decade!
The last few versions of Xcode and the change to the new build system have broken my projects in confusing ways. Apparently I now I have code signing problems that I didn't have before.
The software has two pieces: one is a private framework that is built and copied to ~/Library/Frameworks. The main application project uses this framework. The framework is also used by a separate project for the specific models that builds a dylib that is loaded by the main application project using the dlfcn facility.
All this has worked fine until about a year ago when I moved to the new build system. I am currently using Xcode 13.2.1 on macOS 12.2.1 Two problems seem to be involved, but I'll start with the one that is confusing me the most:
When I try to build the main application project, I get a code signing error: /Users/kieras/Documents/Programming/EPIC work/EPIC Archive/Separate EPIC Lib and App projects/EPIC App Only/DerivedData/EPIC/Build/Products/Release/EPICApp.app: code object is not signed at all
In subcomponent: /Users/kieras/Documents/Programming/EPIC work/EPIC Archive/Separate EPIC Lib and App projects/EPIC App Only/DerivedData/EPIC/Build/Products/Release/EPICApp.app/Contents/Frameworks/EPICLib.framework
Does this mean that the signing problem is with my framework project? I checked that and rebuilt it with myself as (Personal Team) and Sign to Run Locally.
However, the build on the application project fails with the same error even though I have the application project also set as (Personal Team) and Sign to Run Locally.
I looked around in the main application project build settings and found in Build Phases/Embed Frameworks an entry for the framework with a check box whose label I could not make completely visible: "Code Sign On Co...". I tried checking this box, cleaned, rebuilt and this time there was no code signing error. However, when I tried to run the project from within Xcode, I got this error appearing in the debugger window:
dyld[3318]: Library not loaded: ~/Library/Frameworks/EPICLib.framework/Versions/A/EPICLib
Referenced from: /Users/kieras/Documents/Programming/EPIC work/EPIC Archive/Separate EPIC Lib and App projects/EPIC App Only/DerivedData/EPIC/Build/Products/Release/EPICApp.app/Contents/MacOS/EPICApp
Reason: tried: '/Users/kieras/Documents/Programming/EPIC work/EPIC Archive/Separate EPIC Lib and App projects/EPIC App Only/DerivedData/EPIC/Build/Products/Release/EPICLib.framework/Versions/A/EPICLib' (no such file), '~/Library/Frameworks/EPICLib.framework/Versions/A/EPICLib' (no such file), '/Library/Frameworks/EPICLib.framework/Versions/A/EPICLib' (no such file), '/System/Library/Frameworks/EPICLib.framework/Versions/A/EPICLib' (no such file)
This is the second problem I've encountered in other variations of how I've set up these projects. So there are two problems: One is a code signing problem, the other is a library load problem, both of which are new to recent versions of Xcode.
Another question thread suggests that my framework project run script could be the problem. After building the framework, the script first does rm -R the old framework, and then cp -R the new framework, to the ~/Library/Frameworks directory. This script appears to run correctly.
I could revert to the legacy build system, but I believe that will disappear pretty soon and I would rather solve this problem now rather than later.
Since this will never be distributed as a complete application, I really hope I don't have to get into the whole application/app store code signing drill. Can someone help me sort this out so I can continue just building and running my code successfully on my own machine?
Thanks!