Apple notarisation process - LC_VERSION_MIN_MACOSX

Ken Cunningham ken.cunningham.webuse at gmail.com
Sat Mar 6 16:56:34 UTC 2021


Both versions of the load command are still in use.

The cutoff for which load command gets used appears to be based on the deployment target that has been set. The clang driver (and ld64) then uses the right one, depending on that.

A deployment target of 10.14+ will set LC_BUILD_VERSION.
A deployment target of 10.13 or less will set LC_VERSION_MIN_MACOSX.

I would imagine that the App store might use the same criteria for examining your submission, and enforce those rules.

So (inference) if you are building something using MacPorts on a newer system to have a deployment target that is older (for this issue, 10.13 or less) you need to set that deployment target for everything you would use.

MacPorts does allow you to do that, setting an older deployment target, in macports.conf. And then yes, you would have to build everything from source to have that set correctly. Probably best to have a separate macports installation in a different prefix for that.

Please ask further if you have any other questions about this.

Best,

Ken





Evidence:

% cat libweakfunc.c
#include <stdio.h>

void
weakfunc(void)
{
    puts("I am a weak function. ");
}


11.2:
% clang -mmacosx-version-min=11.2 -dynamiclib libweakfunc.c -o libweakfunc.dylib
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_BUILD_VERSION    
 cmdsize 24
    uuid 9B13A902-DABE-3376-B6F0-CF3049B0A66C
Load command 9
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform 1
    minos 11.2
      sdk 10.15.6
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_VERSION_MIN_MACOSX


10.14:
% clang -mmacosx-version-min=10.14 -dynamiclib libweakfunc.c -o libweakfunc.dylib
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_BUILD_VERSION                   
 cmdsize 24
    uuid 46E2E497-E5CC-3254-8B2F-56A355EE8BBD
Load command 8
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform 1
    minos 10.14
      sdk 10.15.6
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_VERSION_MIN_MACOSX  


10.13:
% clang -mmacosx-version-min=10.13 -dynamiclib libweakfunc.c -o libweakfunc.dylib
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_BUILD_VERSION                   
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_VERSION_MIN_MACOSX              
 cmdsize 24
    uuid 070BAEA2-4139-31F8-8A56-762F0E6122E2
Load command 8
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.13
      sdk 10.15.6
Load command 9


10.6:
% clang -mmacosx-version-min=10.6 -dynamiclib libweakfunc.c -o libweakfunc.dylib
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_BUILD_VERSION                  
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_VERSION_MIN_MACOSX             
 cmdsize 24
    uuid 9FB0F27C-55C3-3E76-87B4-FBDABDDFA38E
Load command 8
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.6
      sdk 10.15.6
Load command 9


and testing just MACOSX_DEPLOYMENT_TARGET without setting the command line parameter:

% export MACOSX_DEPLOYMENT_TARGET=10.13
% clang -dynamiclib libweakfunc.c -o libweakfunc.dylib 
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_BUILD_VERSION     
% otool -l libweakfunc.dylib | grep -A 4 -B 3 LC_VERSION_MIN_MACOSX
 cmdsize 24
    uuid 070BAEA2-4139-31F8-8A56-762F0E6122E2
Load command 8
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.13
      sdk 10.15.6
Load command 9




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20210306/8867f9dd/attachment.htm>


More information about the macports-users mailing list