Recent

Author Topic: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error  (Read 867 times)

emhartner

  • New Member
  • *
  • Posts: 43
Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« on: February 16, 2021, 05:02:16 am »
When trying to build FPC revision 48686 on Mac I'm getting the error below.

I'm using the following command to build it:
make OPT="-WM10.8" clean all

Here's the error I'm receiving:
/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/Users/eric/freepascal/fpc/rtl/units/x86_64-darwin -Fix86_64 -FEx86_64/bin/x86_64-darwin -FUx86_64/units/x86_64-darwin -dRELEASE -WM10.8   -dx86_64 -dGDB -dBROWSERLOG -Fux86 -Fix86 pp.pas
t_embed.pas(1704,3) Fatal: Syntax error, "NIL" expected but "(" found
Fatal: Compilation aborted
make[5]: *** [ppcx64] Error 1
make[4]: *** [next] Error 2
make[3]: *** [ppc1] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.x86_64-darwin] Error 2

I noticed that someone trying to build FPC on Windows reported the same error on February 13th.

Any help would be greatly appreciated.

Thank you,
Eric

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 867
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #1 on: February 16, 2021, 09:01:31 am »
It's because you're starting your build with FPC 3.0.4 rather than FPC 3.2.0. While technically this should still be supported, it does not always get tested.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2972
  • Compiler Developer
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #2 on: February 16, 2021, 09:05:46 am »
Any help would be greatly appreciated.

Are you using FPC 3.2.0 as starting compiler?

emhartner

  • New Member
  • *
  • Posts: 43
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #3 on: February 16, 2021, 02:04:01 pm »
Thank you.  I was using FPC 3.0.4.  Now that I'm using 3.2.0 I'm getting further.  However, now I have a new error:

/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/Users/eric/freepascal/fpc/rtl/units/x86_64-darwin -Fix86_64 -FEx86_64/bin/x86_64-darwin -FUx86_64/units/x86_64-darwin -dRELEASE -WM10.8   -dx86_64 -dGDB -dBROWSERLOG -Fux86 -Fix86 pp.pas
ld: library not found for -lc
An error occurred while linking
pp.pas(280,36) Error: Error while linking
pp.pas(280,36) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[5]: *** [ppcx64] Error 1
make[4]: *** [next] Error 2
make[3]: *** [ppc1] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.x86_64-darwin] Error 2

Do you know what the issue could be here?

Thank you,
Eric

sstvmaster

  • Full Member
  • ***
  • Posts: 243
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #4 on: February 16, 2021, 02:40:27 pm »
I noticed that someone trying to build FPC on Windows reported the same error on February 13th.

Someone was me. I have the same error message using fpcupdeluxe, https://forum.lazarus.freepascal.org/index.php/topic,34645.msg394141.html#msg394141.
fpcupdeluxe uses fpc 3.0.4 to build this. So Don have to change that?

Maik
Windows 10 (64 bit)
Lazarus: 2.0.12 / Trunk x32

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 867
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #5 on: February 16, 2021, 08:28:58 pm »
Thank you.  I was using FPC 3.0.4.  Now that I'm using 3.2.0 I'm getting further.  However, now I have a new error:

/usr/local/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/Users/eric/freepascal/fpc/rtl/units/x86_64-darwin -Fix86_64 -FEx86_64/bin/x86_64-darwin -FUx86_64/units/x86_64-darwin -dRELEASE -WM10.8   -dx86_64 -dGDB -dBROWSERLOG -Fux86 -Fix86 pp.pas
ld: library not found for -lc
An error occurred while linking
pp.pas(280,36) Error: Error while linking
pp.pas(280,36) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[5]: *** [ppcx64] Error 1
make[4]: *** [next] Error 2
make[3]: *** [ppc1] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.x86_64-darwin] Error 2

