Hardening app results in error: Could not load objc_allocateClassPair from libobjc.dylib

Using Xojo2019R1.1 in Mojave. Running the app in the IDE gives no errors, nor does running a codesigned build. But when I add hardening to the build step, when the app is run I get an error when I try to open a window with a listbox: Could not load objc_allocateClassPair from libobjc.dylib. The error occurs in the XScrollView.Constructor.

Here’s the trace leading up to the error:



Any idea what’s going on and how to avoid this?

What does the declare look like for objc_allocateClassPair in XScrollView.Constructor?

If the lib is set to “libobjc.dylib” try “Cocoa.Framework” instead.

Yes, it was “libobjc.dylib”. I’ll change that, thanks!

I had a reference to “libobjc.dylib” which caused the same problem but I changed it to “/usr/lib/libobjc.dylib” and it all worked.

What is the correct way to reference it?

An absolute or relative path to the Mach-O executable. In the case of system libraries, it should be absolute “/usr/lib/libobjc.dylib”, for a bundled executable it should be relative, based upon the main executable.

Pretty sure I got it off you in the first place while doing Metal.

Sorry about that.

No, I got the “/usr/lib/libobjc.dylib” version off you.

Edit: also this quotes my clipboard!