Recent

Author Topic: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?  (Read 11490 times)

MISV

  • Hero Member
  • *****
  • Posts: 783
I have a OSX Yosemite user who reported this error to me:

Quote
You can't use this version of the application "Example.app" with this version of OS X.

You have OSX 10.10.5. The application requires OS X 10.13 or later.

...

I am building with this setup:
  • Lazarus 2.1.0, Date 2019-1-29, FPC version 3.0.4, SVN Revision: 60244M, x86_64-darwin-cocoa (alpha)
  • macOS Mojave 10.14.3

...

In "Project - Project Options" I have done the following the all "Bulid modes":

Added the following to "Compiler Options - Custom options"

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

...

Searching for an explanation (across all development tools) gave results like this


...

Can anyone duplicate this problem when buildin apps on newer macOS/Lazarus versions - and then try run them on old macOS versions?

Since my current "Custom Options" solution is not working - could I try something different along the lines of the SO post?

I am actually happy targeting just 10.10+ (but if possible to target 10.6+ or 10.7+ great!)
« Last Edit: February 27, 2019, 09:59:50 pm by MISV »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
I wonder if you also need to have the older SDK installed with your xcode

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
You don't need the older SDK.

Can you go To Project -> Project Options and then click on the "Show Options" button at the bottom to ensure the -WM10.6 is passed to the compiler?

Additionally, the dialog box you get from the Finder actually comes from the Info.plist included in the application bundle. Your application probably contains this inside the Info.plist:
Code: [Select]
        <key>LSMinimumSystemVersion</key>
        <string>10.13</string>

Try changing that to 10.10 (or 10.6).

MISV

  • Hero Member
  • *****
  • Posts: 783
Additionally, the dialog box you get from the Finder actually comes from the Info.plist

That was my first thought as well - but my app does not contain any LSMinimumSystemVersion in its plist file



Can you go To Project -> Project Options and then click on the "Show Options" button at the bottom

Here is what I have in "Show options ->  Command line parameters"

Code: Pascal  [Select][+][-]
  1. /Users/myname/MN/lazaruscoc64bit/fpc/bin/x86_64-darwin/fpc.sh
  2. -MObjFPC
  3. -Scghi
  4. -CX
  5. -O3
  6. -Xs
  7. -XX
  8. -k-framework
  9. -kCocoa
  10. -l
  11. -vewnhibq
  12. -Fi/Volumes/DiskW/myprojects/myprogram/lib/x86_64-darwin
  13. -Fi/Volumes/DiskW/shared-code/mylibrary
  14. -Fu/Volumes/DiskW/shared-code/mylibrary
  15. -Fu/Volumes/DiskW/shared-code/mylibrary/lib/x86_64-darwin
  16. -Fu/Users/myname/MN/lazarus-components-cocoa64bit/VirtualTreeView-Lazarus-v5/Source/lib/x86_64-darwin-cocoa
  17. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/turbopower_ipro/units/x86_64-darwin/cocoa
  18. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa
  19. -Fu/Users/myname/MN/lazarus-components-cocoa64bit/Indy10/Lib/lib/x86_64-darwin
  20. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/printers/lib/x86_64-darwin/cocoa
  21. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/ideintf/units/x86_64-darwin/cocoa
  22. -Fu/Users/myname/MN/lazarus-components-cocoa64bit/lclextensions-0/lib/x86_64-darwin-cocoa
  23. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/lazcontrols/lib/x86_64-darwin/cocoa
  24. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/cairocanvas/lib/x86_64-darwin/cocoa
  25. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin/cocoa
  26. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin
  27. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/lazutils/lib/x86_64-darwin
  28. -Fu/Users/myname/MN/lazaruscoc64bit/lazarus/packager/units/x86_64-darwin
  29. -Fu/Volumes/DiskW/myprojects/myprogram/
  30. -FU/Volumes/DiskW/myprojects/myprogram/lib/x86_64-darwin/
  31. -FE/Volumes/DiskW/myprojects/myprogram/compiled/myprogname.app/Contents/MacOS/
  32. -o/Volumes/DiskW/myprojects/myprogram/compiled/myprogname.app/Contents/MacOS/myprogname
  33. -Ur
  34. -dLCL
  35. -dLCLcocoa
  36. if
  37. TargetOS
  38. =
  39. darwin
  40. then
  41. begin
  42. UsageCustomOptions
  43. +=
  44.  -WM10.6;
  45. end
  46. ;
  47. -O3
  48. -g-
  49. -Xs
  50.  


Maybe I should try dump all the code in "custom options" and simply write "-WM10.6"

