Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: MISV on February 27, 2019, 02:59:43 am

Title: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 02:59:43 am
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:

...

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!)
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: skalogryz on February 27, 2019, 04:22:42 am
I wonder if you also need to have the older SDK installed with your xcode
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 27, 2019, 08:26:23 am
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).
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 03:28:13 pm
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?
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 27, 2019, 06:50:16 pm
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.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 09:32:24 pm
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
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 27, 2019, 09:34:14 pm
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.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 09:39:01 pm
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
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 09:58:36 pm
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

Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 27, 2019, 09:59:37 pm
Try adding the main source file of your project (probably xxx.lpr) at the end of the command line (including its full path).
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 10:13:06 pm
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

Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 27, 2019, 10:16:28 pm
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).
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 10:24:45 pm
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.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 27, 2019, 10:33:04 pm
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
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 27, 2019, 11:51:04 pm
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
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 28, 2019, 08:57:04 am
Another thing to check: did you reinstall the Xcode command line tools after upgrading to macOS 10.14? They used to get removed on upgrading and then you were prompted to install them on first use, but I'm not sure this is still the case. To install them, run "sudo xcode-select --install" in a terminal window.

fpc.cfg is in /etc/fpc.cfg (/etc is the default directory for global configuration files on Unix-like systems).

I'm currently on my 10.14 laptop, so I can show you the change that gets added for 10.14:

Code: [Select]
#ifdef cpui386
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
#endif
#ifndef cpui386
#ifndef cpupowerpc
#ifndef cpupowerpc64
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
#endif
#endif
#endif

However, as those paths imply, these directories only get created once you install the command line tools. crt*.o used to be also installed in /usr/lib on previous macOS versions, but that is no longer the case.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 28, 2019, 04:01:07 pm
I always update command line tools as first thing :)

I am going to

1)
Settle for targeting 10.8+

2)
However - the warnings still worry me, so I will still try implement the suggestions you have regarding plist.info and fpc.cfg (thank you)

I will probably return to this thread later today regarding that. (Trying out things now)

...

A least I think I have found at least one bug - using conditional code in "Project options - custom options" fails / is ignored by Lazarus. That part was solved by simply using:
Code: Pascal  [Select][+][-]
  1. -WM10.8

...

I also reported the issue to FPCUpDeluxe and got a response, but I am not fully sure if the response solves the issue
http://forum.lazarus.freepascal.org/index.php/topic,34645.msg312656.html#msg312656 (http://forum.lazarus.freepascal.org/index.php/topic,34645.msg312656.html#msg312656)
Quote
Fpcupdeluxe tries to detect the OSX version of the system you are installing FPC.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 28, 2019, 04:07:00 pm
Here are examples of the exact error messages I get when targeting 10.8 without having done any fpc.cfg changes yet:

...

First kind essentially the same for all (there is a lot) existing Lazarus compiled code:

Quote
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/tatransformations.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/tachartteechart.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/taseries.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/fpc/units/x86_64-darwin/fcl-json/fpjson.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/turbopower_ipro/units/x86_64-darwin/cocoa/ipconst.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/tachartutils.o) was built for newer OSX version (10.13) than being linked (10.8 )

...

Second kind (including it all here)
Quote
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib//libiconv.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib//libc.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib//libobjc.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//Foundation.framework/Foundation) built for (unknown). Note: This will be an error in the future.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on February 28, 2019, 04:19:40 pm
Quote

Code: [Select]
#ifdef cpui386
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
#endif
#ifndef cpui386
#ifndef cpupowerpc
#ifndef cpupowerpc64
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
#endif
#endif
#endif


I can confirm I have crt1.10.6.o in path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on February 28, 2019, 08:16:15 pm
Here are examples of the exact error messages I get when targeting 10.8 without having done any fpc.cfg changes yet:

...

First kind essentially the same for all (there is a lot) existing Lazarus compiled code:

