Recent

Author Topic: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing  (Read 555 times)

trev

  • Full Member
  • ***
  • Posts: 194
[SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« on: August 10, 2019, 11:33:41 am »
I tried to compile a new Lazarus project on macOS and met with /usr/lib/crt1.10.5.so missing.

I thought I'd tracked down the problem to the latest Xcode 10.3 and the fpc.cfg file as the paths therein no longer matched what was in fpc.cfg. So, I generated a new fpc.cfg file with fpcmkcfg.

Thereafter I met with the "fcllaz.pas(11,3) Fatal: Cannot find db used by fcllaz of package FCL" error.

Watching my life ebb away, I decided to delete all the FPC (3.0.4 and 3.3.1) source and binaries, the fpc.cfg file, .config files, .lazarus files, Lazarus 2.1 source and binaries and start again.

I installed the official FPC 3.0.4 source and binaries. I installed the official Lazarus 2.04 binary. Life was good again.

I downloaded Lazarus trunk source and compiled it for Cocoa x86_64. Life was still good.

On a roll, I downloaded FPC trunk and tried to compile with: make clean all, only to be met with:

Quote
/Applications/Xcode.app/Contents/Developer/usr/bin/make compiler
/bin/mkdir -p x86_64/units/x86_64-darwin
/bin/mkdir -p x86_64/bin/x86_64-darwin
/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/usr/local/share/fpcsrc/fpc-3.3.1/rtl/units/x86_64-darwin -Fix86_64 -FEx86_64/bin/x86_64-darwin -FUx86_64/units/x86_64-darwin -dRELEASE    -dx86_64 -dGDB -dBROWSERLOG -Fux86 pp.pas
ld: file not found: /usr/lib/crt1.10.5.o  <<<<<<<<<<<<<<<<<<<<<<<<<
An error occurred while linking
pp.pas(263,36) Error: Error while linking
pp.pas(263,36) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Defeat grabbed from the jaws of success.

I still suspect Xcode 10.3. I hadn't updated any Lazarus or FPC source/binary in several weeks. But I had updated Xcode and compiling a project with Lazarus 2.1 now emits the following (non fatal) error:

Quote
Error: ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)

Curiously, compiling with Lazarus 2.0.4 doesn't show the above error.

Anyway, any ideas on the mystery /usr/lib/crt1.10.5?
« Last Edit: August 10, 2019, 01:31:40 pm by trev »
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 659

trev

  • Full Member
  • ***
  • Posts: 194
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #2 on: August 10, 2019, 01:35:36 pm »
Great, my life has meaning again :)

make OPT="-WM10.8" clean all, solved the issue

Thanks!
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

trev

  • Full Member
  • ***
  • Posts: 194
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #3 on: August 10, 2019, 02:40:08 pm »
So near, yet so far...

How to now get rid of the 146 linking errors like:

Quote
Error: ld: warning: object file (/usr/local/lib/fpc/3.3.1/units/x86_64-darwin/chm/fasthtmlparser.o) was built for newer OSX version (10.8) than being linked (10.5)

when compiling a program with Lazarus.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

trev

  • Full Member
  • ***
  • Posts: 194
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #4 on: August 10, 2019, 03:09:15 pm »
On a wing and a prayer, compiling  FPC 3.3.1 by going into the subdirectories (compiler, rtl, packages, utils) and running:

make clean all OPT="-WM10.5"

and finally running make install from the top directory has resolved all the issues.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 659
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #5 on: August 10, 2019, 03:27:56 pm »
So near, yet so far...

How to now get rid of the 146 linking errors like:

Quote
Error: ld: warning: object file (/usr/local/lib/fpc/3.3.1/units/x86_64-darwin/chm/fasthtmlparser.o) was built for newer OSX version (10.8) than being linked (10.5)

when compiling a program with Lazarus.

Those are not errors, but warnings (and harmless in case of FPC, at this time FPC does not generate code that requires at least version XXX of macOS if you use -WM10.XXX). I don't know where that extra "Error:" prefix comes from (maybe Lazarus adds it?). You can also add -WM10.8 when compiling programs in Lazarus to get rid of the warning.

trev

  • Full Member
  • ***
  • Posts: 194
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #6 on: August 10, 2019, 03:50:39 pm »
> You can also add -WM10.8 when compiling programs in Lazarus to get rid of the warning.

I tried various things like Project Options > Compiler options > Custom Options > Conditionals:

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

and/or adding to Project Options > Compilation and Linking:

-k-macosx_version_min -k10.8

and failed to get rid of the error warnings.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 659
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #7 on: August 10, 2019, 03:52:19 pm »
> You can also add -WM10.8 when compiling programs in Lazarus to get rid of the warning.

I tried various things like Project Options > Compiler options > Custom Options > Conditionals:

Code: Pascal  [Select]
  1. if TargetOS = 'darwin' then begin
  2.   UsageCustomOptions += ' -WM10.8';
  3. end;
  4.  
I have never managed to get these conditional parameters working. Adding them normally should work though.

Quote
and/or adding to Project Options > Compilation and Linking:

-k-macosx_version_min -k10.8

and failed to get rid of the error warnings.
Never ever use that. Always use the compiler parameter.

trev

  • Full Member
  • ***
  • Posts: 194
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #8 on: August 12, 2019, 01:39:35 am »
To clarify the successful build process, after building with OPT=-WM10.8 but not installing, subsequent builds with OPT=-WM10.5 then work.

However, while building the cross compilers for win32 and win64 succeeds, attempts to install with:

make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64

produces:

/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/usr/local/share/fpcsrc/fpc-3.3.1/rtl/units/x86_64-darwin -Fix86_64 -FEx86_64/bin/x86_64-darwin -FUx86_64/units/x86_64-darwin -dRELEASE    -dx86_64 -dGDB -dBROWSERLOG -Fux86 pp.pas
ld: file not found: /usr/lib/crt1.10.5.o
An error occurred while linking

So, let's add OPT=-WM10.8 and yes, it gets further, but then dies a miserable death with:

/usr/local/share/fpcsrc/fpc-3.3.1/compiler/ppcrossx64 -Twin64 -XPx86_64-win64- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -FE. -FU/usr/local/share/fpcsrc/fpc-3.3.1/rtl/units/x86_64-win64 -WM10.8 -dx86_64 -dRELEASE  -Us -Sg system.pp -Fi../win
Error: Illegal parameter: -WM10.8

when using the win64 cross compiler which doesn't understand -WM10.8.


[EDIT]

Why is FPC looking for crt1.10.5.o in /usr/lib instead of:

* /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.10.5.o

=or=

* /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/crt1.10.5.o

[EDIT 2]

Yes! This works:

make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 OPT="-XR/Library/Developer/CommandLineTools//SDKs/MacOSX.sdk/"

But does it have to be this difficult?
« Last Edit: August 12, 2019, 02:05:15 am by trev »
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 659
Re: [SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing
« Reply #9 on: August 12, 2019, 09:43:22 pm »

Why is FPC looking for crt1.10.5.o in /usr/lib instead of:

* /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.10.5.o

=or=

* /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/crt1.10.5.o
Because from Mac OS X 10.5 till macOS 10.13, that is where that file could be found.

Quote
make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 OPT="-XR/Library/Developer/CommandLineTools//SDKs/MacOSX.sdk/"

But does it have to be this difficult?
It wouldn't be if Apple would stop moving things around every other full moon. FPC 3.0.4 predates the release of macOS 10.14. I will try to fix it for FPC 3.2, although I'm sure macOS 10.15 will manage to mess up other things again.