Recent

Author Topic: Newbie, trying to compile an example app  (Read 16789 times)

sagerian

  • New member
  • *
  • Posts: 8
Newbie, trying to compile an example app
« on: December 04, 2010, 04:57:46 pm »
I am a newbie with linux, a newbie to programming, and obviously a newbie to lazarus.
Though it seems a complete and nice IDE to use, it's a bitch to install and get started with.
Now I want to compile the default project and I'm given an error:

project1.lpr(8,7) Fatal: Can't find unit Interfaces used by Project1

I am confused as I am not yet used to all the technical terms and package names. I would love it to just work out of the box. Nothing works, even reading the wiki or searching the net for this problem.
I installed lazarus and all the dependencies through apt-get.

OS:
Aptosid (Debian Sid based distribution)

Versions:
lazarus (0.9.28.2-12)
fpc (2.4.0-2)
lcl (0.9.28.2-12)
lcl-utils (0.9.28.2-12)


« Last Edit: December 05, 2010, 09:08:04 am by sagerian »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Newbie, trying to compile
« Reply #1 on: December 04, 2010, 05:26:38 pm »
Well, it should work out of the box. Sure you have read and try everything suggested in the wiki?

sagerian

  • New member
  • *
  • Posts: 8
Re: Newbie, trying to compile
« Reply #2 on: December 04, 2010, 05:55:44 pm »
I tried the steps described here:
http://wiki.lazarus.freepascal.org/FPC_message:_Can_not_find_unit#Can.27t_find_unit_interfaces

Well, I'll take them one step at a time:

Quote
#  Make sure the project uses the LCL package. See Project -> Project Inspector -> Required Packages. If there is no LCL click on the 'Add' button and then 'New Requirement', select the LCL and press Ok;
The LCL package is there.

Quote
#  Make sure the unit is part of the project. Use Project -> Add editor file to project;
I'm getting an info saying: "The file "project1.lpr is already part of the Project."

Quote
#  Make sure the 'interfaces.ppu' is in the unit path, and the 'interfaces.pp' is not in the unit path. And that you only have one 'interfaces.ppu' in the unit path. You can see the unit path in Source Editor -> Right mouse click -> Popup Menu -> Unit Info -> Unit Paths;
Here is an error in the wiki. The path should read: "Source Editor -> Right mouse click -> File Settings... -> Unit Info". Anyway, there I have these 3 paths:
/usr/lib/lazarus/0.9.28.2/lcl/units/i386-linux
/usr/lib/lazarus/0.9.28.2/lcl/units/i386-linux/qt
/usr/lib/lazarus/0.9.28.2/packager/units/i386-linux

Quote
#  Make sure your compiled LCL fits to the installed compiler. For example if you installed a new compiler, then the LCL must be rebuilt (for example the interfaces.ppu must be rebuilt (You must be loged in as admin to rebuild) );
I did not compile anything from source, I just installed the binaries with apt-get. I don't know what version fits with what version. The system of dependencies should solve this. That's what it is used for.

Quote
#  Make sure the project compiles the correct (current) widgetset. See Project -> Compiler Options -> Path -> LCL Widget Type (various). Change it to "default (*****)" to use default widgetset. If you don't want compiles with default widgetset, then change this value to any value, and recompile LCL to respective widgetset (win32/win64, gtk, gtk2, etc).
Well, at LCL Widgety Type (various) I have the default value, gtk2(beta).
I mean come on, the default IDE's example program should work with the default IDE's options to compile it. This is the most basic thing in the world and I am stuck in it.

Quote
#  Make sure the project compiles the correct "Target CPU". See "Project -> Compiler Options -> Code -> Target CPU (-P)" and change them to (Default) (or in blank).
This is already in blank, I set it to default an tried to compile the default example again but it did not work.


Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Newbie, trying to compile
« Reply #3 on: December 04, 2010, 07:14:17 pm »
OK, now try this: Open Compiler Options dialog->verbosity->show tried files. Then post the last 10-30 lines, I wanna know where the compiler looks for the missing files.

sagerian

  • New member
  • *
  • Posts: 8
Re: Newbie, trying to compile
« Reply #4 on: December 04, 2010, 07:37:39 pm »
I tried the "show tried files" and in the Messages window I only got one message, which I hate already:

