Recent

Author Topic: LCL in pure FPC  (Read 6627 times)

darkpenguin

  • Newbie
  • Posts: 6
LCL in pure FPC
« on: June 09, 2017, 06:08:53 pm »
Hello,

I'm tring to use LCL 1.2.4 from pure FPC 2.6.4 from the repos on Debian Stable x86_64. (Do I need newer stuff to do it?..)

This wiki article did not help.
http://wiki.lazarus.freepascal.org/Lazarus_Faq#How_do_I_build_other_projects_based_upon_the_LCL_without_the_IDE

I did that, and I've tried everything I can think of, but still "Can't find unit Interfaces used by myprogram". I've also tried running "fpc -Fu/usr/lib/fpc/2.6.4/units/x86_64-linux/gtk2 myproject.pas" (a simple program that uses Interfaces and does nothing).

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: LCL in pure FPC
« Reply #1 on: June 09, 2017, 06:43:01 pm »
Hello darkpenguin,
Welcome to the forum.

I've just checked my Lazarus 1.8.0RC2 and I found that the interfaces.ppu and interfaces.o are not in FPC folder but they are in my "/usr/share/lazarus/1.8.0RC2/lcl/units/x86_64-linux/gtk2" folder.

The FAQ didn't say you do not need Lazarus installed. Maybe to be able to build LCL applications without the IDE, you need to install Lazarus. If you interested to try Lazarus, you can download it here:
https://sourceforge.net/projects/lazarus/files/

May I ask, why you do not want to install Lazarus?

LCL code is inside Lazarus Project. If you don't want to install Lazarus, you still can download Lazarus source code and use the LCL's code. Here you can get the source code:
https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/
« Last Edit: June 09, 2017, 07:12:47 pm by Handoko »

darkpenguin

  • Newbie
  • Posts: 6
Re: LCL in pure FPC
« Reply #2 on: June 10, 2017, 10:38:53 am »
I have Lazarus installed, but I'm looking for a way to build Lazarus projects without Lazarus. LCL is distributed as a separate package, so it's possible to install it without Lazarus. I understand that it's developed by the Lazarus team, but that's about it.

Lazarus is (apparently) just an IDE, and it's not very nice to have users install the whole IDE if they just want to build my package from sources. It's a very basic thing in the free software world: "only install the dependencies you really need". You don't have to install Eclipse IDE to build a small utility written with it, right? Lazarus is the only IDE I know of that requires you to do that for some reason.

