I work for MongoDB and our app builds many dylibs. Recently we have reached a number of dylibs which is causing problems. Apparently no more than 512 dylibs are allowed to be loaded. I can not find any documentation on this. I found in the old source code a reference to this: https://opensource.apple.com/source/dyld/dyld-852.2/src/ImageLoader.cpp.auto.html
if ( libCount > 512 ) dyld::throwf("too many dependent dylibs in %s", path);
Does anyone know why this is and what versions of OSX (or dyld) have this limitation? Where is this documented?
Does anyone know why this is
The dynamic linker has a long and complex history and it’s not unusal to encounter limitations like this. I expect the person who wrote that code thought “Why would anyone need more than this?”
what versions of OSX (or dyld) have this limitation?
That version of the code corresponds (roughly) to macOS 11. The dynamic linker in macOS 12 does not have this limit. Looking backwards, I see the same check in macOS 10.14, which is as far back as I care to check.
Where is this documented?
AFAIK it’s not.
Having said that, this is way too many dependencies. Every one is costing you in terms of memory and load time. I strongly encourage you to merge some of these libraries.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"