I have a separate project files for my Mac versions anyhow and I know I will be using Cocoa 64bit

Maybe worth a try?
« Last Edit: February 27, 2019, 03:31:21 pm by MISV »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Additionally, the dialog box you get from the Finder actually comes from the Info.plist

That was my first thought as well - but my app does not contain any LSMinimumSystemVersion in its plist file

Try adding it.

MISV

  • Hero Member
  • *****
  • Posts: 783
I will. However, I think I have found two bugs in Lazarus/FPC

But essentially using

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

does not seem to work correctly and instead the entire code is added to parameters when using the "Show options" button.

And if I in custom options instead add

Code: Pascal  [Select][+][-]
  1. -WM10.6

I get linker error

...

But when I get the above working, I will send the user a new version with the above fixed? + with info.plist file defining LSMinimumSystemVersion
« Last Edit: February 27, 2019, 09:42:38 pm by MISV »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
First of all, make sure you're using -WM10.6 and not -VM10.6

Additionally, there's a bug in current Lazarus versions that makes it not show all linker errors. Try executing the compilation command from a terminal window to see what the linker error is.

MISV

  • Hero Member
  • *****
  • Posts: 783
First of all, make sure you're using -WM10.6 and not -VM10.6

Roger. I am typing this in on Windows while looking on my Mac so easy to make typo errors

I am using
Code: Pascal  [Select][+][-]
  1. -WM10.6

Additionally, there's a bug in current Lazarus versions that makes it not show all linker errors.
Try executing the compilation command from a terminal window to see what the linker error is.

Will try

MISV

  • Hero Member
  • *****
  • Posts: 783
It seems I am having problems using the compiler from command line. I am essentially copy and pasting what I see in "Show options" (without any of the checkboxes checked):

Here *with* linebreaks:

Code: [Select]
/Users/myname/MN/lazaruscoc64bit/fpc/bin/x86_64-darwin/fpc.sh
-MObjFPC
-Scghi
-CX
-O3
-Xs
-XX
-k-framework
-kCocoa
-l
-vewnhibq
-Fi/Volumes/DiskW/myprojects/myprogram/lib/x86_64-darwin
-Fi/Volumes/DiskW/shared-code/mylibrary
-Fu/Volumes/DiskW/shared-code/mylibrary
-Fu/Volumes/DiskW/shared-code/mylibrary/lib/x86_64-darwin
-Fu/Users/myname/MN/lazarus-components-cocoa64bit/VirtualTreeView-Lazarus-v5/Source/lib/x86_64-darwin-cocoa
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/turbopower_ipro/units/x86_64-darwin/cocoa
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa
-Fu/Users/myname/MN/lazarus-components-cocoa64bit/Indy10/Lib/lib/x86_64-darwin
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/printers/lib/x86_64-darwin/cocoa
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/ideintf/units/x86_64-darwin/cocoa
-Fu/Users/myname/MN/lazarus-components-cocoa64bit/lclextensions-0/lib/x86_64-darwin-cocoa
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/lazcontrols/lib/x86_64-darwin/cocoa
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/cairocanvas/lib/x86_64-darwin/cocoa
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin/cocoa
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/components/lazutils/lib/x86_64-darwin
-Fu/Users/myname/MN/lazaruscoc64bit/lazarus/packager/units/x86_64-darwin
-Fu/Volumes/DiskW/myprojects/myprogram/
-FU/Volumes/DiskW/myprojects/myprogram/lib/x86_64-darwin/
-FE/Volumes/DiskW/myprojects/myprogram/compiled/myprogname.app/Contents/MacOS/
-o/Volumes/DiskW/myprojects/myprogram/compiled/myprogname.app/Contents/MacOS/myprogname
-Ur
-dLCL
-dLCLcocoa
-WM10.6
-O3
-g-
-Xs

This results in

Quote
Hint: (11030) Start of reading config file /Users/myname/MN/lazaruscoc64bit/fpc/bin/x86_64-darwin/fpc.cfg
Hint: (11031) End of reading config file /Users/myname/MN/lazaruscoc64bit/fpc/bin/x86_64-darwin/fpc.cfg
Free Pascal Compiler version 3.0.4-r37149 [2019/01/29] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Fatal: (11004) No source file name in command line
Fatal: (1018) Compilation aborted
Error: /Users/myname/MN/lazaruscoc64bit/fpc/bin/x86_64-darwin/ppcx64 returned an error exitcode


Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Try adding the main source file of your project (probably xxx.lpr) at the end of the command line (including its full path).
« Last Edit: February 27, 2019, 10:04:15 pm by Jonas Maebe »