Quote
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/tatransformations.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/tachartteechart.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/taseries.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/fpc/units/x86_64-darwin/fcl-json/fpjson.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/turbopower_ipro/units/x86_64-darwin/cocoa/ipconst.o) was built for newer OSX version (10.13) than being linked (10.8 )
ld: warning: object file (./MN/lazaruscoc64bit/lazarus/components/tachart/lib/x86_64-darwin/cocoa/tachartutils.o) was built for newer OSX version (10.13) than being linked (10.8 )
This seems to be FPCUpDeluxe-specific, as when targeting Darwin/x86-64, FPC normally compiles everything for macOS 10.6 when nothing is specified. In any case, it doesn't really matter, because the compiler does not generate different code when targeting macOS 10.13 than when targeting 10.8 (at this time).

Quote
Second kind (including it all here)
Quote
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib//libiconv.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib//libc.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib//libobjc.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//Foundation.framework/Foundation) built for (unknown). Note: This will be an error in the future.
That is because the used fpc.cfg does not contain the search paths added by the FPC 3.0.4a installer. Perhaps FPCUpDeluxe generates a .fpc.cfg file in your home directory that does not include the global /etc/fpc.cfg file.

Try adding -va to the compiler options to see what configuration file gets loaded and what options it contains. In general, I can't really help you further. I make the official FPC installer and configuration file as resilient as possible, but I can't do anything if those get completely ignored.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on March 01, 2019, 08:34:47 am
You can actually also work around the issue by specifying those parameters directly on the command line.

When compiling for i386, add -Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

When compiling for x86-64, add -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

I'd still be interested to know whether and if so how FPCUpDeluxe causes the root issue though.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: DonAlfredo on March 01, 2019, 09:18:29 am
Fpcupdeluxe will perform an isolated install of FPC (and Lazarus).
It uses its own fpc.cfg, located in the install-directory.
And tries to make it work on as many systems as possible.

The global fpc.cfg will not be used, to prevent issues between different installs.

As maintainer, I have limited resources to test. At the moment, I use a VM (on Win10) with OSX 10.14 to test the functionality of fpcupdeluxe.

Besides, I always advice to use the official sources, binaries, installers when available !
And use fpcupdeluxe only for special demands.

The fpcupdeluxe binaries themselves are all made on a Win10-system by cross-compiling.

I am very interested and eager for any advice that can make fpcupdeluxe better !
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on March 01, 2019, 10:52:57 am
The

Quote
ld: warning: URGENT: building for OSX, but linking against dylib

warnings seems to be solved by adding

Code: Pascal  [Select][+][-]
  1. #ifdef cpui386
  2. -Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
  3. #endif
  4. #ifndef cpui386
  5. #ifndef cpupowerpc
  6. #ifndef cpupowerpc64
  7. -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
  8. #endif
  9. #endif
  10. #endif

to fpcupdeluxe fpc.cfg file
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on March 02, 2019, 10:54:01 am
Fpcupdeluxe will perform an isolated install of FPC (and Lazarus).
It uses its own fpc.cfg, located in the install-directory.
And tries to make it work on as many systems as possible.

The global fpc.cfg will not be used, to prevent issues between different installs.