Or rather, I'm not sure it really does require that, but I've seen this question asked several times on my quest for the truth, the answers being one of the following:
- Here is an article about how to do this. => [Link unavailable]
- Here is a FAQ about how to do this on Windows (Note: it doesn't work this way anymore).
- "You are an idiot if you are even thinking about such a ridiculous thing. Why don't you just install Lazarus and stop being a smartass?" (Or sometimes more polite versions, still boiling down to "I don't know, it just never occured to me that someone may want to build my sources without installing 400 megabytes worth of some IDE just to build it".)

Anyway, the answer is not exactly on their frontpage (or on their site, or on their forum, except a WRONG answer in this forum's FAQ), so people just assume you must install Lazarus to build Lazarus projects. And if that's true, then I can't seriously consider Lazarus to be a possible choice for me to write software with. And with this, Pascal remains little more than a "language for learning"...

(By the way, FAQ means FREQUENTLY Asked Questions, so there ARE people asking about this!)

darkpenguin

  • Newbie
  • Posts: 6
Re: LCL in pure FPC
« Reply #3 on: June 10, 2017, 10:45:40 am »
However, now that era is over, for I've found the solution, and I can document it in a developer-friendly way!

Indeed, Lazarus is "just an IDE". And it builds things using FPC through a wrapper called lazbuild. So, it is possible to build everything without installing the IDE.

On their website, it's provided as a single package, but in Debian (and therefore probably most other distributions) it is split into several packages, LCL being one of them.

What's more, the LCL package does not only include LCL, but also everything else you need to build projects created with Lazarus, including the lazbuild wrapper.

So, all you really need is:
- fp-compiler (it depends on RTL)
- FPC units you want to use in your project ( fp-units-<choose> , or simply install fpc which depends on most of them; the FPC IDE itself is only 5 MB in size)
- LCL (with --no-install-recommends since it depends on lazarus-ide )

You can simply install lcl --no-install-recommends (it depends on fp-compiler and some essential fp-units) and then add additional fp-units that you require (fp-units-gfx and fp-units-multimedia depend on quite a few development packages, but if you will probably need at least fp-units-gfx if you want to use forms in your application).

After that, you can use lazbuild to build your project - without the Lazarus IDE, documentation and fpc sources (that's several hundred megabytes).



If you want to avoid using lazbuild for some reason, then all you need to do is manually specify the compiler options, including unit directories, to fpc. (Or include them in fpc.cfg , but this is probably not going to be much help.)

To find out which options does Lazarus pass to the compiler for building your project, open "Project Options" and click "Show options" in the bottom of the window (at least that's how I did it on Lazarus 1.2.4). You can copy those options and use them in your Makefile . At least I have successfully built my "Hello World" with one form and one button this way.

The paths will vary greatly on different systems, so it's probably to use scripts to build them. And of course, LCL is (at least by default) located in the Lazarus directory and not in the FPC directory, so the FAQ on this forum gives the wrong paths. Also, you will most likely need at least three paths and not one - the same as you see in the Windows part.

It would probably be good if someone edited the FAQ, or even better, linked it to this post (or copied the post there) for sake of completeness (to also explain "Why would I want this" and other things).

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: LCL in pure FPC
« Reply #4 on: June 10, 2017, 10:52:55 am »
I have to admit that several of the wiki pages are outdated. FPC and Lazarus are community projects, they depends on volunteers.

darkpenguin

  • Newbie
  • Posts: 6
Re: LCL in pure FPC
« Reply #5 on: June 10, 2017, 11:36:45 am »
I've already registered at the wiki and started sniffing around, but since it's my first wiki registration ever, I probably shouldn't touch anything without discussing it with a senior wiki member first; first of all, I would like to ask whether should I mess up the current page about this topic ( Using the LCL without Lazarus ) or create a separate Linux page. Is there a way to reach one of the wiki moderators who is still active?..

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: LCL in pure FPC
« Reply #6 on: June 10, 2017, 11:48:42 am »
Is there anything wrong in the text? I was roughly reading it, and it seems to be correct. Maybe the version numbers should be updated (but you seem to use a fairly old version as well - if you don't run tests with a current version, don't touch the version numbers). Edit the site if you know something is not correct.

Add a section on Linux. If you prefer a separate page, link both sites together.

I'm not a wiki moderator, so just my 2ct...

darkpenguin

  • Newbie
  • Posts: 6
Re: LCL in pure FPC
« Reply #7 on: June 10, 2017, 11:59:30 am »
The "wrong" thing is in the FAQ (the Linux part). There is only one path given for Linux instead of at least three, and even that one is wrong. :)

On the wiki page, it's not "wrong" - it's just Windows-only. :) On Linux, the problem is very different - it's mostly about "how to avoid having users install so many dependencies when building my project from sources", not just "how to install Lazarus and not use it".

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: LCL in pure FPC
« Reply #8 on: June 10, 2017, 12:07:02 pm »
Please do it, add it or change it. We will be very happy if someone willing to improve it.
Thank you  O:-)

darkpenguin

  • Newbie
  • Posts: 6
Re: LCL in pure FPC
« Reply #9 on: June 10, 2017, 07:18:04 pm »

Carver413

  • Full Member
  • ***
  • Posts: 119
Re: LCL in pure FPC
« Reply #10 on: June 10, 2017, 09:02:50 pm »
you might want to talk to the maintainer of Fpcupdeluxe and see if it can be added to the install list.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: LCL in pure FPC
« Reply #11 on: June 11, 2017, 01:19:50 pm »
Hello.

You may also build Lazarus project (lpi) with ideU ( https://github.com/fredvs/ideU ).
Or create a ideU project using LCL.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018