Quote
project1.lpr(8,7) Fatal: Can't find unit Interfaces used by Project1
Is this a bug?
Anyway I unchecked that option and checked "show everything" and it started to sing like a bird about hundreds of not found files.
We might be on to something here. I hope we can fix this.
I did not want to clutter the forum with so much info, so I pasted it from Messages window to paste2.org:

Code: [Select]
http://paste2.org/p/1125084
« Last Edit: December 04, 2010, 07:40:25 pm by sagerian »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Newbie, trying to compile
« Reply #5 on: December 05, 2010, 12:49:33 am »
Lazarus 0.9.28.2 can't be compiled with FPC 2.4.0. Either use FPC 2.2.x or (better) use the development version of Lazarus from SVN.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Newbie, trying to compile
« Reply #6 on: December 05, 2010, 06:13:39 am »
Quote
I tried the "show tried files" and in the Messages window I only got one message
Have you chosen "show all and hidden messages" in the popup menu? There should be A LOT of messages there.

sagerian

  • New member
  • *
  • Posts: 8
Re: Newbie, trying to compile
« Reply #7 on: December 05, 2010, 08:30:54 am »
Quote
Lazarus 0.9.28.2 can't be compiled with FPC 2.4.0.
I am not compiling Lazarus IDE itself, I am trying to compile the default example program.


Quote
Have you chosen "show all and hidden messages" in the popup menu?
Well, I am embarrased to admit I don't know where exactly is this option, what popup menu?
The info I pasted in http://paste2.org/p/1125084 seems like a lot of info to me, being 2163 lines of messages. Should there be more?

sagerian

  • New member
  • *
  • Posts: 8
Re: Newbie, trying to compile an example app
« Reply #8 on: December 05, 2010, 10:45:40 am »
Ok, i'm trying a different approach.
Inspired by what JuhaManninen said, I deleted all the packages I downloaded with apt-get install. Everything that started with lcl*, fp* lazarus* and anything else that had any connection with the lazarus or the free pascal compiler.
I went to http://www.lazarus.freepascal.org, Daily Snapshots, and I downloaded fpc-2.4.2-0.i386.deb.tar and
lazarus-0.9.29.28625-20101205.i386.deb.tar which, uncompressed, resulted in the following files, shown here by the "ls -lh" command:

Code: [Select]
total 104M
-rw-r--r-- 1 admin admin   13K Nov 11 23:14 fpc_2.4.2-0_all.deb
-rw-r--r-- 1 admin admin  2.0M Nov 11 23:15 fp-compiler_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin   13M Nov 11 23:19 fpc-source_2.4.2-0_all.deb
-rw-r--r-- 1 admin admin  1.6M Nov 11 23:20 fp-docs_2.4.2-0_all.deb
-rw-r--r-- 1 admin admin  1.3M Nov 11 23:20 fp-ide_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  1.3M Nov 11 23:21 fp-units-base_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  1.1M Nov 11 23:21 fp-units-db_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  4.6M Nov 11 23:23 fp-units-fcl_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  461K Nov 11 23:23 fp-units-fv_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin 1008K Nov 11 23:24 fp-units-gfx_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  329K Nov 11 23:24 fp-units-gnome1_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  1.5M Nov 11 23:24 fp-units-gtk2_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  971K Nov 11 23:25 fp-units-gtk_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  461K Nov 11 23:25 fp-units-i386_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  448K Nov 11 23:25 fp-units-math_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  1.3M Nov 11 23:26 fp-units-misc_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  235K Nov 11 23:26 fp-units-multimedia_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  610K Nov 11 23:26 fp-units-net_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  2.1M Nov 11 23:27 fp-units-rtl_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin  3.7M Nov 11 23:28 fp-utils_2.4.2-0_i386.deb
-rw-r--r-- 1 admin admin   17K Dec  5 06:24 lazarus_0.9.29-0-20101205_all.deb
-rw-r--r-- 1 admin admin  2.7M Dec  5 06:25 lazarus-doc_0.9.29-0-20101205_all.deb
-rw-r--r-- 1 admin admin  5.6M Dec  5 06:17 lazarus-ide_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin  5.1M Dec  5 06:17 lazarus-ide-gtk2_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin   17K Dec  5 06:17 lazarus-ide-qt4_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin   14M Dec  5 06:24 lazarus-src_0.9.29-0-20101205_all.deb
-rw-r--r-- 1 admin admin   17K Dec  5 06:17 lcl_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin  1.5M Dec  5 06:18 lcl-gtk2_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin   46K Dec  5 06:18 lcl-nogui_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin   17K Dec  5 06:18 lcl-qt4_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin   35M Dec  5 06:18 lcl-units_0.9.29-0-20101205_i386.deb
-rw-r--r-- 1 admin admin  4.4M Dec  5 06:17 lcl-utils_0.9.29-0-20101205_i386.deb

