Discussion:
[fpc-pascal] MacOSX Mojave
C Western
2018-10-06 14:01:09 UTC
Permalink
Possibly unwisely, I updated by Mac to Mojave. I found that things
(including 32 bit apps) worked, but:

I had to add

-Fl/Applications/Xcode.app/Con
tents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib

to my fpc.cfg to avoid "/usr/lib/crt1.o not found" errors. It seems as
though the startup files are no longer in /usr/lib

The gdb from MacPorts also didn't seem to work. I had some success using
lldb - I notice an alpha package for this can be installed in lazarus,
and this seemed to work, at least on the basic test I did.

Colin

_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.fr
C Western
2018-10-06 15:13:46 UTC
Permalink
I didn't see that thread. I can confirm that
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/ exists on
my system

Colin
A whilke ago I have proposed a fix in fpc-devel in Thread: "MacOS
Mojave beta - crt1.o not installed to /usr/lib"
Using the CommandLineTools directory (and not the XCode directory)
makes it possible to use fpc without the need to have the very huge
xcode installed, I deleted it a while ago and am happy since then.
Can you please check if this path also exists in your installation?
@CoreDevelopers, any change to merge this fix to trunk?
Michael
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:='';
Post by C Western
Possibly unwisely, I updated by Mac to Mojave. I found that things
I had to add
-Fl/Applications/Xcode.app/Con
tents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
to my fpc.cfg to avoid "/usr/lib/crt1.o not found" errors. It seems
as though the startup files are no longer in /usr/lib
The gdb from MacPorts also didn't seem to work. I had some success
using lldb - I notice an alpha package for this can be installed in
lazarus, and this seemed to work, at least on the basic test I did.
Colin
_______________________________________________
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/ma
Jonas Maebe
2018-10-07 17:38:54 UTC
Permalink
Post by C Western
Possibly unwisely, I updated by Mac to Mojave. I found that things
I had to add
-Fl/Applications/Xcode.app/Con
tents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
to my fpc.cfg to avoid "/usr/lib/crt1.o not found" errors. It seems as
though the startup files are no longer in /usr/lib
I've created an FPC 3.0.4a release for macOS yesterday that adds the
appropriate directives to /etc/fpc.cfg (no changes to the compiler).


Jonas
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.o
Michael Ring
2018-10-08 21:19:27 UTC
Permalink
I just realized on a freshly set up computer that there is one more
issue, I tried to build the trunk x86_64 compiler and compile fails:

/bin/mkdir -p x86_64/units/x86_64-darwin
/Applications/Xcode.app/Contents/Developer/usr/bin/make ./msg2inc
/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems
-Fu/Users/ring/devel/fpc/rtl/units/x86_64-darwin -Fix86_64 -FE.
-FUx86_64/units/x86_64-darwin -dRELEASE    -dx86_64 -dGDB -dBROWSERLOG
-Fux86 -Sew -FE. utils/msg2inc.pp
ld: file not found: /usr/lib/crt1.10.5.o
An error occurred while linking
msg2inc.pp(822,51) Error: Error while linking
msg2inc.pp(822,51) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted


problem is that ppcx64 is called with option -n so fpc.cfg gets ignored.


I guess the only way to fix this is to change the makefile itself.


Also, one thing I do not understand in /etc/fpc.cfg installed by the
3.0.4a installer, why if -Fl ifdef'ed for i386 only?

#ifdef cpui386
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
#endif



Here's the patch for the makefile that worked for me:

Index: compiler/Makefile
===================================================================
--- compiler/Makefile    (revision 39905)
+++ compiler/Makefile    (working copy)
@@ -4248,7 +4248,7 @@
 clean: tempclean execlean cleanall $(addsuffix _clean,$(CPC_TARGET))
