Recent

Author Topic: Fatal: Can't find unit interfaces used by project1  (Read 51886 times)

spaceman

  • Newbie
  • Posts: 2
Fatal: Can't find unit interfaces used by project1
« 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

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Lazarus/FPC on Linux

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Fatal: Can't find unit interfaces used by project1
« Reply #2 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?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9908
  • Debugger - SynEdit - and more
    • wiki
Re: Fatal: Can't find unit interfaces used by project1
« Reply #3 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?


Pat Anderson

  • Newbie
  • Posts: 3
Re: Fatal: Can't find unit interfaces used by project1
« Reply #4 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...

« Last Edit: February 06, 2011, 01:15:53 am by Pat Anderson »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Fatal: Can't find unit interfaces used by project1
« Reply #5 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

Pat Anderson

  • Newbie
  • Posts: 3
Re: Fatal: Can't find unit interfaces used by project1
« Reply #6 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.

anderson5420

  • New Member
  • *
  • Posts: 16
Re: Fatal: Can't find unit interfaces used by project1
« Reply #7 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.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
Re: Fatal: Can't find unit interfaces used by project1
« Reply #8 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)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Jopeh

  • Newbie
  • Posts: 6
Re: Fatal: Can't find unit interfaces used by project1
« Reply #9 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

anderson5420

  • New Member
  • *
  • Posts: 16
Re: Fatal: Can't find unit interfaces used by project1
« Reply #10 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)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Fatal: Can't find unit interfaces used by project1
« Reply #11 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

Pat Anderson

  • Newbie
  • Posts: 3
Re: Fatal: Can't find unit interfaces used by project1
« Reply #12 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.



« Last Edit: February 10, 2011, 05:13:21 pm by Pat Anderson »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Fatal: Can't find unit interfaces used by project1
« Reply #13 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

anderson5420

  • New Member
  • *
  • Posts: 16
Re: Fatal: Can't find unit interfaces used by project1
« Reply #14 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


 

TinyPortal © 2005-2018