[SOLVED] FPC 3.3.1 - /usr/lib/crt1.10.5.so missing lazarus / 68-Other OS ---------------------------------------------------------------------- trev · 2019-08-10 09:33 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: QuoteError: 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? ---------------------------------------------------------------------- Jonas Maebe · 2019-08-10 10:18 See https://forum.lazarus.freepascal.org/index.php/topic,46300.msg3296 49.html ---------------------------------------------------------------------- trev · 2019-08-10 11:35 Great, my life has meaning again make OPT="-WM10.8" clean all, solved the issue Thanks! ---------------------------------------------------------------------- trev · 2019-08-10 12:40 So near, yet so far... How to now get rid of the 146 linking errors like: QuoteError: 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. than being linked (10.5) when compiling a program with Lazarus. ---------------------------------------------------------------------- trev · 2019-08-10 13:09 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. ---------------------------------------------------------------------- Jonas Maebe · 2019-08-10 13:27 Quote from: trev on August 10, 2019, 02:40:08 pmSo near, yet so far... How to now get rid of the 146 linking errors like: QuoteError: 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. 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 · 2019-08-10 13:50 > 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if TargetOS = 'darwin' then begin  UsageCustomOptions += ' -WM10.8';end;  and/or adding to Project Options > Compilation and Linking: -k-macosx_version_min -k10.8 and failed to get rid of the error warnings. ---------------------------------------------------------------------- Jonas Maebe · 2019-08-10 13:52 Quote from: trev 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if TargetOS = 'darwin' then begin  UsageCustomOptions += ' -WM10.8';end; I have never managed to get these conditional parameters working. Adding them normally should work though. Quoteand/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 · 2019-08-11 23:39 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? ---------------------------------------------------------------------- Jonas Maebe · 2019-08-12 19:43 Quote from: trev on August 12, 2019, 01:39:35 am 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. Quotemake 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.