...
BugZero found this defect 2712 days ago.
$ ./mongod dyld: malformed mach-o: load commands size (35872) > 32768 Abort trap: 6 The output of dyldinfo -dylibs ./mongod is about 32 K, supporting the notion that we may have too many libraries, or libraries with path names that are too long, to produce a valid executable.
xgen-internal-githook commented on Thu, 17 Dec 2020 16:32:48 +0000: Author: {'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'} Message: SERVER-30955 Disable macOS dynamic builds Branch: master https://github.com/mongodb/mongo/commit/859b72ae51e1c1cce996a4afe86ee3951500e55d jesse commented on Wed, 16 Dec 2020 14:42:34 +0000: I propose we disable the failing builders until this is fixed, to save people the effort of investigating the failure and discovering this ticket over and over. acm commented on Sun, 12 Jul 2020 18:06:55 +0000: Another wrinkle for this ticket: it appears that the load commands size of 32768 is only one constraint we must satisfy. Interstingly, hygienic builds has moved us in the right direction on this, however, there is another constraint, as revealed by running on master: ./build/install/bin/mongod dyld: Library not loaded: @rpath/libmongod_initializers.dylib Referenced from: build/install/lib/libmongod_main.dylib Reason: no suitable image found. Did find: build/install/lib/../lib/libmongod_initializers.dylib: too many dependent dylibs in build/install/lib/../lib/libmongod_initializers.dylib build/install/lib/../lib/libmongod_initializers.dylib: stat() failed with errno=1 build/install/bin/../lib/libmongod_initializers.dylib: too many dependent dylibs in build/install/bin/../lib/libmongod_initializers.dylib [1] 29234 abort ./build/install/bin/mongod It appears that there is hard-coded upper bound of 512 dynamic dependencies. Look for too many dependent dylibs in https://opensource.apple.com/source/dyld/dyld-733.6/src/ImageLoader.cpp.auto.html. If we look at libmongod_initializers.dylib we see that we currently have 530: $ otool -l /build/install/lib/../lib/libmongod_initializers.dylib | grep cmdsize | wc -l 530 So, we may not actually be able to solve this problem until we simplify the link graph, or are able to move many more libraries to LIBDEPS_PRIVATE. acm commented on Sat, 11 Jul 2020 22:46:27 +0000: I wasn't sure before how to get an accurate measure of the load commands, but I came up with one today: $ python3 buildscripts/scons.py --variables-files=etc/scons/xcode_macosx.vars --link-model=dynamic --build-fast-and-loose --implicit-cache --opt=on --dbg=on --cache ./mongod --install-mode=legacy $ otool -l mongod | grep cmdsize | awk '{ sum+=$2} END { print sum }' 44640 $ ./mongod dyld: malformed mach-o: load commands size (44640) > 32768 [1] 7244 abort ./mongod
Build on OS X with --link-model=dynamic.