How do you ensure that it does not get used? Additionally, how do you create your own fpc.cfg? If you use the fpcmkcfg of the newly installed compiler, your configuration file should work just as well as the default one (it's generated by the same program) and contain all necessary directives.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: DonAlfredo on March 02, 2019, 11:18:39 am
On all unix-like-systems, FPC is launched by a script.

The script:
Code: Pascal  [Select][+][-]
  1. # This script starts the fpc compiler installed by fpcup
  2. # and ignores any system-wide fpc.cfg files
  3. # Note: maintained by fpcup; do not edit directly, your edits will be lost.
  4. /installdir/"moredirs"/fpc -n @/installdir/"moredirs"/fpc.cfg "$@"

Fpcupdeluxe uses fpcmkcf to generate a config.
And makes some changes to accomodate for the install-directory and cross-compilers.

I have changed fpcupdeluxe not to use -WM10.14 for 10.14, but to use -WM10.8 on anything >=10.8

New release will follow soon.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on March 02, 2019, 11:23:01 am
On all unix-like-systems, FPC is launched by a script.

The script:
Code: Pascal  [Select][+][-]
  1. # This script starts the fpc compiler installed by fpcup
  2. # and ignores any system-wide fpc.cfg files
  3. # Note: maintained by fpcup; do not edit directly, your edits will be lost.
  4. /installdir/"moredirs"/fpc -n @/installdir/"moredirs"/fpc.cfg "$@"
Okay.

Quote
Fpcupdeluxe uses fpcmkcf to generate a config.
Then I don't understand why it does not contain the -Fl/-XR lines when generated on macOS 10.14.

Quote
I have changed fpcupdeluxe not to use -WM10.14 for 10.14, but to use -WM10.8 on anything >=10.8
Why do you force the target FPC version to be something different from the default? This makes support harder (as shown by this thread), and I'm not aware of any advantages. At most it hides issues caused by an incomplete fpc.cfg on macOS 10.14.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on March 28, 2019, 04:03:07 pm
Not 100% sure if reletaed, but I think it is:

I updated command line tools - and now instead of (before this thread) getting:

Quote
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib//libiconv.dylib) built for (unknown). Note: This will be an error in the future.

I now (without having made changes to my Lazarus setup) seem to be getting

Quote
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib//libiconv.tbd:4:18: error: unknown enumerated scalar
platform:        zippered
                 ^~~~~~~~
 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib//libiconv.tbd'

I wrote about it in thread:
https://forum.lazarus.freepascal.org/index.php/topic,44830.0.html (https://forum.lazarus.freepascal.org/index.php/topic,44830.0.html)

Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on March 29, 2019, 11:26:45 am
I am getting the same error when downloading lazarus/fpc trunk (and I think stable as well) using fpcupdeluxe:

https://forum.lazarus.freepascal.org/index.php/topic,34645.msg315595.html#msg315595 (https://forum.lazarus.freepascal.org/index.php/topic,34645.msg315595.html#msg315595)

(Hopefully we can help each other getting this permanently solved. I personally like solutions like fpcupdeluxe because it helps ease installation and keep completely separate installations of lazarus - i.e. stable, trunk etc. As I understand the issue - it should be possible to solve - I would like to volunteer testing if that helps anything)
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on March 30, 2019, 11:18:06 am
@Jonas

Do you have any idea how to solve this? the .cfg file already contains the patch

Code: Pascal  [Select][+][-]
  1. #ifdef cpui386
  2. -Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
  3. #endif
  4. #ifndef cpui386
  5. #ifndef cpupowerpc
  6. #ifndef cpupowerpc64
  7. -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
  8. #endif
  9. #endif
  10. #endif

So I think something more is needed to solve the error

Code: Pascal  [Select][+][-]
  1. ld: malformed file
  2. /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib//libiconv.tbd:4:18: error: unknown enumerated scalar
  3. platform:        zippered
  4.                  ^~~~~~~~
  5.  file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib//libiconv.tbd'

Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: Jonas Maebe on March 30, 2019, 12:35:19 pm
I just updated my laptop to 10.4.4 and the command line tools to 10.2 (clang --version returns clang-1000.11.45.5). I can compile fine both for i386 and x86-64.

Try compiling with -va to check that the fpc.cfg that includes those lines gets actually used. Also check that -FD/Library/Developer/CommandLineTools/usr/bin is present and gets used.
Title: Re: My app won't run on anything below 10.13 - build error in FPC or Lazarus or me?
Post by: MISV on March 30, 2019, 07:31:10 pm
Thank you

Adding
Quote
-FD/Library/Developer/CommandLineTools/usr/bin
seems to have done the trick.

I missed it was useful/neccessary if having done the fpc.cfg changes

I will report back if I encounter further issues (release builds etc.)
TinyPortal © 2005-2018