Recent

Author Topic: Notarization under macOS Sonoma. TargetOS must be 10.9+  (Read 5655 times)

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 378
Notarization under macOS Sonoma. TargetOS must be 10.9+
« on: September 27, 2023, 05:26:23 pm »
Notarization under macOS Sonoma now requires target for 10.9+

When I tried to notarize my app, I get an error in a log of notarytool:

Quote
"The binary uses an SDK older than the 10.9 SDK."

I used FPC 3.2.2 and Lazarus 2.2

In Custom Options I set
-WM10.9

And then notarization worked fine.

Question:
how to set target OS as a condition? Because I compile this app also for Windows.

Hansaplast

  • Hero Member
  • *****
  • Posts: 689
  • Tweaking4All.com
    • Tweaking4All
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #1 on: September 28, 2023, 09:10:23 am »

Good question!  8)


Additionally;
I'd be interested to know how to build FPC and Lazarus with these conditions to begin with?
(I use FPCUpDeluxe)

TRon

  • Hero Member
  • *****
  • Posts: 3650
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #2 on: September 28, 2023, 09:19:27 am »
It is but a mere compiler switch not ? 

For fpcupdeluxe if you press the button "setup+" a window appears where you can set the compiler options for free pascal and lazarus at section "options override" where you can set FPC options and laz options respectively.

If you cross-build then you can select the target processor and platform. If you select those then the cross build options overrides become available.

That are the two (actually 3, when including Lazarus) locations where it is possible to add the compiler switch.

That is if I understood you correctly.
« Last Edit: September 28, 2023, 09:26:29 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1781
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #3 on: September 28, 2023, 10:19:57 am »
Due to this report, I have changed the minimal version to 10.9 when building for Darwin.
Will be included in next release.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/commit/ec203f49711a6a563c983b08b3e060661f9b97d9

TRon

  • Hero Member
  • *****
  • Posts: 3650
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #4 on: September 28, 2023, 10:34:36 am »
Question: how to set target OS as a condition? Because I compile this app also for Windows.
I am not entirely sure what you meant to ask by asking that question the way you did.

Target OS as a condition ? When you go to your project options you can change the target CPU/OS etc and thus be able to (cross)compile for Windows. If so desired you can create a (individual) build mode for that so that you do not have to select the target settings, but only the buildmode (which has all specifics for that build mode defined but only once).

If it is about making the option -WM10.9 conditional (and optional) then you could opt for:
Menu, Project/Options, Compiler options/Custom Options

In the section Conditionals, just as an example what I could test:
Code: Pascal  [Select][+][-]
  1. if TargetOS='win32'
  2.   then CustomOptions += '-va';
  3.  
I am on Linux. Now whenever I select the target in project options to be win32 (which means cross-compiling in my case) the option -va is added to the compiler options. And for sure i get a whole bunch of output (only) when cross-compiling to win32.

For your -WM options it should probably read something like:
Code: Pascal  [Select][+][-]
  1. if TargetOS='darwin'
  2.   then CustomOptions += '-WM10.9';
  3.  
What (I hope for you) that does is only adding the option -WM if your target is darwin as only there adding the option -WM makes sense. More information on that feature can be read here.

But I have no idea if either of the two answers I mentioned is actually answering your question.
« Last Edit: September 28, 2023, 10:37:00 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Hansaplast

  • Hero Member
  • *****
  • Posts: 689
  • Tweaking4All.com
    • Tweaking4All
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #5 on: September 28, 2023, 11:55:49 am »
Due to this report, I have changed the minimal version to 10.9 when building for Darwin.
Will be included in next release.


That is fantastic! Thanks!!  :)

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 378
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #6 on: September 28, 2023, 05:36:27 pm »
Hi TRon,

Thanks for your reply!

I compile my project on 2 platforms: Windows and Mac.

Of course, I can specity -WM10.9 in Custom Options and it will set TargetOS as macOS 10.9+ that complies notarization service for Apple.
However I'm not sure that having this static option is good when I compile the same project for Windows.

I tried your example for Custom Options:

Code: Pascal  [Select][+][-]
  1. if TargetOS='darwin'
  2.   then CustomOptions += '-WM10.9';


and I get the following error when I try to compile it (on any platform):

Quote
Error: Illegal parameter: -WM10.9;

Probably I'm doing something wrong?

Lazarus 2.2 / FPC 3.2.2

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #7 on: September 28, 2023, 06:48:42 pm »
it used to be
Code: Pascal  [Select][+][-]
  1.     If TargetOS = 'darwin' then
  2.     begin
  3.       UsageCustomOptions += '-WM10.9';
  4.     end;
Although Targeting a 10yr old os may cause problems, i suggest targeting a current supported version -WM11  ( Big Sur).

If you have Project Builds for both Os's  then you can set what ever custom options->All Options scroll down to WM and set what you need, per build
wrks 4 me
« Last Edit: September 28, 2023, 06:51:36 pm by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 378
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #8 on: September 28, 2023, 07:12:58 pm »
it used to be
Code: Pascal  [Select][+][-]
  1.     If TargetOS = 'darwin' then
  2.     begin
  3.       UsageCustomOptions += '-WM10.9';
  4.     end;

Sorry, it doesn't compile on any platform. The same error, as I pointed above.

Although Targeting a 10yr old os may cause problems, i suggest targeting a current supported version -WM11  ( Big Sur).

