[fpc-devel] MacOS Mojave beta - crt1.o not installed to /usr/lib

Michael Ring mail at michael-ring.org
Sun Jul 1 23:53:25 CEST 2018


Seems I misunderstood the meaning of "MacOSXVersionMin", it is set to 
10.5 on my MacOS Mojave !!??!!

So the patch gets even more simple:

Index: compiler/systems/t_bsd.pas
===================================================================
--- compiler/systems/t_bsd.pas    (revision 39358)
+++ compiler/systems/t_bsd.pas    (working copy)
@@ -377,7 +377,10 @@
    if startupfile<>'' then
      begin
       if not librarysearchpath.FindFile(startupfile,false,result) then
-       result:='/usr/lib/'+startupfile
+       if sysutils.fileexists('/usr/lib/'+startupfile) then
+         result:='/usr/lib/'+startupfile
+       else if 
sysutils.fileexists('/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/'+startupfile) 
then
+ 
result:='/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/'+startupfile
      end
    else
      result:='';



Am 01.07.18 um 23:31 schrieb Michael Ring:
> This small patch helped me to get rid of the need to define 
> -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/ in /etc/fpc.cfg
>
>
> It would be greet to have something similar in the upcoming 3.0.5 
> release (and of course in trunk) so that also building lazarus with a 
> 3.0.5 compiler works (It currently fails without the entry in fpc.cfg)
>
>
> Michael
>
>
> Index: compiler/systems/t_bsd.pas
> ===================================================================
> --- compiler/systems/t_bsd.pas    (revision 39358)
> +++ compiler/systems/t_bsd.pas    (working copy)
> @@ -248,6 +248,9 @@
>              system_i386_darwin,
>              system_x86_64_darwin:
>                begin
> +                { 10.14 and later: crt1.o }
> +                if CompareVersionStrings(MacOSXVersionMin,'10.14')>=0 
> then
> +                  exit('crt1.so');
>                  { 10.8 and later: no crt1.* }
>                  if CompareVersionStrings(MacOSXVersionMin,'10.8')>=0 
> then
>                    exit('');
> @@ -377,7 +380,10 @@
>    if startupfile<>'' then
>      begin
>       if not librarysearchpath.FindFile(startupfile,false,result) then
> -       result:='/usr/lib/'+startupfile
> +       if sysutils.fileexists('/usr/lib/'+startupfile) then
> +         result:='/usr/lib/'+startupfile
> +       else if 
> sysutils.fileexists('/Library/Developer/CommandLineTools//SDKs/MacOSX.sdk/usr/lib/'+startupfile) 
> then
> + 
> result:='/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/'+startupfile
>      end
>    else
>      result:='';
>
>
> Am 01.07.18 um 22:52 schrieb Michael Ring:
>> I only adjusted -Fl to match the current version installed, having a 
>> wrong issue there did not change the build behaviour. The change 
>> necessary was to include
>>
>> -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/
>>
>> otherwise fpcmake will not compile.
>>
>>
>> Cross-Compiling did however not work, the makefile of fpcmake does 
>> seem to support FPCOPT but somehow the parameter does not get 
>> forwarded to the makefile:
>>
>> /Library/Developer/CommandLineTools/usr/bin/make -C utils/fpcm 
>> bootstrap FPC=/Users/ring/devel/fpc-arm/compiler/ppcrossarm 
>> FPCFPMAKE=/Users/ring/devel/fpc-arm/compiler/ppc RELEASE=1 'OPT='
>>
>> results in:
>>
>> /Users/ring/devel/fpc-arm/compiler/ppc fpcmake.pp -n 
>> -Fu/Users/ring/devel/fpc-arm/rtl/units/x86_64-darwin 
>> -FU/Users/ring/devel/fpc-arm/utils/fpcm/units/x86_64-darwin
>> ld: file not found: /usr/lib/crt1.10.5.o
>> An error occurred while linking
>>
>> I could make crosscompiling work by doing this (Use OPT instead of 
>> FPCOPT)
>>
>> make clean buildbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm 
>> SUBARCH=$SUBARCH CROSSOPT="$CROSSOPT" BINUTILSPREFIX=arm-none-eabi- 
>> OPT="-XR/Library/Developer/CommandLineTools//SDKs/MacOSX.sdk/"
>>
>> I hope that hardcoding the path 
>> /Library/Developer/CommandLineTools//SDKs/MacOSX.sdk/ in FPC will 
>> solve this.....
>>
>> Thank you,
>>
>> Michael
>>
>>
>>
>> Am 01.07.18 um 22:34 schrieb Jonas Maebe:
>>> On 01/07/18 22:18, Michael Ring wrote:
>>>>
>>>> make clean buildbase CPU_TARGET=x86_64 INSTALL_PREFIX=$HOME/3.1.1 
>>>> FPCOPT="-XR/Library/Developer/CommandLineTools//SDKs/MacOSX.sdk/"
>>>>
>>>> and patching my /etc/fpc.cfg to include:
>>>>
>>>> #ifdef cpui386
>>>> -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/
>>>> -Fl/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0
>>>> #endif
>>>> #ifdef cpux86_64
>>>> -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/
>>>> -Fl/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0
>>>> #endif
>>>>
>>>> both actions were needed for a successful compile...
>>>
>>> What errors do you get if you don't include the -Fl option?
>>>
>>>> Is there a better way to make compiles work on Mojave?
>>>
>>> The -XR above seems to be the correct way to handle this change. We 
>>> could also hard code that search path in the compiler in addition to 
>>> /usr/lib
>>>
>>>
>>> Jonas
>>> _______________________________________________
>>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>>
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list