Recent

Author Topic: How to get OSX App to work previous OSX Versions  (Read 2626 times)

josh

  • Hero Member
  • *****
  • Posts: 746
How to get OSX App to work previous OSX Versions
« on: November 12, 2018, 06:49:47 pm »
Hi

Hopefully i am just missing something..

Using Laz 2.1.0 59397, fpc 3.3.1 (carbon ide)

I created a simple test app, that has just a few buttons on, Set for Carbon i386, and have "-macosx_version_min 10.6" set in project options/compilation and linking.
I created the application bundle, i then transferred the executable to MacOS folder in the bundle removing the symlink.
I would have thought this would allow it to run on 10.6 and above.

If I run this on my High Sierra ( the one its compiled on) it works, if I run it on Mojave it works, If I run in Sierra I get error "this app requires Mac OS 10.13.6 or later".

Any ideas as to what I am missing.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 640
Re: How to get OSX App to work previous OSX Versions
« Reply #1 on: November 12, 2018, 08:38:27 pm »
Use the compiler option -WM10.6, and remove the linker option.

josh

  • Hero Member
  • *****
  • Posts: 746
Re: How to get OSX App to work previous OSX Versions
« Reply #2 on: November 12, 2018, 10:35:36 pm »
Hi Jonas,

I have updated laz and fpc to latest trunk 59528.
When I go Project/Options/Custom Options then Click All Options, I can scroll down the list and put the value 10.6 in the box. Click OK; but nothing is added to the list of options.
I tried doing the same on Latest Trunk on windows with OSX Cross Compiler, and the same project; when I change the value the compiler otion -WM10.6 is added to the list.
Is there a bug in the latest Trunk Custom Compiler Options?
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

MISV

  • Hero Member
  • *****
  • Posts: 586
Re: How to get OSX App to work previous OSX Versions
« Reply #3 on: November 24, 2018, 04:45:22 pm »
Did you successfully solve this? I always assumed my app would work on all recent versions - I guess not

josh

  • Hero Member
  • *****
  • Posts: 746
Re: How to get OSX App to work previous OSX Versions
« Reply #4 on: November 24, 2018, 09:49:25 pm »
Hi

I added the below code into custom compiler options ( Project->Options->Compiler Options->Custom Options )

Code: [Select]
if TargetOS = 'darwin' then
begin
  UsageCustomOptions += ' -WM10.6';
end;                               
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

MISV

  • Hero Member
  • *****
  • Posts: 586
Re: How to get OSX App to work previous OSX Versions
« Reply #5 on: November 27, 2018, 12:36:44 am »
Thank you - I better do this as well then. I am really surprised it is necessary. I always tagged my downloads as being Yosemite+ (10.10) compatible

VTwin

  • Hero Member
  • *****
  • Posts: 688
  • Former Turbo Pascal 3 user
Re: How to get OSX App to work previous OSX Versions
« Reply #6 on: November 27, 2018, 01:09:52 am »
Thanks. Apparently this changed as of FPC 2.6.2. I just updated my projects:

Code: Pascal  [Select]
  1. if TargetOS = 'darwin' then begin
  2.   //UsageCustomOptions += ' -k-macosx_version_min -k10.5';
  3.   //UsageCustomOptions += ' -XR/Developer/SDKs/MacOSX10.5.sdk/';
  4.   UsageCustomOptions += ' -WM10.6';
  5. end;

Cheers,
VTwin
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61523M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

CCRDude

  • Sr. Member
  • ****
  • Posts: 491
Re: How to get OSX App to work previous OSX Versions
« Reply #7 on: December 20, 2018, 12:23:04 pm »
I'm fighting a similar thing currently. Got the latest FreePascal/Lazarus trunk/trunk checked out this morning using fpcupdeluxe, but this has happened for weeks now. I've got those UsageCustomOptions in place.

When I let the Lazarus UI create the .app bundle folder for my binary, macOS tells me the app would be designed for 10.14, while I only run 10.13.6. If I run the executable directly, it works fine.
This is even valid for the Lazarus.app created by fpcupdeluxe.

It's getting spooky... I copied an older app bundle and modified it completely for the app I was testing. Adjusted icon, Info.plist entries, etc.. Runs fine - until I rename it, or compress/decompress it, then macOS again tells me it's incompatible. Same message appears on other Macs, so it's not strictly a local curiosity. A simple "touch" to the .app and the Info.plist renders the bundle incompatible.

Has anyone experienced similar (including Lazarus.app and stock created new app bundles not working)? Any workaround?

VTwin

  • Hero Member
  • *****
  • Posts: 688
  • Former Turbo Pascal 3 user
Re: How to get OSX App to work previous OSX Versions
« Reply #8 on: December 28, 2018, 05:52:26 am »
When I let the Lazarus UI create the .app bundle folder for my binary, macOS tells me the app would be designed for 10.14, while I only run 10.13.6. If I run the executable directly, it works fine.

Strange. I don't know the answer, but have you looked at the info.plist LSMinimumSystemVersion entry in your application bundle? Mine shows:

Code: Pascal  [Select]
  1. <key>LSMinimumSystemVersion</key>
  2.   <string>10.5.0</string>


What value do you see?
« Last Edit: December 28, 2018, 05:54:37 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61523M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

CCRDude

  • Sr. Member
  • ****
  • Posts: 491
Re: How to get OSX App to work previous OSX Versions
« Reply #9 on: January 07, 2019, 08:01:32 pm »
My apologies for the late reply, I didn't work between the years.

My actual setting was:
Code: XML  [Select]
  1.     <key>LSMinimumSystemVersion</key>
  2.     <string>10.12.6</string>

I have tried with 10.5.0 as well, and without a minimum system version. Since I run 10.13.6, both should work.

I've been browsing /var/log/ to see if I can find anything logged about this, but did not find anything.

If no one else is experiencing this issue (should be quite visible, since here it even affects Lazarus.app), it's most likely some local problem on my Mac. But it only happens with Lazarus apps.