# Can you use free pascal , fpc with qt5 bindings on freebsd ?



## Alain De Vos (Oct 1, 2020)

(title). If so how do you install and compile a "helloworld" ?
PS a link : https://wiki.lazarus.freepascal.org/Qt5_Interface


----------



## Crivens (Oct 1, 2020)

The command line works. What QT5 does, no idea.
I quite like fpc, wish we had some projects with it...


----------



## trev (Oct 2, 2020)

To build a GUI helloworld vs a command line helloworld, you would normally install the Lazarus IDE which allows the use of the various widgets sets like GTK and QT.

I started a FreeBSD Portal on the FPC + Lazarus Wiki, though I have to confess that I've spent most of my time on the macOS Portal as FreeBSD is a road much less travelled.


----------



## Zvoni (Oct 2, 2020)

Now would you look at that: Hi trev 
Fancy seeing you here......
Alain --> Don't forget libqt5pas
As trev said: Install Lazarus --> i recommend using fpcupdeluxe for that
fpcupdeluxe
--> There is a version for FreeBSD12
Download, put it somewhere accessible ("Downloads"), fire it up, "standard" install-path is in your Home-Dir (e.g. /home/Alain/fpcupdeluxe).
As for what to install: me personally i'm using FPC/Lazarus "fixes", trunk is the dev-branch, stable is the "official" release

Get files/libraries neccessary for QT5, write code, compile, have fun.


----------



## cobata (May 29, 2021)

trev said:


> trev said:
> 
> 
> > To build a GUI helloworld vs a command line helloworld, you would normally install the Lazarus IDE which allows the use of the various widgets sets like GTK and QT.
> ...


hi trev,

(you people are doing awesome work...)

My question is, can we have both lazarus and lazarus-qt5, because I would like to can build for GTK and Qt without the need to rebuild all the staff, but just to start the needed IDE. I saw that the pkgs differ by two archives (lazarus-qt5 adds more 2)? With other words can we have both in independent manner? Another question relating to that is, why the both variants are, is there some reason, for example the IDE for GTK on FreeBSD to can not be rebuild for Qt, and because of that is the need of the two variants?

regards


----------



## trev (May 30, 2021)

I don't know the answer to the GTK/QT5 quesion as I only use GTK everywhere. You could contact the package maintainer who should be able to answer the question.


----------



## mark_j (May 30, 2021)

cobata said:


> hi trev,
> 
> (you people are doing awesome work...)
> 
> ...


They are both packages: editors/lazarus and editors/lazarus-qt5, if that's what you mean. You can also build them from ports with your own recipe.

If you mean installing both and switching between the two, that is possible but I don't know how Lazarus accomplishes that. It "should" be as easy as selecting your build/interface/GUI library. I say, *should*.


----------



## cobata (May 30, 2021)

mark_j said:


> They are both packages: editors/lazarus and editors/lazarus-qt5, if that's what you mean. You can also build them from ports with your own recipe.
> 
> If you mean installing both and switching between the two, that is possible but I don't know how Lazarus accomplishes that. It "should" be as easy as selecting your build/interface/GUI library. I say, *should*.


Yes, mark_j, that's the question, they have to use different configurations: installation dir, config file... after the installation and I do not know is this taken in account to can do clear second installation of lazarus-qt5 (I am tried the IDE on Win, Mac, Lin and there the IDE has just one variant and on Win I am managed to have different versions with different fpc compiler versions to can experiment with the newest, and different cross-compilations). I will ask the maintainer to be sure for my intansion. Thanks.


----------



## mark_j (May 30, 2021)

In that case, they would likely clash.
I don't know Lazarus, but a quick look (here) says:




> That is the neat part. You decide. Lazarus is being developed to be totally and completely API independent. Once you write your code you just link it against the API widget set of your choice. If you want to use GTK+, great! If you want it to be Gnome compliant, great! As long as the interface code for the widget set you want to use is available you can link to it. If it isn't available, well you can write it.



Are they telling a fib?

Anyway, if it can't be done, then your only easy option is a jail for one and a jail for the other.


----------



## trev (May 31, 2021)

I think *cobata* knows it can be done - his issue is that Lazarus/FPC needs to recompile its units when he switches from one widgetset to another. I think he wants to avoid this recompilation time/delay.

This being the case, I think the solution might be to investigate using fpcupdeluxe to install and not using the FreeBSD ports system. Each fpcupdeluxe installation is sequestered in its own directory. I've never used it, but from what I've read it should do the trick. See: https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2t


----------



## cobata (May 31, 2021)

trev said:


> I think *cobata* knows it can be done - his issue is that Lazarus/FPC needs to recompile its units when he switches from one widgetset to another. I think he wants to avoid this recompilation time/delay.
> 
> This being the case, I think the solution might be to investigate using fpcupdeluxe to install and not using the FreeBSD ports system. Each fpcupdeluxe installation is sequestered in its own directory. I've never used it, but from what I've read it should do the trick. See: https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2t


Yes, trev, the recompilation time/delay I would like to avoid and also to be sure that lazarus-qt5 is not more than a Qt variant of the same lazarus (like lazarus(-gtk2)), which I could achieve by lazarus(-gtk2) recompilation with Qt widgetset.
Thank you for fpcupdeluxe, it will be useful tool for my intension. I saw that no version for FreeBSD 13 is released, but I will have it in account for sure. Thank you!


----------



## cobata (May 31, 2021)

I asked, I am sharing my observations during the experiments:
1. lazarus(-gtk2) can not be rebuild with Qt widgetset without the archive/pkg qt5pas from lazarus-qt5, because of linking failure, but just with this pkg install qt5pas all is done.
2. It is some kind of workaround, to have both lazarus for gtk and qt at same time (thanks to FreeBSD filesystem, user permissions, etc.): if you use more often lazarus(-gtk2) then rebuild it as root and then as normal user with gtk2 - at this moment you will have two lazarus(-gtk2) ide executables in /usr/local/share/lazarus-2.0.10/ and in
/usr/home/you/.lazarus/bin/, and when you are asked, update the lazarus configuration; then rebuild it only as root with qt5; when you start the ide as normal user you will be asked which lazarus to use (with paths and build dates shown) and also you will be asked to update or not to update the lazarus configuration - here, do not update it (/usr/home/you/.lazarus/), because you will use it for /usr/home/you/.lazarus/bin/lazarus(-gtk2); finally you can delete all lazarus.old builds -- with other words, gtk lazarus ide and configuration I keep in my home and use them for gtk by starting them as normal user, but qt lazarus ide and configuration are in /usr/local/share/lazarus-2.0.10/ and /root/.lazarus/ and could use them for qt by starting them as normal user and with pcp option set (look it in the asking dialog).


----------

