Hi there,
so I guess I figured it out...
After understanding more about the build process I figured that there must be some library that exposes itself something like this:
Load command 4
cmd LC_ID_DYLIB
cmdsize 48
name /System/Library/Frameworks/CoreData.framework/CoreData (offset 24)
time stamp 2 Thu Jan 1 01:00:02 197
current version 1775.118.101
compatibility version 300.0.0
After writing some scripts to find and check all the libraries on my system I couldn't find any libraries that advertised itself fitting the above.
What I instead found was the following library:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation.tbd
The library advertised itself like this:
install-name: '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'
current-version: 1775.118.101
compatibility-version: 300
which actually looked fine.
But when I inspected it further one thing caught my eye. There were entries that looked like this:
symbols: [ '$ld$previous$/System/Library/Frameworks/CoreData.framework/CoreData$$1$10.9$999$_NSDetailedErrorsKey$',
So there was a reference to "CoreData.framework" which I was looking for because of the previous findings.
The only references in this file to "CoreData.framework" were to this single NSDetailedErrorsKeys
symbol.
After fiddling around with the build process and getting some more clues, I looked at my code and it actually used NSDetailedErrorsKey
in one place.
When I removed the reference in my code and built the app again I could verify (with otool -L)
that indeed, the none-existing reference to
/System/Library/Frameworks/CoreData.framework/CoreData (compatibility version 300.0.0, current version 1775.118.101)
was gone in the built library. And so were the problems getting the app to work on macOS 10.13.
I'm still not sure why this error occurs, but I'm pretty confident that it has to do with the
symbols: [ '$ld$previous$/System/Library/Frameworks/CoreData.framework/CoreData$$1$10.9$999$_NSDetailedErrorsKey$',
entries inside of the
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation.tbd
file. My thought is that if I use NSDetailedErrorsKey
that it finds it mentioned in this file and creates this hybrid of a version number from the Foundation framework but by the name of the CoreData framework
which results in this linking that is never going to resolve on "normal" systems.
Looking at the file
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreData.framework/Versions/A/CoreData.tbd
I can confirm that the NSDetailedErrorsKey
is also defined as a symbol here (which to me seems to be the correct place since it is a CoreData symbol).
So my guess would be that it is an error that the entries are also present in the Foundation.tbd file. I might file a radar about this issue, if nobody can explain why that is happening.
Another option of preventing this issue from occurring might be to change the order of the included frameworks and/or the search paths so that maybe the system would find the correct CoreData.tbd
file first, which also might get rid of this problem.