Hi,
So, on anything >= 10.8, fpcupdeluxe (read: FPC) will not try to link with crt1.
It will also not add a library path for this file.
That was not my experience. I'm using Lazarus 2.0.0RC3 rexported FPC 3.0.4 x86_64-darwin-cocoa (alpha) on a parallels VM running Mojave 10.14. When I tried to build a simple test application (Darwin/x86_64) with a simple DYLIB, FPC tried to link in both
dylib1.10.5.o and
crt1.10.5.o (it seemed to me that the 10.5 probably referred to macOS versions, but I don't know enough to make that leap and anyway, why is it trying to link 10.5 libraries on a 10.14 system?). I copied the from see below to /usr/lib and that got over the problem.
http://forum.lazarus.freepascal.org/index.php/topic,44495.0.htmlsudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.10.5.o /usr/lib/crt1.10.5.o
BUT see my notes on Apple System Integrity Protection (SIP).
Now as I note, why is FPC trying to link 10.5 libraries on a 10.14 system AND is this potentially why I cannot get the simple test application to 'see' the exported function in the simple test dylib (I suspect not, but clutching at straws)?
And now when I go back to setting the build configuration to i386 / Darwin with carbon widgets, when I try to build the simple Dylib I get this:
Compile Project, CPU: i386, Target: i386-darwin/libpdylibtest.dylib: Exit code 256, Errors: 1, Hints: 3
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Verbose: Free Pascal Compiler version 3.0.4 [2017/11/26] for i386
Verbose: Copyright (c) 1993-2017 by Florian Klaempfl and others
Verbose: Target OS: Darwin for i386
Verbose: Compiling pDYLIBTest.lpr
pDYLIBTest.lpr(22,20) Hint: Parameter "Hello" not used
Verbose: Assembling (pipe) /Users/kevin/Dropbox/Lazarus/DYLIBTest/lib/i386-darwin/pDYLIBTest.s
Verbose: Compiling resource /Users/kevin/Dropbox/Lazarus/DYLIBTest/lib/i386-darwin/pDYLIBTest.or
Verbose: Linking /Users/kevin/Dropbox/Lazarus/DYLIBTest/i386-darwin/libpdylibtest.dylib
ld: file not found: /usr/lib/dylib1.o <<<<<-------------????????
An error occurred while linking
pDYLIBTest.lpr(49,0) Error: Error while linking
pDYLIBTest.lpr(49,0) Verbose: There were 1 errors compiling module, stopping
Verbose: Compilation aborted
So I (again) copied the file from the location above to /usr/lib and the Dylib now builds successfully.
This was provided by: Jonas Maebe in response to another of my posts:
Normally, if you installed FPC 3.0.4a (from https://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/3.0.4 ) after you installed macOS 10.14, and if you also (re)installed the command line tools after upgrading to macOS 10.14 (with sudo xcode-select --install), the FPC installer will have created a /etc/fpc.cfg file that contains the appropriate parameters so that this file can be found.
However, from another thread where someone used FPCUpDeluxe, it seems that program creates an alternate configuration file that overrides these settings. See http://forum.lazarus-ide.org/index.php/topic,44453.msg312787.html#msg312787 for the command line parameters to add so that the compiler/linker can find these files in case the fpc.cfg that contains them is not used for some reason.
Kevin