Recent

Author Topic: User reports app will not run on 10.13.6 (updated info!)  (Read 6879 times)

MISV

  • Hero Member
  • *****
  • Posts: 783
User reports app will not run on 10.13.6 (updated info!)
« on: February 05, 2019, 09:49:31 am »
I am using a few days old Lazarus/Cocoa/FPC setup for compiling my Mac apps:
  • FPC 3.0.4
  • Lazarus IDE v2.1.0 r602244m
  • My apps are signed+ 64bit / "x86_64-darwin" / "x86_64-darwin-cocoa (alpha)"
 
The app works fine when I download from my own website on my Mac - I have tried versions 1.14.1 + 1.14.3

...

However, a user just using High Sierra 10.13.6 reported to me he gets this error:

Quote
xxx cannot be opened because of a problem

Check with the developer to make sure xxx works with this version of macOS. You may need to reinstall the application. Be sure to install any available updates for the application and macOS

with error.log stating this:

Quote
Process:               MyProgram [32151]
Path:                  /Applications/MyProgram.app/Contents/MacOS/MyProgram
Identifier:            com.MyCompany.MyProgram
Version:               1.0 (1)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           MyProgram [32151]
User ID:               501

Date/Time:             2019-02-05 08:59:18.475 +0000
OS Version:            Mac OS X 10.13.6 (17G4015)
Report Version:        12

Time Awake Since Boot: 1200000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x4] Symbol missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Symbol not found: __objc_empty_cache
  Referenced from: /Applications/MyProgram.app/Contents/MacOS/MyProgram
  Expected in: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 in /Applications/MyProgram.app/Contents/MacOS/MyProgram

...

I have attached two screenshots of his system which he has emailed.

...

In my "Project settings" I have set the following:

Compiler options > Custom options:

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

Customer reports that there is no difference on ability run apps compiled with/without the above.

Still - the only explanation possible seems to be an issue with backwards compability with "old" Mac OS system?

Maybe this could be related

https://github.com/graemeg/freepascal/commit/3af49fe90ac3b4c631a115bbb5a631c27756daf5

?
« Last Edit: February 05, 2019, 09:10:39 pm by MISV »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #1 on: February 05, 2019, 07:57:24 pm »
What happens if you use -WM10.6 instead of -WM10.06?

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #2 on: February 05, 2019, 09:13:09 pm »
Sorry, I THINK was already using "-VM10.6" - not "-VM10.06" :)

I can not see it now for sure since I have removed the code.

But when I post here, I sit at my Windows computer typing while looking at my Mac computer, so typos sometimes happen :(
« Last Edit: February 06, 2019, 01:42:59 pm by MISV »

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #3 on: February 05, 2019, 09:23:18 pm »
what do you have set in your info.plist file?

have you set a minimum version in there?
ie for last snowleopard 32bit 10.6.8
if its a cocoa 64bit app then you may want to increase the value.

<key>LSMinimumSystemVersion</key>
<string>10.6.8</string>
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #4 on: February 05, 2019, 09:29:27 pm »
The info.plist file is just to show a nice error message in case someone starts the application on a lower Mac OS X version than what you specify there.

What does this show: xcrun nm -nm Application.app/Contents/MacOS/NameOfApplication |grep _objc_empty_cache

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #5 on: February 05, 2019, 10:25:19 pm »
The info.plist file is just to show a nice error message in case someone starts the application on a lower Mac OS X version than what you specify there.

What does this show: xcrun nm -nm Application.app/Contents/MacOS/NameOfApplication |grep _objc_empty_cache

For executable compiled both with and without

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

(I had an old compiled release built using my old setup with the above)

I get back this:

Quote
(undefined) external __objc_empty_cache (from CoreFoundation)
« Last Edit: February 06, 2019, 01:31:14 pm by MISV »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #6 on: February 05, 2019, 10:29:52 pm »
On macOS versions before 10.14, that symbol is in libobjc rather than in CoreFoundation. Maybe the linker will use that version of the symbol if you compile against the SDK instead of against the system libraries. Does adding the following to the custom options help?
Code: [Select]
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #7 on: February 05, 2019, 10:30:47 pm »
And if that does not help, you could try adding {$linklib objc} to your program.

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #8 on: February 05, 2019, 10:49:53 pm »
And if that does not help, you could try adding {$linklib objc} to your program.

I tried this first adding
Code: Pascal  [Select][+][-]
  1. {$linklib objc}
into my .dpr file

This gives...

Quote
(undefined) external __objc_empty_cache (from libobjc)
« Last Edit: February 06, 2019, 01:47:38 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #9 on: February 05, 2019, 10:56:43 pm »
On macOS versions before 10.14, that symbol is in libobjc rather than in CoreFoundation. Maybe the linker will use that version of the symbol if you compile against the SDK instead of against the system libraries. Does adding the following to the custom options help?
Code: [Select]
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Just to be sure - I tried two different things

A)
 "Project settings | Compiler options | Applications and Overrides" as a custom option:

Code: Pascal  [Select][+][-]
  1. -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Doing that I now have:

Code: Pascal  [Select][+][-]
  1. -O3 -g- -Xs -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

This gives

Quote
(undefined) external __objc_empty_cache (from libobjc)


B)
Simply added
"-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
to
 "Project settings | Compiler options | Custom Options"

This gives

Quote
(undefined) external __objc_empty_cache (from libobjc)
« Last Edit: February 06, 2019, 01:47:22 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #10 on: February 05, 2019, 11:07:06 pm »
Interesting trying to add the following code back into "Project settings - compiler options - custom options":

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

I get build errors:

When exiting the above dialog I get

Quote
Compiler "/Users*myuname/lazaruscocoa64/fpc/bin/x86_64-darwin/fpc.sh" does not support target x86_64-darwin

And when I try to build I get

Quote
Error: ppcx64-M10.6; can't be executed, error message: Failed to execute "ppcx64-M10.6;", error code 127

or

Quote
Error: Error while linking

I think this may be an entirely new separate issue. Anyhow, I do not need 10.6 compability. I really only need to target Yosemite and newer.



That said I will try on fpcupdeluxe stable build... Oh drat... On a completely fresh stable build adding

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

I get this error when trying to build my entire project:

Error: Illegal parameter: WM10.6;

...

For reference: Stable also gives

Quote
(undefined) external __objc_empty_cache (from libobjc)

when

Code: Pascal  [Select][+][-]
  1. {$linklib objc}

into my .dpr file
« Last Edit: February 06, 2019, 01:46:56 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #11 on: February 06, 2019, 01:51:04 pm »
I have just emailed the user who reported the problem a new download - with the libobjc fix.

If it solves the issue - I guess maybe the FPC code be revised to use appropriate system library depending on version.

I will report back
« Last Edit: February 06, 2019, 02:06:56 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #12 on: February 06, 2019, 05:41:25 pm »
User reported the problem as resolved!

So I think this should be reported as a bug somewhere?

But thank you very much!

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #13 on: February 06, 2019, 08:51:55 pm »
I have added the {$linklib objc} to the base unit with Objective-C functionality, so it will be performed automatically in the future. This change will be available in the upcoming FPC 3.2.0

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: User reports app will not run on 10.13.6 (updated info!)
« Reply #14 on: February 06, 2019, 09:12:58 pm »
This change will be available in the upcoming FPC 3.2.0
Off topic but wondering, is there a reasonably solid estimate of when FPC 3.2.0 will be released ?

Thank you.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018