Do you know what the issue could be here?
On macOS 11.0/"Big Sur", Apple removed all libraries from their default locations (in /usr/lib etc), even when the command line tools are installed. While the generated fpc.cfg file adds the sysroot where they are now located (so regular compiling works), during the building of the FPC source tree the default configuration files get ignored (to avoid getting build failures due to custom options). The Makefile itself cannot add that sysroot, because it's possible you may want to build the tree against a non-default SDK. This means that on macOS 11.0 you have to explicitly specify the sysroot by adding OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" to the build command (or, if there is already an OPT parameter, by adding that -XR parameter to it).

emhartner

  • New Member
  • *
  • Posts: 43
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #6 on: February 16, 2021, 10:16:24 pm »
Quote
On macOS 11.0/"Big Sur", Apple removed all libraries from their default locations (in /usr/lib etc), even when the command line tools are installed. While the generated fpc.cfg file adds the sysroot where they are now located (so regular compiling works), during the building of the FPC source tree the default configuration files get ignored (to avoid getting build failures due to custom options). The Makefile itself cannot add that sysroot, because it's possible you may want to build the tree against a non-default SDK. This means that on macOS 11.0 you have to explicitly specify the sysroot by adding OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" to the build command (or, if there is already an OPT parameter, by adding that -XR parameter to it).

Thanks so much Jonas, I can now build FPC.  My make command looks as follows since I already had an OPT parameter:
make OPT=-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -WM10.8 clean all

However, I'm getting an error when building Lazarus - linking lhelp.  Do I need to worry about this?
Code: Bash  [Select][+][-]
  1. Linking ./lhelp
  2. ld: library not found for -lXtst
  3. An error occurred while linking
  4. Error: Error while linking
  5. Fatal: There were 1 errors compiling module, stopping
  6. Fatal: Compilation aborted
  7. make[2]: *** [lhelp] Error 1
  8. make[1]: *** [all] Error 2
  9. make: *** [lhelp] Error 2

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 867
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #7 on: February 16, 2021, 10:22:13 pm »
That seems to be an Xorg library: https://github.com/freedesktop/xorg-libXtst

Perhaps lhelp has no native Cocoa support? You can always try installing XQuartz to get the macOS port of Xorg, perhaps it's included there: https://www.xquartz.org/releases/index.html (get the beta to have macOS 11.0 support; and then also add /opt/X11/lib to your library search path). But I'm only a compiler developer, I can't really help with this.

emhartner

  • New Member
  • *
  • Posts: 43
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #8 on: February 16, 2021, 10:56:49 pm »
Quote
That seems to be an Xorg library: https://github.com/freedesktop/xorg-libXtst

Perhaps lhelp has no native Cocoa support? You can always try installing XQuartz to get the macOS port of Xorg, perhaps it's included there: https://www.xquartz.org/releases/index.html (get the beta to have macOS 11.0 support; and then also add /opt/X11/lib to your library search path). But I'm only a compiler developer, I can't really help with this.

Thank you so much Jonas.  After installing the xquartz beta and issuing the following to build Lazarus, I have success:
make OPT=-Fl/opt/X11/lib LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide

Thanks again.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1441
  • Former Delphi 1-7, 10.2 user
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #9 on: February 17, 2021, 05:21:39 am »
The other option is to omit the Lazarus bigide argument and build a normal IDE until the issue is resolved. I doubt Xtst is meant to be a requirement, it certainly wasn't until recently. I logged a bug.
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.1 r65070 FPC 3.3.1 r49223 macOS 11.2.3 aarch64 Xcode 12.4
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

PascalDragon

  • Hero Member
  • *****
  • Posts: 2972
  • Compiler Developer
Re: Cannot Build Latest FPC Trunk On Mac - Fatal: Syntax error
« Reply #10 on: February 17, 2021, 09:15:09 am »
I noticed that someone trying to build FPC on Windows reported the same error on February 13th.

Someone was me. I have the same error message using fpcupdeluxe, https://forum.lazarus.freepascal.org/index.php/topic,34645.msg394141.html#msg394141.
fpcupdeluxe uses fpc 3.0.4 to build this. So Don have to change that?

The recommended starting compiler is always the last released version (currently 3.2.0). The previous version might work for a while, but after some time it's too much effort to keep compatibility.

 

TinyPortal © 2005-2018