$(addsuffix _clean,$(TARGET_DIRS))
 distclean: tempclean execlean cleanall $(addsuffix
_clean,$(ALLTARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
 $(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR)
$(COMPILERUTILSDIR)/msg2inc.pp
-    $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
+    $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
 msgtxt.inc: $(MSGFILE)
     $(MAKE) $(MSG2INC)
     $(MSG2INC) $(MSGFILE) msg msg
@@ -4328,7 +4328,7 @@
 endif
     $(COMPILER) version.pas
 endif
-    $(COMPILER) pp.pas
+    $(COMPILER) pp.pas
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
     $(EXECPPAS)
     $(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
 .PHONY: cycle fullcycle wpocycle
Index: compiler/Makefile.fpc
===================================================================
--- compiler/Makefile.fpc    (revision 39905)
+++ compiler/Makefile.fpc    (working copy)
@@ -538,7 +538,7 @@
 #####################################################################

 $(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR)
$(COMPILERUTILSDIR)/msg2inc.pp
-        $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
+        $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

 # The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
 # because that one will be new almost everytime
@@ -641,7 +641,7 @@
 endif
         $(COMPILER) version.pas
 endif
-        $(COMPILER) pp.pas
+        $(COMPILER) pp.pas
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
         $(EXECPPAS)
         $(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)

Michael
Post by Jonas Maebe
Post by C Western
Possibly unwisely, I updated by Mac to Mojave. I found that things
I had to add
-Fl/Applications/Xcode.app/Con
tents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
to my fpc.cfg to avoid "/usr/lib/crt1.o not found" errors. It seems
as though the startup files are no longer in /usr/lib
I've created an FPC 3.0.4a release for macOS yesterday that adds the
appropriate directives to /etc/fpc.cfg (no changes to the compiler).
Jonas
_______________________________________________
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freep
C Western
2018-10-08 21:56:37 UTC
Permalink
I meant to mention in my original message that I needed to add

OPT=-Fl/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib

to the end of the make distclean install I use to compile the trunk
compiler.

My fpc.cfg also has #ifdef darwin, rather then #ifdef i386.

Colin
Post by Michael Ring
I just realized on a freshly set up computer that there is one more
/bin/mkdir -p x86_64/units/x86_64-darwin
/Applications/Xcode.app/Contents/Developer/usr/bin/make ./msg2inc
/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems
-Fu/Users/ring/devel/fpc/rtl/units/x86_64-darwin -Fix86_64 -FE.
-FUx86_64/units/x86_64-darwin -dRELEASE    -dx86_64 -dGDB -dBROWSERLOG
-Fux86 -Sew -FE. utils/msg2inc.pp
ld: file not found: /usr/lib/crt1.10.5.o
An error occurred while linking
msg2inc.pp(822,51) Error: Error while linking
msg2inc.pp(822,51) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
problem is that ppcx64 is called with option -n so fpc.cfg gets ignored.
I guess the only way to fix this is to change the makefile itself.
Also, one thing I do not understand in /etc/fpc.cfg installed by the
3.0.4a installer, why if -Fl ifdef'ed for i386 only?
#ifdef cpui386
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
#endif
Index: compiler/Makefile
===================================================================
--- compiler/Makefile    (revision 39905)
+++ compiler/Makefile    (working copy)
@@ -4248,7 +4248,7 @@
 clean: tempclean execlean cleanall $(addsuffix _clean,$(CPC_TARGET))
$(addsuffix _clean,$(TARGET_DIRS))
 distclean: tempclean execlean cleanall $(addsuffix
_clean,$(ALLTARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
 $(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR)
$(COMPILERUTILSDIR)/msg2inc.pp
-    $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
+    $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
 msgtxt.inc: $(MSGFILE)
     $(MAKE) $(MSG2INC)
     $(MSG2INC) $(MSGFILE) msg msg
@@ -4328,7 +4328,7 @@
 endif
     $(COMPILER) version.pas
 endif
-    $(COMPILER) pp.pas
+    $(COMPILER) pp.pas
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
     $(EXECPPAS)
     $(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
 .PHONY: cycle fullcycle wpocycle
Index: compiler/Makefile.fpc
===================================================================
--- compiler/Makefile.fpc    (revision 39905)
+++ compiler/Makefile.fpc    (working copy)
@@ -538,7 +538,7 @@
 #####################################################################
 $(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR)
$(COMPILERUTILSDIR)/msg2inc.pp
-        $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
+        $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
 # The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
 # because that one will be new almost everytime
@@ -641,7 +641,7 @@
 endif
         $(COMPILER) version.pas
 endif
-        $(COMPILER) pp.pas
+        $(COMPILER) pp.pas
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
         $(EXECPPAS)
         $(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
Michael
Post by Jonas Maebe
Post by C Western
Possibly unwisely, I updated by Mac to Mojave. I found that things
I had to add
-Fl/Applications/Xcode.app/Con
tents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
to my fpc.cfg to avoid "/usr/lib/crt1.o not found" errors. It seems
as though the startup files are no longer in /usr/lib
I've created an FPC 3.0.4a release for macOS yesterday that adds the
appropriate directives to /etc/fpc.cfg (no changes to the compiler).
Jonas
_______________________________________________
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fp
Jonas Maebe
2018-10-09 17:51:29 UTC
Permalink
Post by Michael Ring
I just realized on a freshly set up computer that there is one more
/bin/mkdir -p x86_64/units/x86_64-darwin
/Applications/Xcode.app/Contents/Developer/usr/bin/make ./msg2inc
/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems
-Fu/Users/ring/devel/fpc/rtl/units/x86_64-darwin -Fix86_64 -FE.
-FUx86_64/units/x86_64-darwin -dRELEASE    -dx86_64 -dGDB -dBROWSERLOG
-Fux86 -Sew -FE. utils/msg2inc.pp
ld: file not found: /usr/lib/crt1.10.5.o
An error occurred while linking
msg2inc.pp(822,51) Error: Error while linking
msg2inc.pp(822,51) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
problem is that ppcx64 is called with option -n so fpc.cfg gets ignored.
I guess the only way to fix this is to change the makefile itself.
As Colin mentioned, you can pass the necessary options to make via
OPT="-option1 -option2"
Post by Michael Ring
Also, one thing I do not understand in /etc/fpc.cfg installed by the
3.0.4a installer, why if -Fl ifdef'ed for i386 only?
#ifdef cpui386
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
#endif
It's because the necessary files for x86-64 can be found in /usr/lib,
where the compiler looks by default.


Jonas
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.o
Michael Ring
2018-10-09 19:06:28 UTC
Permalink
Until now you could compile trunk without such specific opts, so making
OPT= something mandatory for future builds of trunk to work at all does
not sound like a good plan to me.

and no, at least in my installation there are no crt1* files in
/usr/lib, if there were any we would not have this discussion here ;-)

I am not trying to solve something for myself, my own builds are working
for quite a long time on Mojave, just wanted to make sure that compiling
trunk keeps as straightforward as ever....

Michael
Post by Jonas Maebe
Post by Michael Ring
I just realized on a freshly set up computer that there is one more
/bin/mkdir -p x86_64/units/x86_64-darwin
/Applications/Xcode.app/Contents/Developer/usr/bin/make ./msg2inc
/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems
-Fu/Users/ring/devel/fpc/rtl/units/x86_64-darwin -Fix86_64 -FE.
-FUx86_64/units/x86_64-darwin -dRELEASE    -dx86_64 -dGDB
-dBROWSERLOG -Fux86 -Sew -FE. utils/msg2inc.pp
ld: file not found: /usr/lib/crt1.10.5.o
An error occurred while linking
msg2inc.pp(822,51) Error: Error while linking
msg2inc.pp(822,51) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
problem is that ppcx64 is called with option -n so fpc.cfg gets ignored.
I guess the only way to fix this is to change the makefile itself.
As Colin mentioned, you can pass the necessary options to make via
OPT="-option1 -option2"
Post by Michael Ring
Also, one thing I do not understand in /etc/fpc.cfg installed by the
3.0.4a installer, why if -Fl ifdef'ed for i386 only?
#ifdef cpui386
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
#endif
It's because the necessary files for x86-64 can be found in /usr/lib,
where the compiler looks by default.
Jonas
_______________________________________________
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listi
Jonas Maebe
2018-10-09 19:24:32 UTC
Permalink
Post by Michael Ring
Until now you could compile trunk without such specific opts, so making
OPT= something mandatory for future builds of trunk to work at all does
not sound like a good plan to me.
I committed a fix that could be merged to 3.0.4 without having to change
the compiler, in order to minimise the chances of introducing any bugs
in an existing release. Maybe I'll hardcode new paths in the compiler as
well, but hardcoding new paths in the compiler every couple of new macOS
releases is not a good plan either.
Post by Michael Ring
and no, at least in my installation there are no crt1* files in
/usr/lib, if there were any we would not have this discussion here ;-)
There indeed are none, that is why for x86-64 there is a
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk option in
fpc.cfg. That does not work for i386, because the libraries in that SDK
don't contain i386 versions. Only the versions installed as part of the
operating systems do (but the crt1.o file for i386 is only there, hence
the -Fl statement for that architecture).


Jonas
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pa

Loading...