Recent

Author Topic: [Solved] 2.2.0 will not compile on macOS, Error: Id: framework not found Cocoa  (Read 546 times)

Nimral

  • Sr. Member
  • ****
  • Posts: 251
  • Keep it simple.
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  [Select][+][-]
  1. Compile Project, Target: /Users/linder-mac11/tmp/project1: Exit code 1, Errors: 2
  2. Error: ld: library not found for -lc
  3. An error occurred while linking
  4. Error: Error while linking
  5.  
« Last Edit: March 23, 2022, 10:06:21 am by Nimral »
Lazarus 2.2.0 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

Nimral

  • Sr. Member
  • ****
  • Posts: 251
  • Keep it simple.
Lazarus: logging/debugging the build process
« Reply #1 on: March 22, 2022, 05:45:01 pm »
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  [Select][+][-]
  1. Compile Project, Target: /Users/linder-mac11/tmp/project1
  2.  
  3. Compile Reason: State file "/Users/linder-mac11/tmp/lib/x86_64-darwin/project1.compiled" of Project is missing.
  4.  
  5.  
  6. Executable:
  7. /usr/local/bin/fpc
  8.  
  9. CurrentDirectory is test build directory:
  10. /Users/linder-mac11/tmp/
  11.  
  12. Parameters:
  13. -B
  14. -MObjFPC
  15. -Scghi
  16. -O1
  17. -gw
  18. -gl
  19. -k-framework
  20. -kCocoa
  21. -l
  22. -vewnhibq
  23. -Fi/Users/linder-mac11/tmp/lib/x86_64-darwin
  24. -Fu/Users/linder-mac11/.lazarus/lib/units/x86_64-darwin/cocoa
  25. -Fu/Applications/Lazarus/lcl/units/x86_64-darwin
  26. -Fu/Applications/Lazarus/components/freetype/lib/x86_64-darwin
  27. -Fu/Applications/Lazarus/components/lazutils/lib/x86_64-darwin
  28. -Fu/Applications/Lazarus/packager/units/x86_64-darwin
  29. -FU/Users/linder-mac11/tmp/lib/x86_64-darwin/
  30. -FE/Users/linder-mac11/tmp/
  31. -o/Users/linder-mac11/tmp/project1
  32. -dLCL
  33. -dLCLcocoa
  34. /Users/linder-mac11/tmp/project1.lpr
  35.  
  36. Command Line:
  37. /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
  38.  
  39. Parsers: make, FPC
  40.  
  41. ProcessID:
  42. 1189
  43.  
  44. ExitCode:
  45. 1
  46. ExitStatus:
  47. 256
  48.  
  49. Error: Exit code 1
  50.  

If I execute the above fpc command in a terminal, I get:

Code: Pascal  [Select][+][-]
  1. Hint: (11030) Start of reading config file /etc/fpc.cfg
  2. Hint: (11031) End of reading config file /etc/fpc.cfg
  3. Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
  4. Copyright (c) 1993-2021 by Florian Klaempfl and others
  5. (1002) Target OS: Darwin for x86_64
  6. (3104) Compiling /Users/linder-mac11/tmp/project1.lpr
  7. (3104) Compiling ./tmp/unit1.pas
  8. (9009) Assembling unit1
  9. (9009) Assembling project1
  10. (9022) Compiling resource /Users/linder-mac11/tmp/lib/x86_64-darwin/project1.or
  11. (9015) Linking /Users/linder-mac11/tmp/project1
  12. ld: framework not found Cocoa
  13. An error occurred while linking
  14. Error: (9013) Error while linking
  15. Fatal: (10026) There were 1 errors compiling module, stopping
  16. Fatal: (1018) Compilation aborted
  17. Error: /usr/local/bin/ppcx64 returned an error exitcode
  18.  

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.
« Last Edit: March 22, 2022, 05:48:23 pm by Nimral »
Lazarus 2.2.0 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 970
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1983
  • Former Delphi 1-7, 10.2 user
Re: Lazarus: logging/debugging the build process
« Reply #3 on: March 22, 2022, 11:13:32 pm »
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.
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

Nimral

  • Sr. Member
  • ****
  • Posts: 251
  • Keep it simple.
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.
Lazarus 2.2.0 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

 

TinyPortal © 2005-2018