Forum > macOS / Mac OS X

ld: library not found for -lc

<< < (2/4) > >>

Cavender:
I have exactly (I think) the same problem.  But I did that install yesterday.

Last login: Wed Dec  7 09:45:23 on console
jamescavender@jamescadersimac ~ % xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" in System Settings to install updates
jamescavender@jamescadersimac ~ %

Cavender:
Further clarification:


I got a new Mac mini a few days ago with macOS Ventura Version 13.0.1 and downloaded  fpc-3.2.2-intelarm64-macosx

To test it I tried to compile a program that I had compiled and run on another
Mac with another version of fpc.  I managed to overcome some problems with assembling.

Cavender:
I have found more evidence that I didn't notice at first concerning my linking problem.

Here is what I see when I try to compile,

Free Pascal Compiler version 3.2.2 [2021/05/16] for aarch64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Darwin for AArch64
Compiling marmot.pas
Assembling marmot
Linking marmot
ld: library not found for -lc
An error occurred while linking
marmot.pas(2230,27) Error: Error while linking
marmot.pas(2230,27) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppca64 returned an error exitcode


The linker (or something) left me three files, linkfiles2063.res, link2063.res, and ppaslink.sh.

Here is linkfiles2063.res:

/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/rtl/sysinit.o
marmot.o
/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/rtl/system.o


link2063.res is long, so I am only showing you the first 8 lines and the last 5 lines:

-arch
arm64
-macosx_version_min
11.0.0
-L/usr/lib/
-L/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/httpd22/
-L/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/rtl/
-L/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/opengl/

-L/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/libgd/
-L/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/pcap/
-L/usr/local/lib/fpc/3.2.2/units/aarch64-darwin/
-L/usr/local/bin/
-lc

And here is all of ppaslink.sh:

#!/bin/sh
DoExitAsm ()
{ echo "An error occurred while assembling $1"; exit 1; }
DoExitLink ()
{ echo "An error occurred while linking $1"; exit 1; }
OFS=$IFS
IFS="
"
/usr/bin/ld        -x   -multiply_defined suppress -L. -o marmot `cat link2063.res` -filelist linkfiles2063.res
if [ $? != 0 ]; then DoExitLink ; fi
IFS=$OFS

Jonas Maebe:

--- Quote from: Cavender on December 08, 2022, 09:45:47 pm ---link2063.res is long, so I am only showing you the first 8 lines and the last 5 lines:

-arch
arm64
-macosx_version_min
11.0.0
-L/usr/lib/

--- End quote ---
This suggests that either /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk was not found, which is where the command line tools normally install the macOS SDK, or that you are using a custom (.)fpc.cfg that does not contain -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk (the /etc/fpc.cfg created by the FPC installer contains that line).

Cavender:
Thank you.

Library/Developer contains only 3 things,

jamescavender@jamescadersimac Developer % ls -a -l -F
total 0
drwxr-xr-x   5 jamescavender  staff   160 Dec  9 07:59 ./
drwx------@ 98 jamescavender  staff  3136 Dec  9 07:51 ../
drwxr-xr-x   5 jamescavender  staff   160 Dec  9 07:51 CoreSimulator/
drwxr-xr-x   2 jamescavender  staff    64 Dec  9 07:59 XCTestDevices/
drwxr-xr-x   5 jamescavender  staff   160 Dec  9 07:51 Xcode/

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version