MISV

  • Hero Member
  • *****
  • Posts: 783
Try adding the main source file of your project (probably xxx.lpr) at the end of the command line (including its full path).

So if I try add /Volumes/DiskW/myprojects/myprogram/MyMainLazarusOSX.dpr I get this:

Quote
ld: file not found: /usr/lib/crt1.10.6
An error ocurred while linking

« Last Edit: February 27, 2019, 10:18:07 pm by MISV »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Did you run the FPC 3.0.4a installer after upgrading to macOS 10.14? macOS 10.14 requires changes to fpc.cfg, which are performed by the FPC 3.0.4a installer when installing on that OS version (note that the compiler version will still be 3.0.4, as the compiler binary in the 3.0.4a package has not changed).

MISV

  • Hero Member
  • *****
  • Posts: 783
Quote
Did you run the FPC 3.0.4a installer after upgrading to macOS 10.14?

I use FPCUpDeluxe to install my Lazarus/FPC combos ...

But I installed Lazarus/FPC more recently than since I updated to 10.14 / Mojave. (However, currently version is now 10.14.3)

...

Is there documentation anywhere how I should fix fpc.cfg?
And is this an issue that should be reported to FPCUpDeluxe?

...

By he way: I have no idea if the following is permissable/will-work-correctly (?) with FPC, but If try to instead use

Code: Pascal  [Select][+][-]
  1. -WM10.8

it seems to compile ... But with many warnings with main two types being:

1)
about different libraries
Quote
was built for newer OSX version (10.13) than being linked (10.8 )

2)
about dylib
Quote
warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libiconv.dylib) built for (unknown). Note: This will be an error in he future.
« Last Edit: February 27, 2019, 10:28:03 pm by MISV »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Quote
Did you run the FPC 3.0.4a installer after upgrading to macOS 10.14?

I use FPCUpDeluxe to install my Lazarus/FPC combos ...
Apple likes to change everything around every blue moon. I try to keep up with that in the official FPC installers, but other tools may not do so. It _is_ a pain.

Quote
But I installed Lazarus/FPC more recently than since I updated to 10.14 / Mojave. (However, currently version is now 10.14.3)
The only thing that matters is what I asked: did you install FPC using the FPC 3.0.4a installer since you updated to macOS 10.14? If not, please do so.

Quote
Is there documentation anywhere how I should fix fpc.cfg?
No.

Quote
And is this an issue that should be reported to FPCUpDeluxe?
I don't know. It depends on whether they want to support only building a new FPC version, or also completely configuring it.

Quote
I have no idea if the following is permissable/will-work-correctly (?), but If try to instead use

Code: Pascal  [Select]
-WM10.8
That is fine if you only want to support 10.8 and later. That version indeed does not require a custom crt*.o file.

Quote
it seems to compile ... But with many warnings with main two types being:

1)
about different libraries
Quote
was built for newer OSX version (10.13) than being linked (10.8 )
Please quote the exact errors, because a lot depends on which files these warnings are about.

Quote
2)
about dylib
Quote
warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libiconv.dylib) built for (unknown). Note: This will be an error in he future.
That is again because you have not used the FPC 3.0.4a installer to update your fpc.cfg for macOS 10.14
« Last Edit: February 27, 2019, 10:36:45 pm by Jonas Maebe »

MISV

  • Hero Member
  • *****
  • Posts: 783
Okay - I just ran fpc-3.0.4a.intel-macosx.pkg

Using the command line from before I get the same error as before. (crt1.10.6.o not found)

... However, I suppose that is because the command line I use point to the FPC installed by fpcupdeluxe ... (the fpc.sh file it uses points it to its own fpc.cfg file)

I don't know where installer put FPC, but sofar I can see:

lib part placed at /usr/local/lib/fpc/3.0.4
doc part placed at /usr/local/share/doc/fpc-3.0.4
source demos placed at /usr/local/share/src/fpc-3.0.4/demo

there appears to be
compiler /usr/local/bin/fpc

...

If I understand you correctly - 3.0.4a and 3.0.4 difference is the fpc.cfg file....?

However searching my Mac for fpc.cfg does not reveal its location

Somehow I feel that I should be able to locate fpc.cfg search "my mac" and "usr"... I need to get some sleep - maybe that will help :)

...

Just for reference - Jonas Maebe in a later post explains where to find fpc.cfg:

Quote
fpc.cfg is in /etc/fpc.cfg (/etc is the default directory for global configuration files on Unix-like systems).
Quote
« Last Edit: February 28, 2019, 04:26:49 pm by MISV »

 

TinyPortal © 2005-2018