Lazarus

Installation => macOS / Mac OS X => Topic started by: spaceman on August 10, 2010, 03:49:07 pm

Title: Fatal: Can't find unit interfaces used by project1
Post 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
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Troodon on August 10, 2010, 04:21:46 pm
http://wiki.lazarus.freepascal.org/Lazarus_Faq
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: felipemdc on August 10, 2010, 05:35:33 pm
If it is freshly installed this error shouldn't appear.

Which FPC version and Lazarus version did you install?
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Martin_fr on August 10, 2010, 05:42:38 pm
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?

Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Pat Anderson on February 06, 2011, 01:10:41 am
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...

Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Phil on February 06, 2011, 01:21:28 am
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
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Pat Anderson on February 06, 2011, 02:31:24 am
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.
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: anderson5420 on February 08, 2011, 05:30:57 am
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.
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Marc on February 08, 2011, 11:02:49 am
Did you look at the project manager and add a dependency to the LCL ?
(this is the way to solve these issues)
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Jopeh on February 08, 2011, 01:49:31 pm
I'm sorry, I tried do that Marc, but it doesn't work. I dont know wanna do... Sorry

>:( :( %) >:D
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: anderson5420 on February 08, 2011, 02:57:26 pm
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)
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Phil on February 08, 2011, 05:04:49 pm
(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
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Pat Anderson on February 10, 2011, 05:11:30 pm
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.



Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Phil on February 10, 2011, 06:34:07 pm
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
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: anderson5420 on February 13, 2011, 03:02:42 pm
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

Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: anderson5420 on February 13, 2011, 03:50:06 pm
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...
 

Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Phil on February 15, 2011, 04:42:22 pm
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
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: theo on February 15, 2011, 05:44:25 pm
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/
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Phil on February 15, 2011, 06:13:16 pm
Yeah. Can you solve this?

Thanks.

-Phil
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: theo on February 15, 2011, 06:32:10 pm
Yeah. Can you solve this?

Me? I can't afford a Mac. ;-)

But he could try a snapshot: http://www.hu.freepascal.org/lazarus/
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Phil on February 15, 2011, 06:43:44 pm
Already recommended that - hence my question.

Thanks.

-Phil
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: WalterK on March 17, 2011, 11:08:08 pm
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.
Title: Re: Fatal: Can't find unit interfaces used by project1
Post by: Maurizio on January 10, 2012, 12:42:13 pm
not change) and everything seemed ok:

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]
TinyPortal © 2005-2018