Recent

Author Topic: Missing LibC when trying to build FPC  (Read 3793 times)

RenewedRebecca

  • New member
  • *
  • Posts: 7
Missing LibC when trying to build FPC
« on: December 29, 2021, 03:21:11 am »
I have fpcbuild-3.2.2 installed in a directory and I'm trying to build it. 

To do the build, from ~/fpcbuild-3.2.2 I typed:    make IDE=1 all
(Note: it doesn't work if I remove the IDE=1 either)

Things mostly work ok, until the end, where I'm getting this error:

ld: library not found for -lc
An error occurred while linking
pp.pas(252,36) Error: Error while linking
pp.pas(252,36) Fatal: There were 1 errors compiling module, stopping


Any ideas?  I'm on macOS 12.1 on intel.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Missing LibC when trying to build FPC
« Reply #1 on: December 29, 2021, 03:30:08 am »
How did you install FPC?

RenewedRebecca

  • New member
  • *
  • Posts: 7
Re: Missing LibC when trying to build FPC
« Reply #2 on: December 29, 2021, 03:46:14 am »
How did you install FPC?

Through Homebrew:

brew install fpc-laz fpc-src-laz

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Missing LibC when trying to build FPC
« Reply #3 on: December 29, 2021, 04:23:58 am »
I suspected you hadn't used the official installer(s). Other users have had problems when using Homebrew.

So you have a choice, you can try fixing the errors one-by-one or remove the current installation (I assume Homebrew has a way to do this?) and use the official installers.

You mention trying to make the FPC text IDE - as far as I'm aware this is not supported (and is unlikely to work) under macOS.

The preferred IDE option is the Lazarus IDE which also provides GUI controls and components but can equally be used for pure-FPC command line applications. I generally use Lazarus for GUI applications and the vi text editor for pure-FPC ones.

If you decide to install just FPC using the official installers, see the Wiki article Installing the Free Pascal Compiler on macOS.

If you decide to install the Lazarus IDE and FPC using the official installers, see the Wiki artcile Installing Lazarus on macOS.

The Wiki contains a lot of useful macOS information and code - see The Mac Portal.




RenewedRebecca

  • New member
  • *
  • Posts: 7
Re: Missing LibC when trying to build FPC
« Reply #4 on: December 29, 2021, 04:44:24 am »
Thanks- I'll uninstall via home-brew and reinstall via the official packages.


mischi

  • Full Member
  • ***
  • Posts: 170
Re: Missing LibC when trying to build FPC
« Reply #5 on: December 29, 2021, 09:37:43 am »
In case, you are still stuck. Here come some explanations and suggestions how to fix.

This missing libc error shows up on macOS 11 and up, because the default linker path does not contain the sdk any longer, but must be stated explicitly. It can be resolved by adding the option
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
either to the command in the command line or to the general or local config file of fpc ($PREFIX/etc/fpc.cfg or ~/.fpc.cfg).

I maintain the package descriptions on macports and fink and have resolved this issue. At the moment, macports version of fpc is 3.2.2, but does on Intel only and not on arm. I have submitted a fix for arm yesterday and expect it to be accepted within days.

The package description for fink has 3.2.2 and it works, but fink is still experimental on macOS 11 and up.

MiSchi.

 

TinyPortal © 2005-2018