When setting the framework's DYLIB_CURRENT_VERSION
larger than 65535 Xcode emits a warning:
warning build: Truncating -current_version to fit in 32-bit space used by old mach-o format
Why would Xcode want to truncate versions that are larger than 16-bit max if the current version space is defined as 32-bit integer?
Is this a bug or is there some other setting to tweak in order for this warning to go away?
The Xcode version I am using is 14.0.1.
Because those 32 bits are split up:
uint32_t version; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */
That's from a different load command, but all 32-bit version fields in Mach-Os work that way. The highest version that can be represented by these is 65535.255.255
.
Also note that this may be "old" from the perspective of LLVM, but most structs and load commands in Mach-O headers still use 32-bit versions, with no alternative available, including the "current" and "compatibility" versions of dylibs. The only exception seems to be LC_SOURCE_VERSION
/struct source_version_command
, which uses a 64-bit field:
uint64_t version; /* A.B.C.D.E packed as a24.b10.c10.d10.e10 */