Author Topic: Xcode 4.3, FPC 2.6 - Framework not found Carbon  (Read 11244 times)

nframeav

  • Newbie
  • Posts: 2
Xcode 4.3, FPC 2.6 - Framework not found Carbon
« on: June 12, 2012, 09:10:21 pm »
Hi all...I have recently inherited a fairly large Lazarus project and am having some trouble with the linker:

"Compiling package URLLabel 1.5" completed
"Compiling package LazControls 0.0" completed
ld: framework not found Carbon
ld: framework not found Carbon
An error occurred while linking
rcadvm.lpr(25,38) Error: Error while linking
rcadvm.lpr(25,38) Fatal: There were 1 errors compiling module, stopping

Currently installed:
OS X 10.7.4
XCode 4.3
FPC 2.6
Laz 9.30.4

Things tried so far:

Fresh installs, Xcode first...

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer //point to correct Xcode 4.3 install

Made sure to manually install Xcode command line tools before installing FPC 2.6

Read Carbon wiki: http://wiki.freepascal.org/Carbon_Interface

Tools > Configure "Build Lazarus" > Clean/build all with the following options: -k-framework -kCarbon -k-framework -kOpenGL (Build successful)

Set Project > Compiler Options > Paths > LCL Widget Type to carbon


Anyway, none of these approaches have worked. Project builds fine on Windows though! "It just works." Any suggestions?

Edit: Under Project Options > Inherited entry for LCL 1.0
LCL unit path ="/Developer/lazarus/lcl/units/i386-darwin
/Developer/lazarus/lcl/units/i386-darwin/carbon" //both present on my system

custom options = "-dLCL -dLCLcarbon"
« Last Edit: June 12, 2012, 09:31:35 pm by nframeav »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: Xcode 4.3, FPC 2.6 - Framework not found Carbon
« Reply #1 on: June 12, 2012, 09:29:04 pm »
Apparently the Carbon framework is not in your default linker framework search path for some reason (maybe that's Mac OS X 10.7-specific; I'm still on 10.6). No amount of "-k-framework -kCarbon" is going to help with that, because the compiler is already asking the linker to link against the Carbon framework. It's the linker that is complaining that it can't find it.

The easiest way to resolve this is probably to add the compiler parameter -XR/full/path/to/MacOSXSDK_Containing_Carbon_Framework.  There should be one under /Applications/Xcode.app/Contents/Developer/SDKs. E.g.

-XR/Applications/Xcode.app/Contents/Developer/SDKs/MacOSX10.6.sdk (if that one still exists in Xcode 4.3)

nframeav

  • Newbie
  • Posts: 2
Re: Xcode 4.3, FPC 2.6 - Framework not found Carbon
« Reply #2 on: June 12, 2012, 11:09:54 pm »
THANK YOU! Worked like a charm. If anyone else stumbles upon this error, the correct parameter (assuming Xcode 4.3 is located in Applications) is:

Project>Project Options>Compiler Options>Other>Custom Options...

-XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Xcode 4.3, FPC 2.6 - Framework not found Carbon
« Reply #3 on: February 10, 2014, 04:54:57 pm »
I know this is an old thread, but it may save someone some time who reads this to note that you should use a conditional for this if compiling on different platforms, e.g.:

Code: [Select]
if TargetOS = 'darwin' then begin
  UsageCustomOptions += ' -k-macosx_version_min -k10.5';
  UsageCustomOptions += ' -XR/Developer/SDKs/MacOSX10.5.sdk/';
end;   

I compile on Windows and Linux, and they don't understand OS X options.

Cheers,
Frederick
« Last Edit: February 10, 2014, 04:58:04 pm by Frederick »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

sparklight

  • Newbie
  • Posts: 1
Re: Xcode 4.3, FPC 2.6 - Framework not found Carbon
« Reply #4 on: March 27, 2014, 08:39:16 pm »
Project>Project Options>Compiler Options>Other>Custom Options

I'm not finding something called Project Options when I click on my project.  Using Xcode 4.3.3.  Have they changed it all around?

Frederick:
Quote
if TargetOS = 'darwin' then begin
  UsageCustomOptions += ' -k-macosx_version_min -k10.5';
  UsageCustomOptions += ' -XR/Developer/SDKs/MacOSX10.5.sdk/';
end;   

Where would you put that code in the Mac world, to get it used?

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: Xcode 4.3, FPC 2.6 - Framework not found Carbon
« Reply #5 on: March 27, 2014, 08:43:58 pm »
Those instructions are for Lazarus (this is a Lazarus forum after all), not for Xcode. In Xcode, linking the Carbon framework in a Pascal project works exactly the same as in a C/C++/Objective-C project. I don't know by heart how that needs to be done in the latest Xcode version, but I'm sure Apple's website contains instructions or maybe someone else here knows too.

 

TinyPortal © 2005-2018