Recent

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

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 674
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.

MISV

  • Hero Member
  • *****
  • Posts: 652
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
Quote
Fpcupdeluxe tries to detect the OSX version of the system you are installing FPC.
« Last Edit: February 28, 2019, 04:08:59 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 652
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.

MISV

  • Hero Member
  • *****
  • Posts: 652
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


Jonas Maebe

  • Hero Member
  • *****
  • Posts: 674
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.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 674
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.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1171
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 !

MISV

  • Hero Member
  • *****
  • Posts: 652
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

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 674
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.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1171
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.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 674
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.

MISV

  • Hero Member
  • *****
  • Posts: 652
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

« Last Edit: March 28, 2019, 04:06:36 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 652
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

(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)

MISV

  • Hero Member
  • *****
  • Posts: 652
@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'


Jonas Maebe

  • Hero Member
  • *****
  • Posts: 674
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.