Lazarus

Installation => macOS / Mac OS X => Topic started by: ArriveSoft on December 11, 2009, 05:46:32 pm

Title: Lazarus can't find FPC
Post by: ArriveSoft on December 11, 2009, 05:46:32 pm
I am trying to set up a MacBook OS X 10.6.1 with Lazarus and FPC.

First, Lazarus installed without a problem and is working... unless I try to compile.

Second, the FPC installer (fpc-2.2.4.Intel-macosx.pkg) said it installed successfully.  Also XCode.

But, Lazarus cannot find FPC.  Neither can I.

Should I re-install Lazarus?
What directory did FPC get installed to?  All I can find is the FPC documentation at Developer/Documentation/Free Pascal Compiler.

Title: Re: Lazarus can't find FPC
Post by: Phil on December 11, 2009, 06:06:14 pm
In Lazarus, choose Environment | Options and make sure the paths are correct. Typically you would set compiler path to:

/usr/local/bin/ppc386

FPC source directory:

/usr/local/share/fpcsrc

Make path:

/usr/bin/make

See if that helps any.

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: lrflew on December 13, 2009, 11:07:14 pm
I need help with this too. 

In Lazarus, choose Environment | Options and make sure the paths are correct. Typically you would set compiler path to:

/usr/local/bin/ppc386

FPC source directory:

/usr/local/share/fpcsrc

Make path:

/usr/bin/make

See if that helps any.

Thanks.

-Phil


No that didn't work. 
Title: Re: Lazarus can't find FPC
Post by: Phil on December 13, 2009, 11:11:23 pm
I need help with this too. 

No that didn't work. 

Please provide more information.

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: ArriveSoft on December 14, 2009, 10:43:35 pm
/usr/local/bin/ppc386 worked.

But, there was no fpcsrc directory in ../share.
Instead, I only found usr/local/share/src which contains
fpc-2.2.4/demo/

Lazarus says, "Invalid Free Pascal source directory".

So, I'm one step closer, but not there yet.
Title: Re: Lazarus can't find FPC
Post by: Phil on December 14, 2009, 10:51:53 pm
You did install the fpcsrc package too, didn't you?

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: ArriveSoft on December 15, 2009, 09:15:32 pm
You did install the fpcsrc package too, didn't you?

Thanks.

-Phil


No, but I just downloaded the source files.  They are all now located in my Download directory.  How can I create the /usr/local/share/fpcsrc directory and transfer all of the files to there?

Or where is the package located that installs the source files to the
correct place?

Thank you.
Title: Re: Lazarus can't find FPC
Post by: Phil on December 15, 2009, 09:32:32 pm
Use the fpcsrc .dmg for the fpc compiler .dmg that you installed.

To use SVN source, compile from source too.

If you want to use the latest FPC trunk source (2.5.1), an easy way to get that is:

- Get install_objp.sh script from this site:

    http://www.thealchemistguild.org/objp.php

- Open install_objp.sh in TextEdit and change the first line (if needed) from
  branches/objp to trunk.
 
- Open a Terminal window and cd to where install_objp.sh is located and enter:
 
- chmod +x install_objp.sh

- sudo ./install_objp.sh

This will download FPC 2.5.1 under /Developer/ObjectivePascal.

To download and build Lazarus from latest SVN trunk:

cd ~/lazarus (or wherever you want it)
svn co http://svn.freepascal.org/svn/lazarus/trunk .
make FPC=/usr/local/lib/fpc/2.5.1/ppc386

Start Lazarus and on Environment | Options:

Compiler path:  /usr/local/lib/fpc/2.5.1/ppc386
FPC source directory:  /Developer/ObjectivePascal/fpc/
Make path:  /usr/bin/make

If you're just starting out, you might be better off just using the stable .dmg's (0.9.28.2 / FPC 2.2.4). However, if you want to start working with the new support for Cocoa classes, you'll need 2.5.1.

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: ArriveSoft on December 17, 2009, 08:16:45 pm
I successfully installed 0.9.29 and fpc and fpcsrc and Lazarus found them.

I don't know what Cocoa is, so that will be for further study.

Now, what happens is:

Unit Unit1;
{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, Menus;
type   <<< unit1.pas(13,36) Error: Assembler not found, switching to external assembling

One step closer to being able to use Pascal via Lazarus.
Title: Re: Lazarus can't find FPC
Post by: Phil on December 17, 2009, 08:22:46 pm
I successfully installed 0.9.29 and fpc and fpcsrc and Lazarus found them.

I don't know what Cocoa is, so that will be for further study.

Now, what happens is:

Unit Unit1;
{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, Menus;
type   <<< unit1.pas(13,36) Error: Assembler not found, switching to external assembling

One step closer to being able to use Pascal via Lazarus.


What exactly did you install? 0.9.28 from snapshot or SVN? FPC from snapshot (2.2.4) or SVN (2.5.1)?

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: Jonas Maebe on December 17, 2009, 11:23:41 pm
type   <<< unit1.pas(13,36) Error: Assembler not found, switching to external assembling

One step closer to being able to use Pascal via Lazarus.


The above error suggests that you deselected support for UNIX development when you installed Xcode. As the readme on the official FPC installation disk images mentions, you must have installed this for FPC to work (and the official FPC versions will actually refuse to install if you didn't install support for UNIX development, but the Lazarus-packaged versions unfortunately don't include such a check in the installer).

So the solution is: relaunch the Xcode installer and this time do not deselect any of the options that are checked by default.
Title: Re: Lazarus can't find FPC
Post by: Phil on December 17, 2009, 11:33:30 pm
Should that be posted as a Lazarus bug? The Lazarus FPC installer really should at least warn about this - in this case, that's probably all that should have been necessary for him to be able to fix it.

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: Jonas Maebe on December 17, 2009, 11:37:04 pm
Should that be posted as a Lazarus bug?

Probably, yes. The check that the FPC installer does is to simply look whether "/usr/bin/gcc" exists. Other possible checks are /usr/bin/as and/or /usr/bin/ld.
Title: Re: Lazarus can't find FPC
Post by: Phil on December 17, 2009, 11:41:59 pm
I don't know what Cocoa is, so that will be for further study.

Here's one link:

http://wiki.freepascal.org/FPC_PasCocoa#Objective-C_FPC_Compiler

The ability to work directly with ObjC (and Cocoa) classes in FPC is for me probably the most interesting thing to happen with FPC.

The other place to start is Apple's voluminous on-line docs on the Cocoa (NS) classes.

If you've built 2.5.1 and want to try out a simple Cocoa app that is structured in a way that should make sense to Delphi/Laz folks, download NoNib.zip from here. It includes a little readme.txt file that you might want to look at:

http://web.fastermac.net/~MacPgmr/Lazarus/

You might ask, what's the advantage of this over a Lazarus GUI app? Well, no dependency on LCL, very small executables, etc. - this is the real thing. Lazarus is still very important for cross-platform apps, but if you're doing a Mac-only app, or an iPhone app, or just doing a separate Mac UI for a cross-platform app, this is the way to do it.

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: ArriveSoft on December 18, 2009, 07:17:42 pm
type   <<< unit1.pas(13,36) Error: Assembler not found, switching to external assembling

One step closer to being able to use Pascal via Lazarus.


The above error suggests that you deselected support for UNIX development when you installed Xcode. As the readme on the official FPC installation disk images mentions, you must have installed this for FPC to work (and the official FPC versions will actually refuse to install if you didn't install support for UNIX development, but the Lazarus-packaged versions unfortunately don't include such a check in the installer).

So the solution is: relaunch the Xcode installer and this time do not deselect any of the options that are checked by default.

I reinstalled fpc-xcode-2.24.pkg.  It asked no questions about Unix this time, it just re-installed, and the problem remains.

Everything is now compiling OK with the Quick Compile, but the executable can't be created.

Thanks.
Title: Re: Lazarus can't find FPC
Post by: skalogryz on December 18, 2009, 07:22:00 pm
are you sure you have the assembler and the linker installed with XCode, at /usr/bin/as and/or /usr/bin/ld?
Title: Re: Lazarus can't find FPC
Post by: Jonas Maebe on December 18, 2009, 07:22:56 pm
The above error suggests that you deselected support for UNIX development when you installed Xcode. As the readme on the official FPC installation disk images mentions, you must have installed this for FPC to work (and the official FPC versions will actually refuse to install if you didn't install support for UNIX development, but the Lazarus-packaged versions unfortunately don't include such a check in the installer).

So the solution is: relaunch the Xcode installer and this time do not deselect any of the options that are checked by default.

I reinstalled fpc-xcode-2.24.pkg.  It asked no questions about Unix this time, it just re-installed, and the problem remains.
fpc-xcode-2.2.4.pkg does not install Xcode. It installs templates for use with the Xcode IDE (see the included readme, or the text in the introduction screen that the installer shows when you open that installation package).

Xcode is the name of Apple's IDE and related development tools. It's located on your Mac OS X installation DVD, and newer versions can be downloaded from https://connect.apple.com after registering for a free account (or if you already have an Apple account from the Apple Store or iTunes Store, you can probably use that one as well).
Title: Re: Lazarus can't find FPC
Post by: ArriveSoft on December 19, 2009, 01:22:38 am

fpc-xcode-2.2.4.pkg does not install Xcode. It installs templates for use with the Xcode IDE (see the included readme, or the text in the introduction screen that the installer shows when you open that installation package).

Xcode is the name of Apple's IDE and related development tools. It's located on your Mac OS X installation DVD, and newer versions can be downloaded from https://connect.apple.com after registering for a free account (or if you already have an Apple account from the Apple Store or iTunes Store, you can probably use that one as well).

Wonderful, I downloaded XCode and now almost have Lazarus and all of its associated components installed.

After installing XCode for the first time, Lazarus now creates an Executable.
   Project "Project1" successfully built

Unfortunately, it is just a "Unix Executable file", not an application that displays the Form.  Am I setting something wrong when I am creating the project?
Title: Re: Lazarus can't find FPC
Post by: Marc on December 19, 2009, 01:27:49 am
I guess you need to create an app bundle, see Project -> Project options, first tab
Title: Re: Lazarus can't find FPC
Post by: ArriveSoft on December 22, 2009, 05:02:52 am
When I click "Build All", it compiles and says "Success...".
When I click on "Create Application Bundle", nothing happens.  I guess this is good.

When I run the project, it says "Debugger Error" - save your work now!

The last lines of the debugger output are:
*stopped,time={wallclock="0.73039",user="0.45286",system="0.23570",start="1261454017.266843",end="1261454017.997232"},reason="breakpoint-hit",commands="no",times="1",bkptno="1",thread-id="1"

(gdb)
<info program>
&"info program\n"
macosx_debug_inferior_status: current status:
              inferior task: 0x4003
                [SIGNAL THREAD]

macosx_debug_inferior_status: information on debugger task:
macosx_debug_inferior_status: information on inferior task:
macosx_debug_inferior_status: information on debugger threads:
  thread: 0x613
  thread: 0x1703
  thread: 0x1b03
  thread: 0x2003
  thread: 0x3903
  thread: 0x4203
  thread: 0x4403
macosx_debug_inferior_status: information on inferior threads:
  thread: 0x4103
~"Program stopped at 0x29d7.\n"
~"It stopped at a breakpoint that has since been deleted.\n"
~"Type \"info stack\" or \"info registers\" for more information.\n"
^done
(gdb)
<-gdb-exit>

I am so close,...
Title: Re: Lazarus can't find FPC
Post by: ArriveSoft on December 22, 2009, 05:17:39 am
Although Run does not yet work, a working Application file was created alongside the Unix file,..
 so I am now in business. 

>> This is solved. <<

Thanks to everyone for your help.
Title: Re: Lazarus can't find FPC
Post by: Marc on December 22, 2009, 10:54:54 am
see the Lazarus & Debugger oops etc (http://www.lazarus.freepascal.org/index.php/topic,7411.0.html) thread.
its resolved in r23192
Title: Re: Lazarus can't find FPC
Post by: Phil on December 22, 2009, 04:36:38 pm
Although Run does not yet work, a working Application file was created alongside the Unix file,..
 so I am now in business. 

>> This is solved. <<

Thanks to everyone for your help.

For some reason, Run only works the second time you run a new app on OS X. The first time it creates the app bundle, but does not run. The second time it should run okay. If not, please file a bug report.

Not sure why it takes two runs with OS X.

Thanks.

-Phil
Title: Re: Lazarus can't find FPC
Post by: Bolkonskij on April 02, 2010, 02:39:53 pm
Hey everyone,

didn't want to open up a new thread so I'll post here. I have the same trouble about Lazarus not being able to find the FPC. I haven't been able to locate FPC manually either.

I am using a PPC iMac G4 with OS X 10.4.11. I have installed: (all PPC versions)

- Xcode 2.4.1
- Lazarus 0.9.28.2
- fpc 2.2.4
- fpcscr 2.2.4

Can anyone push me into the right direction and help me out with how to get the compiler to work? Thanks a lot :)

(edit: found the same problem here http://www.lazarus.freepascal.org/index.php/topic,5689.0.html , suggested solution (reinstalling) did not work either)
Title: Re: Lazarus can't find FPC
Post by: Marc on April 03, 2010, 02:11:11 am
how and where did you install fpc ?
How did you configure lazarus to tell where that fpc version is located (environment options)
Title: Re: Lazarus can't find FPC
Post by: Bolkonskij on April 03, 2010, 05:00:44 pm
Hi Marc,

I installed it from .pkg. Like I said, I have no idea where it installed itself to other than onto my harddisk. (There was no way to chose a path during the installation)
I couldn't track it down manually and the suggested directions here (and in other threads) wouldn't help.

What's the default place ?
Title: Re: Lazarus can't find FPC
Post by: Jonas Maebe on April 03, 2010, 05:27:30 pm
I installed it from .pkg.

But which .pkg? Where did you download it from? (I guess from sourceforge?)

In any case, please use the FPC installer from ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/powerpc-macosx/fpc-2.2.4.powerpc-macosx.dmg (you can use the lazarus and fpcsrc releases from the Lazarus download pages in conjunction with this one)

The Mac OS X packages of the FPC releases distributed by the Lazarus team sometimes contain errors. There is an open bug report to remove them from their download pages, but this hasn't been done yet.

Quote
What's the default place ?

/usr/local/bin (helper utilities)
/use/local/lib/fpc (version-specific files)
TinyPortal © 2005-2018