I offer macOS support 10.13+ High Sierra.
11.0+ Big Sur would be too painful limitation for many users.

I set in info.plist:

Code: Pascal  [Select][+][-]
  1. <key>LSMinimumSystemVersion</key>
  2. <string>10.13.0</string>

If you have Project Builds for both Os's  then you can set what ever custom options->All Options scroll down to WM and set what you need, per build
wrks 4 me
A good idea, but I use 2 Project Builds (release and beta) for both platforms.

Alternative solution. Probably I can set TargetOS for lazbuild in my script?

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #9 on: September 28, 2023, 07:55:16 pm »
i have an app that has builds release,debug,beta and targets win32,win64,cocoa m1, cocoa x64 for each of these, each build has its own custom options etc, and each has its own executeable name, i then can compile all at once with lazarus Run>Build Many Modes.

https://developer.apple.com/documentation/technotes/tn3147-migrating-to-the-latest-notarization-tool
Quote
Enable notarization on an older version of macOS

The first version of Xcode to include notarytool is Xcode 13. It requires macOS 11.3. It is, however, possible to notarize on earlier systems, all the way back to macOS 10.15. To do this, copy notarytool from a system with Xcode or the Command Line Tools package installed, as described in the previous section.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

TRon

  • Hero Member
  • *****
  • Posts: 3650
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #10 on: September 29, 2023, 03:50:04 am »
I tried your example for Custom Options:
...
and I get the following error when I try to compile it (on any platform):

Quote
Error: Illegal parameter: -WM10.9;
That is strange.

Quote
Probably I'm doing something wrong?
I did notice you mentioning Lazarus 2.2 while I tested with Lazarus 2.2.6. I am not aware if there might be something different with regards to Lazarus 2.2.0

Are you sure you got those statements pasted into the memo control named "Conditionals" (and not the memo where it reads "custom options") ?

Other than that it is just a compiler option so Lazarus (or Free Pascal) should not complain about it and just act as you tell it to. That is unless this is not working in the way it is advertised (I am not that versed with Lazarus myself). So the only other possible issue could be that your Lazarus is actually not compiling with Free Pascal 3.2.2 but uses an older version that does not support the WM option (which strikes me as odd).
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

TRon

  • Hero Member
  • *****
  • Posts: 3650
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #11 on: September 29, 2023, 03:52:46 am »
Alternative solution. Probably I can set TargetOS for lazbuild in my script?
Sure, that is not a problem. See the options for lazbuild (--os=XXX, if required --cpu=XXX and also if required --subtarget=XXX).
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #12 on: September 29, 2023, 12:53:48 pm »
i have an app that has builds release,debug,beta and targets win32,win64,cocoa m1, cocoa x64 for each of these, each build has its own custom options etc, and each has its own executeable name, i then can compile all at once with lazarus Run>Build Many Modes.
....
Interesting. On what platform do you run that "Build Many Modes"  ?
I normally build my MacOS release on a very old Sierra machine, but a user wants a "Cocoa m1" build, my hardware is too old. If you can cross compile TO macOS m1 from Windows or Linux I'd like to hear about your setup. Please !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 378
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #13 on: September 29, 2023, 02:48:39 pm »
TRon,

I found a reason why I couldn't compile a project with Custom Options. This code doesn't compile:

Code: Pascal  [Select][+][-]
  1. If TargetOS = 'darwin' then
  2. begin
  3.   UsageCustomOptions += '-WM10.9';
  4. end;

and this code works fine:

Code: Pascal  [Select][+][-]
  1. If TargetOS = 'darwin' then
  2. begin
  3.   UsageCustomOptions += ' -WM10.9';
  4. end;

It necessary to add a space between a quote and minus.

However I get the following warnings (I checked on Windows):

Quote
Компиляция проекта, режим: Default, цель: TestProject.exe: Успешно, предупреждений: 10
Warning: Only one source file supported, changing source file to compile from "If" into "TargetOS"
Warning: Only one source file supported, changing source file to compile from "TargetOS" into "="
Warning: Only one source file supported, changing source file to compile from "=" into "darwin"
Warning: Only one source file supported, changing source file to compile from "darwin" into "then"
Warning: Only one source file supported, changing source file to compile from "then" into "begin"
Warning: Only one source file supported, changing source file to compile from "begin" into "UsageCustomOptions"
Warning: Only one source file supported, changing source file to compile from "UsageCustomOptions" into "+="
Warning: Only one source file supported, changing source file to compile from "+=" into " -WM10.9;"
Warning: Only one source file supported, changing source file to compile from " -WM10.9;" into "end;"
Warning: Only one source file supported, changing source file to compile from "end;" into "TestProject.dpr"

Thanks for the hint with lazbuild target OS.
« Last Edit: September 29, 2023, 02:55:58 pm by Igor Kokarev »

TRon

  • Hero Member
  • *****
  • Posts: 3650
Re: Notarization under macOS Sonoma. TargetOS must be 10.9+
« Reply #14 on: September 29, 2023, 11:10:27 pm »
@Igor Kokarev:
I am so confused about that you have to use UsageCustomOptions, then the need to use a space and finally the output that you showed seem to indicate that something goes horribly wrong.

In case there is someone around that has more knowledge on that then please do try and chime in.

Can you at least confirm that you are using Lazarus version 2.2.0 (the last revision number matters) with Free Pascal 3.2.2 ?
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

 

TinyPortal © 2005-2018