Lazarus
Installation => macOS / Mac OS X => Topic started by: spaceman on August 10, 2010, 03:49:07 pm
-
Hi guys,
Just installed Lazarus on snow leopard, just tried to run a empty form and get the following error. Does anybody know how I fix this?
program Project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, LResources
{ you can add units after this };
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin
{$I project1.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Thanks
Shane
-
http://wiki.lazarus.freepascal.org/Lazarus_Faq
-
If it is freshly installed this error shouldn't appear.
Which FPC version and Lazarus version did you install?
-
In the project inspector, is the "LCL" listed as dependency for you project? (how did you create the project? Project => New Project => Application?)
Does your installation, or your project path contain spaces, or non latin chars (like accented, umlauts, or anything not a-z, 0-9)?
Do you use the fpc that was automatically installed with Lazarus?
Did you copy/move the Lazarus or fpc directory at any time after it was installed?
Did you recompile Lazarus?
From the msg view (where the error msg is) use the pop-up menu, copy all (including hidden) msgs.
Maybe something in there gives a detail?
-
Back to the top. This is about my so far futile attempt to get a working installation of Lazarus under OS X 10.6 on a 2 Ghz Macbook Intel Core 2 Duo with 2 Gb SDRAM.
I have Lazarus for Windows installed in my Windows 7 Bootcamp partition. A click-though installation of Lazarus for Window worked flawlessly our of the box to compile a blank form, and I have been using it for a while without issues.
A click-though installation of Lazarus for OS X, as described in the Lazarus Wiki page Installing Lazarus on Mac OS X using the disk images that the page links to simply does not work out of the box. Here are the files that I downloaded from the Wiki page link (cut and paste):
lazarus-0.9.28.2-i386-macosx.dmg
fpcsrc-2.2.4-intel-macosx.dmg
fpc-2.2.4.intel-macosx.dmg
I installed the Developer Tools with Snow Leopard. I then installed fpc, fpc-src and Lazarus from the downloaded disk images.
Lazarus threw a few errors on start up that i ignored (this is not good behavior for an app on a click-though installation). I noticed it also does not have the SQL visual component palette. Hmmm. But what really got me is that I got the same error that apparently dozens of others have encountered for the last year on trying to compile a blank form - Lazarus can't find the unit "interfaces" (that is just the first one in the "uses" statement) and gives up with a fatal error. I have been trying different things all day, all to no avail.
It seems that you should not have to set paths or anything in the IDE to compile a blank form, the installation knows where all the files that Lazarus needs to find are supposed to be, and it could be distributed set up to work.
So I guess I will wait until either (a) a click-though installation from disk images, following instructions to the letter, just works out of the box, or (b) somebody edits the Wiki page to explain precisely what one has to do to make it work.
Does this situation have a simple solution? I really want to use Lazarus on my Mac, not just Windows, but so far, no she go...
-
First, I would start with the latest 0.9.29 snapshot from the Daily Snapshots page to the left. That's very close to what the soon-to-be-released 0.9.30 will be and can be considered a release candidate.
Also be sure to install the current stable FPC 2.4.2 and its source, also from the same page.
Same with Windows if you haven't already.
Then try your example and see if it works a bit better.
Thanks.
-Phil
-
Well, I have 2.4.2 fpc and fpc-src, and I am getting lazarus 0.9.29 right now, so we'll see how it goes tomorrow and report. Thanks.
-
OK, problem solved. When a compiler tells you it can't find a unit, you need to find the unit and tell the compiler where to find it. So I used Finder to search for interfaces.ppu and located it. That tells me it also uses the interfacebase unit so I Iocated that the same way. So then I manually input the paths for these two compiled unit files in the project options, and checked the box to use this as the default for all projects, and voila, I can now compile a blank form, no more "Can't find unit interfaces" error. Like I said before, you would think whoever packages up the OS X version for distribution would distribute it with this path information in by default. It is necessary for OS X and only OS X, due to the need for Carbon. A lot of people have wasted a lot of time on this problem. Consider this a suggestion for a bug fix or whatever.
BTW, yesterday's 0.29.9 snapshot throws three broken package errors and six registration errors on a fresh install. Maybe best to go back to the last release version until the next release!
Well, I have 2.4.2 fpc and fpc-src, and I am getting lazarus 0.9.29 right now, so we'll see how it goes tomorrow and report. Thanks.
-
Did you look at the project manager and add a dependency to the LCL ?
(this is the way to solve these issues)
-
I'm sorry, I tried do that Marc, but it doesn't work. I dont know wanna do... Sorry
-
The LCL (Lazrus Component Library) dependency is already there in the standard Project1 as distributed according to the Project Inspector (I checked) - otherwise Lazarus could not find the standard units. It is just the Mac-specific Interfaces unit, "used" in the Project1 file, that throws this infamous and apparently wide-spread "Can't find unit Interfaces used by Project1" error (a Google search on it will show exactlty how many times this same question has been asked over the years). If the LCL dependency is supposed to somehow include the Interaces unit, I can tell you, it does not. I will post the paths to these two files that you need to enter specifically in Project Options | Paths | Other Units in order to enable Lazarus to do anything whatsoever on the Mac later (I unfortunately find myself in the hospital today for an unanticipated angiogram and likely angioplasty).
Did you look at the project manager and add a dependency to the LCL ?
(this is the way to solve these issues)
-
(I unfortunately find myself in the hospital today for an unanticipated angiogram and likely angioplasty).
Get well soon. This problem can wait and should be eminently solvable.
Thanks.
-Phil
-
Thanks, home from hospital, feel like I have been hit by a Mack truck.
Anyway, here is what I did to get Lazarus to be able to compile a blank form on my Macbook.
First I went to Project Options: Project Options | Compiler Options | Paths | Other Unit Files - added all available paths in the path editor, still got same error. One of the choices for "other units" was a path template that looks like it would convert to the same thing I ended up with, and there also is a combo box for LCL Widget type, but these simply do not work to solve the problem.
So I searched with Finder for interfaces.ppu. It turns out there are seven files with that name, three for PowerPC using gtk, gtk2 or Carbon, three for Intel using gtk, gtk2 or Carbon, and finally one for "nogui." The one I wanted was the one for Carbon on an Intel Mac, so I copied the path from Get Info in the Finder.
Then I added the path, /Developer/lazarus/lcl/units/i386-darwin/carbon, to "Other Unit Files", error now is "Can't find unit "interfacebase".
So I searched again for interfacebase.ppu, of which there are two - one for PowerPC and one for Intel. So again I copied the path to the Intel unit.
Here is the complete "Other Unit Files" entry to make Lazarus able to compile a blank form:
/Developer/lazarus/lcl/units/i386-darwin;/Developer/lazarus/lcl/units/i386-darwin/carbon
SUCCESSFUL BUILD OF BLANK FORM!
So I checked the box to use these options for all projects.
-
Thanks, home from hospital, feel like I have been hit by a Mack truck.
Anyway, here is what I did to get Lazarus to be able to compile a blank form on my Macbook.
Welcome back.
None of that is needed if you have Lazarus set up correctly.
Make sure you have the path to Lazarus set in Environment Options.
The only other things that affect what Lazarus looks for are the widgetset (should be set to default Carbon) and packages (make sure LCL is selected in Project Inspector). Both of these are set by default, so in a new project based on File | New Project Application, you should not have to set them.
Thanks.
-Phil
-
Well, I understand what you are saying. But the thing is, I have now installed Lazarus for OS X on my Macbook, for Windows in my Bootcamp drive and for Linux on my little netbook running Ubuntu Netbook Remix. Installing the official distributions works out of the box for Windows and Linux (for Linux, it was necessary to use the GetLaz script from the installation wiki rather than apt-get or synaptic, but it worked nonetheless). The official distribution of Lazarus for OS X, on the other hand, when you simply install the disk images for fpc, fpc-src and lazarus, does not work. As dozens of people have noted, out of the box when you try to compile a blank form, it throws the "Can't find unit Interfaces used by Project1" error. So I don't think they actually are set by default in the official distribution. I am using Bootcamp right now, but I will go back any play on the Mac side a bit more to see if I am missing something. Thanks!
Welcome back.
None of that is needed if you have Lazarus set up correctly.
Make sure you have the path to Lazarus set in Environment Options.
The only other things that affect what Lazarus looks for are the widgetset (should be set to default Carbon) and packages (make sure LCL is selected in Project Inspector). Both of these are set by default, so in a new project based on File | New Project Application, you should not have to set them.
Thanks.
-Phil
-
Well, there certainly is something strange or inconsistent going on here.
I had done a fresh install of Lazarus from the disk images in the correct order (fpc, fpc-src and lazarus):
lazarus-0.9.28.2-i386-macosx.dmg
fpcsrc-2.2.4-intel-macosx.dmg
fpc-2.2.4.intel-macosx.dmg
And I like others received the "Can't find unit Interface used by Project1" error right out of the box. Hence my posts.
I just checked (re-checked actually) what options the default installation set, and it did set the default options as follows, and it did compile a blank form from Project1 without errors:
Environment | Options
Lazarus directory: /Developer/Lazarus
Compiler path: /usr/local/bin/ppc386
FPC Source: /usr/local/share/fpcsrc
Project | Options
All paths blank
LCL Widget Type: default (Carbon beta)
Project | Inspector
Required Packages
LCL
But I and dozens other are not hallucinating when we say we have done the very same install before and tried to compile Project1 to a blank form and received the "Can't find unit Interfaces used by Project1" error.
I guess this may just fade into the sunset until somebody else brings it up again...
-
Any reason why you're not using Laz 0.9.29 and FPC 2.4.2?
I don't think you'll get much help for a version that few are using anymore.
Thanks.
-Phil
-
Any reason why you're not using Laz 0.9.29 and FPC 2.4.2?
I don't think you'll get much help for a version that few are using anymore.
Phil, 0.9.28.2 is still the latest stable release.
http://sourceforge.net/projects/lazarus/files/
-
Yeah. Can you solve this?
Thanks.
-Phil
-
Yeah. Can you solve this?
Me? I can't afford a Mac. ;-)
But he could try a snapshot: http://www.hu.freepascal.org/lazarus/
-
Already recommended that - hence my question.
Thanks.
-Phil
-
Hi,
I was having this problem until I caught up, read the FAQ issue on this, and DOWNGRADED TO OLD SOFTWARE!! Please, can someone roll a new release??
The problem I am now having with linking is this:
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.2.4 [2009/04/05] for powerpc
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Darwin for PowerPC
Compiling /tmp/project1.lpr
Compiling unit1.pas
Assembling unit1
Assembling project1
Linking /tmp/project1
/usr/bin/ld: /System/Library/Frameworks/Carbon.framework/Carbon load command 7 unknown cmd field
/usr/bin/ld: /System/Library/Frameworks/OpenGL.framework/OpenGL load command 7 unknown cmd field
/usr/bin/ld: /usr/lib//libiconv.dylib load command 7 unknown cmd field
/usr/bin/ld: /usr/lib//libc.dylib unknown flags (type) of section 9 (__TEXT,__dof_plockstat) in load command 0
/usr/bin/ld: /System/Library/Frameworks/Carbon.framework/Carbon load command 7 unknown cmd field
/usr/bin/ld: /System/Library/Frameworks/AGL.framework/AGL load command 7 unknown cmd field
/usr/bin/ld: /System/Library/Frameworks/OpenGL.framework/OpenGL load command 7 unknown cmd field
An error occurred while linking
Error: Error while linking
What am I doing wrong?
TIA.
-
Just for a future reference, I had the very same problems as Pat but was finally able to solve them.
This is the context. Under Snow Leopard (10.6.8 ), I did a fresh installation of the following DMG files (downloaded from the Lazarus Sourceforge page):
- fpc-2.4.2.intel-macosx.dmg
- fpcsrc-2.4.2.intel-macosx.dmg
- lazarus-0.9.30.2-i386-macosx.dmg
and installed them in this order. Creating a blank project using Project|New Project… and then choosing "Application", the same error message seen by Pat about the missing "interfaces" unit appears. I checked the settings for Lazarus and the project (which I did
not change) and everything seemed ok:
- The LCL is listed as a required package in the Project|Project inspector window;
- Under Project|Project Options… I see these paths in the Compiler Options|Paths page: nothing for Other Unit Files, $(ProjOutDir) for Include Files, nothing for Libraries, lib/$(TargetCPU)-$(TargetOS) for Unit output directory. I also see that the LCL widget type is default (carbon);
- From the command line I am able to start FPC, and it matches the version of the DMG I downloaded from the Lazarus site (2.4.2 [2010/11/09] for i386).
- Under Environment|Options… I have /Developer/lazarus/ for Lazarus directory, /usr/local/bin/ppc386 for Compiler path, /usr/local/share/fpcsrc/ for FPC source directory and /tmp for Directory for building test projects.
I was able to solve the problem by recompiling the LCL following the instructions at this page: http://www.lazarussupport.com/lazarus/weblog/can-not-find-unit-interfaces (http://www.lazarussupport.com/lazarus/weblog/can-not-find-unit-interfaces).
[/list]