Forum > macOS / Mac OS X

[Solved] 2.2.0 will not compile on macOS, Error: Id: framework not found Cocoa

(1/1)

ArminLinder:
After having been Mac-absent for a couple of months now, I tried to do a quick installation of the latest Lazarus 2.2.0 on macOS Big Sur. Failed. the Lazarus and FPC packages installed fine, but when trying to compile anything, including the IDE, the process fails, and this is the log (e.g. when trying to rebuild Lazarus (normal IDE))

Build IDE: Exit code 2, Errors: 3
Error: ld: framework not found Cocoa
An error occurred while linking
Error: Error while linking
make[2]: *** [lazarus] Error 1
make[1]: *** [idepkg] Error 2
Error: make: *** [idepkg] Error 2

Bah. Yes, the Xcode-Tools are installed. Proof:

xcode-select --install says:

xcode-select: error: command line tools are already installed, use "Software Update" to install update

and xcode-select -v says:

xcode-select version 2384

and xcode-select -p says

/Library/Developer/CommandLineTools

and ls -R /Library/Developer/CommandLineTools lists tons of files.

Mac pros ... any ideas?

Armin.

P.S. More Info:

I switched the program (which btw is the auto-generated empty unit Unit1; program) to qt, qt5, gtk2 ... all fail as well.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Compile Project, Target: /Users/linder-mac11/tmp/project1: Exit code 1, Errors: 2Error: ld: library not found for -lcAn error occurred while linking Error: Error while linking 

ArminLinder:
Hi,

I have an urgend problem: I needed to compile an old program of mine for the Mac. I installed MacOS Big Sur in a VM, installed the XCode-Tools and the Lazarus and FPC packages.

Lazarus starts fine, but as soon as I try to compile anything, the build process breaks:

Compile Project, Target: /Users/linder-mac11/tmp/project1: Exit code 1, Errors: 2
Error: ld: framework not found Cocoa
An error occurred while linking
Error: Error while linking

The standard assumption about what's wrong seems to be that the XCode Command Line tools are missing, I installed it and verified the installation in various ways (e.g. xcode-select -v
responding "xcode-select version 2384", executed clang -v, gcc -v, git -v -- all of these display some info so they are installed), so I came to the conclusion that the issue is caused by something else.

About - Compoile project says:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Compile Project, Target: /Users/linder-mac11/tmp/project1 Compile Reason: State file "/Users/linder-mac11/tmp/lib/x86_64-darwin/project1.compiled" of Project is missing.  Executable: /usr/local/bin/fpc CurrentDirectory is test build directory:/Users/linder-mac11/tmp/ Parameters:-B-MObjFPC-Scghi-O1-gw-gl-k-framework-kCocoa-l-vewnhibq-Fi/Users/linder-mac11/tmp/lib/x86_64-darwin-Fu/Users/linder-mac11/.lazarus/lib/units/x86_64-darwin/cocoa-Fu/Applications/Lazarus/lcl/units/x86_64-darwin-Fu/Applications/Lazarus/components/freetype/lib/x86_64-darwin-Fu/Applications/Lazarus/components/lazutils/lib/x86_64-darwin-Fu/Applications/Lazarus/packager/units/x86_64-darwin-FU/Users/linder-mac11/tmp/lib/x86_64-darwin/-FE/Users/linder-mac11/tmp/-o/Users/linder-mac11/tmp/project1-dLCL-dLCLcocoa/Users/linder-mac11/tmp/project1.lpr Command Line:/usr/local/bin/fpc -B -MObjFPC -Scghi -O1 -gw -gl -k-framework -kCocoa -l -vewnhibq -Fi/Users/linder-mac11/tmp/lib/x86_64-darwin -Fu/Users/linder-mac11/.lazarus/lib/units/x86_64-darwin/cocoa -Fu/Applications/Lazarus/lcl/units/x86_64-darwin -Fu/Applications/Lazarus/components/freetype/lib/x86_64-darwin -Fu/Applications/Lazarus/components/lazutils/lib/x86_64-darwin -Fu/Applications/Lazarus/packager/units/x86_64-darwin -FU/Users/linder-mac11/tmp/lib/x86_64-darwin/ -FE/Users/linder-mac11/tmp/ -o/Users/linder-mac11/tmp/project1 -dLCL -dLCLcocoa /Users/linder-mac11/tmp/project1.lpr Parsers: make, FPC ProcessID:1189 ExitCode:1ExitStatus:256 Error: Exit code 1 
If I execute the above fpc command in a terminal, I get:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Hint: (11030) Start of reading config file /etc/fpc.cfgHint: (11031) End of reading config file /etc/fpc.cfgFree Pascal Compiler version 3.2.2 [2021/05/16] for x86_64Copyright (c) 1993-2021 by Florian Klaempfl and others(1002) Target OS: Darwin for x86_64(3104) Compiling /Users/linder-mac11/tmp/project1.lpr(3104) Compiling ./tmp/unit1.pas(9009) Assembling unit1(9009) Assembling project1(9022) Compiling resource /Users/linder-mac11/tmp/lib/x86_64-darwin/project1.or(9015) Linking /Users/linder-mac11/tmp/project1ld: framework not found CocoaAn error occurred while linking Error: (9013) Error while linkingFatal: (10026) There were 1 errors compiling module, stoppingFatal: (1018) Compilation abortedError: /usr/local/bin/ppcx64 returned an error exitcode 
Seems to be an issue with the linker. Is there more logging available somewhere so I can possibly find out more about what exactly is failing?

Thnx, Armin.

Jonas Maebe:
Is the target architecture set to x86-64 (as opposed to i386)? And/or is the compiler in Lazarus set to either /usr/local/bin/fpc or "/usr/local/lib/fpc/3.2.2/ppcx64 (as opposed to /usr/local/lib/fpc/3.2.2/ppc386)?

trev:
Check your /etc/fpc.cfg for -XR and -Fl options.

In /etc/fpc.cfg you should have:

-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

If the Wiki instructions are followed, all this should already exist. If they don't, then I'd uninstall and start again.

ArminLinder:
Resolved.

Since it was a VM, I reset it to a snapshot taken before installing Lazarus and the XCode tools, and tried again. I swear, I used the same packages, and did everything in exactly the same order, like shown in the Wiki.

This time, I succeeded.

This is good, because I can start working now, and bad, since the cause of the issue cannot be found any more.

Thanks for your attempts to help,

Armin.

Navigation

[0] Message Index

Go to full version