And I installed these files with "dpkg -i ./*.*". No errors.
So now I start lazarus IDE and again I get errors:

Quote
The package "SDFLaz" is installed, but no valid package file (.lpk) was found.
A broken dummy package was created.

The package "fpcunitide" is installed, but no valid package file (.lpk) was found.
A broken dummy package was created.

The package "ProjTemplates" is installed, but no valid package file (.lpk) was found.
A broken dummy package was created.

The package "TAChartLazarusPkg" is installed, but no valid package file (.lpk) was found.
A broken dummy package was created.

The package "SQLDBLaz" is installed, but no valid package file (.lpk) was found.
A broken dummy package was created.

Unable to open the package "cgiLaz".
This package was marked for installation.

Unable to open the package "CGILazIDE".
This package was marked for installation.

However, after many OK's pressed, lazarus started and I tried to compile the default example app and I get these errors:

Quote
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.4.2-0 [2010/11/11] for i386
Copyright (c) 1993-2010 by Florian Klaempfl
Target OS: Linux for i386
Compiling /tmp/project1.lpr
Compiling unit1.pas
Compiling resource lib/i386-linux/project1.or
project1.lpr(20,1) Error: Error while compiling resources
project1.lpr(20,1) Fatal: There were 1 errors compiling module, stopping

As they don't seem to say much, I go to Project, Project Options, Verbosity, and check Show Everything and again Build project and again errors, and so many of them that I left the computer for about 5 minutes and it did not finish displaying the all, or it may be an infinite loop. My CPU is Pentium D830 at 3000 Mhz, so not the fastest and definitely not the slowest. When I try to copy from the Messages window, Klipper crashed with segmentation fault. Lazarus crashed also.

Maybe I can't figure this out because I am new to all of this, but I start to think this is lazarus' problem. There is either a big gap in documentation, or the developers are on a very very wrong path.
The installation process should be more fool proof. Because this may very well be the best IDE in the world if the users, like me, can't even install and use it.

I tried Lazarus in Windows and it works without problems. If I really had important projects to develop and had deadlines and all, in this situation I would not have a choice but go back to Windows, and STAY WITH IT, because the program I work with is not working well in Linux.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Newbie, trying to compile an example app
« Reply #9 on: December 05, 2010, 11:30:59 am »
Maybe I can't figure this out because I am new to all of this, but I start to think this is lazarus' problem. There is either a big gap in documentation, or the developers are on a very very wrong path.
The installation process should be more fool proof. Because this may very well be the best IDE in the world if the users, like me, can't even install and use it.

Yes, there should be a proper installation program. The documentation is confusing, too.
However, now that you have FPC 2.4.2 installed, installing Lazarus from SVN is rather easy. It is explained here:

  http://wiki.lazarus.freepascal.org/Getting_Lazarus#Getting_Lazarus_SVN_development_version

but it is still too long and confusing. You really only need to do this:

Code: [Select]
$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus
$ cd lazarus
$ make all
$ ./lazarus &

Subversion must be installed naturally, and also FPC sources because Lazarus will use them.
The IDE may not have all packages installed initially. You should learn to use the Tools --> Configure Build Lazarus.
Rebuild Lazarus from there after starting it first time. You need to build Lazarus also always when adding packages.

Please ask more help if there are still problems. I use the development version on Linux myself, I am sure we get it running on your machine, too.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

sagerian

  • New member
  • *
  • Posts: 8
Re: Newbie, trying to compile an example app
« Reply #10 on: December 05, 2010, 01:29:53 pm »
I installed subversion and downloaded 199 MB of sources. I compiled them and got 548 MB and when I run the ide it gives me these errors:

Quote
Unable to open the package "cgiLaz".
This package was marked for installation.

Unable to open the package "CGILazIDE".
This package was marked for installation.

After I press OK two times, the IDE starts and I try to compile the default example app, and I see the same errors as before:

