[Big Sur] /usr/lib/libobjc.A.dylib: Cannot load Swift type information

We are having a problem when we try to assign a nil value to a
Code Block
@objc dynamic lazy
property ... The log shows this:


Code Block
/usr/lib/libobjc.A.dylib: Cannot load Swift type information; failed to initialize ClangImporter: error: invalid Darwin version number: macosx11.0.0
error: invalid version number in '--target = x86_64-apple-macosx11.0.0'

It usually occurs when we try to assign a nil value to a @objc dynamic lazy property. (only in Big Sur beta 5 or higher)

In our tearDown() logic, we manually clear references.
Code Block
...
// Clear strong references to objects in other MOC's
result = nil


Code Block Swift
// declared property that stores some coredata objects.
@objc dynamic lazy var result: Result? = {[weak self] in


I found this observation in the release notes:
https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11-beta-release-notes

Known Issues
...

New in macOS Big Sur 11 beta, the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem. Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail. Instead, check for library presence by attempting to dlopen () the path, which will correctly check for the library in the cache. (62986286)


...

This problem causes an application crash.

Is this a mistake?

Will it be available in future versions?
Will it get replaced by an alternative?

Thx in advance!

P.s.
Out of curiosity, I didn't find the /usr/lib/libobjc.A.dylib library available in Big Sur anymore, but it is present in Catalina.

tumbleweed.....

I can address this part immediately:

I didn't find the /usr/lib/libobjc.A.dylib library available in Big Sur anymore, but it is present in Catalina.

Right. This is a result of the dynamic linker shared cache change that was described in the release notes. See this post for more. Also, you might want to read through An Apple Library Primer, which defines much of the terminology that I use.

I can also speak to this:

The log shows this:

/usr/lib/libobjc.A.dylib: Cannot load Swift type information; failed to initialize ClangImporter: error: invalid Darwin version number: macosx11.0.0
error: invalid version number in '--target = x86_64-apple-macosx11.0.0'

AFAICT this is a compile- or debug-time issue, not a runtime one. I’d be very surprised if this triggered a crash.


gairmuse, Your comments suggest that you are having a similar problem but didn’t provide any detail about that problem. A lot has changed in the 2 years since douglasddf’s original post. I’d love to see more details about the issue you’re seeing.

Share and Enjoy

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

[Big Sur] /usr/lib/libobjc.A.dylib: Cannot load Swift type information
 
 
Q