signature problem when compiling library in debug mode with Xcode 13.2.1

When I compile a C-library in debug mode I get the following error when starting an application that uses that library:

dyld[63669]: Library not loaded: /usr/local/lib/librslib_debug.dylib

  Referenced from: /Users/moreelsj/Library/Developer/Xcode/DerivedData/gproc-alhokhuzgxjwanctopctgrsmqauc/Build/Products/Debug/corg

  Reason: tried: '/Users/moreelsj/Library/Developer/Xcode/DerivedData/gproc-alhokhuzgxjwanctopctgrsmqauc/Build/Products/Debug/librslib_debug.dylib' (no such file), '/usr/lib/system/introspection/librslib_debug.dylib' (no such file), '/usr/local/lib/librslib_debug.dylib' (code signature does not cover entire file up to signature), '/usr/lib/librslib_debug.dylib' (no such file)

The application works when I use the same library compiled in release mode. The problem appeared when I changed the library and recompiled it. There was no problem using the older debug version of that library.

I recently upgraded both the OS (12.2) and Xcode

  • Did you try downloading more simulator and select new runtime when proposed to do (Window > Devices and Simulators menu)

  • This application runs native on MacOS and is not supposed to run on iPhone or iPad.

Add a Comment

Replies

When I compile a C-library in debug mode I get the following error when starting an application that uses that library:

Where you expecting this app to load the library from? /usr/local/lib/librslib_debug.dylib?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Yes. That is the location where the library can be found.

Add a Comment

That is the location where the library can be found.

OK. In that case I think the first thing to do is rule out the problem discussed in Updating Mac Software. The easiest way to do that is:

  1. Run your program to reproduce the problem.

  2. Restart your Mac.

  3. Run your program again, without rebuilding it.

Does that clear the issue?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • The reboot seems to have done the trick (not very Mac-like, is it?). Before the reboot I checked that all compile/link settings were identical between the release and debug version of the library. The application worked using the release version and gave a code signing problem with the debug version. After the reboot it magically also worked with the debug version. An idea what could be the reason for this? Anyway, thanks for the help.

Add a Comment

The reboot seems to have done the trick

Cool.

An idea what could be the reason for this?

The fact that a restart fixed the problem suggests that you hitting the issue described in Updating Mac Software, that is, part of your development workflow overwrites a signed file in situ. That doc has advice on how to further debug this. Find the part of your workflow that’s installing librslib_debug.dylib in /usr/local/lib/ and ensure that it creates a new file rather than overwriting an the existing file. If it doesn’t, change your installation process. In many cases this is as simple as switching from cp to ditto.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"