Quote
project1.lpr(20,1) Error: Error while compiling resources
project1.lpr(20,1) Fatal: There were 1 errors compiling module, stopping

I try to rebuild lazarus from Tools, Configure Build Lazarus and I have another error:

Quote
This set of options to build Lazarus is not supported by this installation.
The directory "/usr/lib/lazarus/0.9.29/lcl" is not writable.
See the Lazarus website for other ways to install Lazarus.

I change the profile from Build LCL to Build All and I get this:

Quote
This set of options to build Lazarus is not supported by this installation.
The directory "/usr/lib/lazarus/0.9.29/lcl" is not writable.
See the Lazarus website for other ways to install Lazarus.

I change the profile from Build All to Build Ide with packages and I get this:

Quote
/usr/lib/lazarus/0.9.29/components/codetools/codetools.pas(32,1) Error: Can't create object file: /usr/lib/lazarus/0.9.29/components/codetools/units/i386-linux/codetools.o
/usr/lib/lazarus/0.9.29/components/codetools/codetools.pas(32,1) Fatal: Can't create object /usr/lib/lazarus/0.9.29/components/codetools/units/i386-linux/codetools.o

I change the profile from Build All to Build Ide without packages and I get this:

Quote
"Compiling package CodeTools 1.0.1" completed
/usr/lib/lazarus/0.9.29/components/lazcontrols/dividerbevel.pas(184,1) Error: Can't create object file: /usr/lib/lazarus/0.9.29/components/lazcontrols/lib/i386-linux/dividerbevel.o
/usr/lib/lazarus/0.9.29/components/lazcontrols/dividerbevel.pas(184,1) Fatal: Can't create object /usr/lib/lazarus/0.9.29/components/lazcontrols/lib/i386-linux/dividerbevel.o

lol, I think I should steer my life out of this damned software.
Learning assembly language should be far more easier in this case than setting up lazarus, given the fact that I struggle with it for 2 months already.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Newbie, trying to compile an example app
« Reply #11 on: December 05, 2010, 02:44:23 pm »
This seems to permissions problem. I always download sources and compile Lazarus in my /home/...., not in /usr/... and works well.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

AmatCoder

  • Jr. Member
  • **
  • Posts: 57
    • My site
Re: Newbie, trying to compile an example app
« Reply #12 on: December 05, 2010, 03:54:39 pm »
The problem is that when you try to run Lazarus, old Lazarus installed from deb files is executed instead of SVN version compiled by you.

First, you must uninstall lazarus deb packages which you previously installed.
 
Then, if you compiled Lazarus from SVN in some folder inside your '/home/' directory (or wherever you have write permissions), you can execute it from there.
« Last Edit: December 05, 2010, 04:09:45 pm by AmatCoder »

sagerian

  • New member
  • *
  • Posts: 8
Re: Newbie, trying to compile an example app
« Reply #13 on: December 05, 2010, 05:56:59 pm »
Quote
First, you must uninstall lazarus deb packages which you previously installed.
Yes, yes, it works now!  :o
I uninstalled all the packages starting with lazarus* and now I was able to run the IDE without any errors and compile the default example app. Yey!

Thank you all for helping me.

However, some problems/questions still remain:
- the developers should put more work in making this IDE easyer to setup for newbies
- why don't the deb packages in the Debian repository work? If they don't, why does anyone care to maintain them? Debian should keep only packages that work. I guess I'm not the only one in the world that checked Lazarus out and saw it didn't work.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Newbie, trying to compile an example app
« Reply #14 on: December 05, 2010, 06:40:35 pm »
Yes, yes, it works now!  :o
I uninstalled all the packages starting with lazarus* and now I was able to run the IDE without any errors and compile the default example app. Yey!

Great! :)

Quote
Thank you all for helping me.

However, some problems/questions still remain:
- the developers should put more work in making this IDE easyer to setup for newbies
- why don't the deb packages in the Debian repository work? If they don't, why does anyone care to maintain them? Debian should keep only packages that work. I guess I'm not the only one in the world that checked Lazarus out and saw it didn't work.

Yes, the installation should be easier.
Your problem with the Debian package was a version mismatch. Lazarus 0.9.28.2 doesn't match with FPC 2.4.0, it should be FPC 2.2.x. The coming Lazarus release will improve things so that the latest released FPC and Lazarus versions match again.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018