Lazarus

Miscellaneous => Other => Topic started by: jules.d on August 07, 2022, 05:33:06 pm

Title: Error building fpGUI
Post by: jules.d on August 07, 2022, 05:33:06 pm
Hi, I'm new to freepascal although I did program in TP back in the 90s. I'm using Linux 64 (a Debian bullseye based distro), and am gettting an error message when compiling fpGUI 1.4.1 downloaded from sourceforge.

I've installed the prerequisites as per the readme, and this is what I get when running the build script :

Compiling X11 CoreLib
Free Pascal Compiler version 3.2.2+dfsg-9~bpo11+1 [2022/02/21] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling corelib/x11/fpgui_toolkit.pas
Compiling ./corelib/fpg_base.pas
Compiling corelib/x11/fpg_x11.pas
fpg_x11.pas(730,25) Hint: Local variable "AtomPair" does not seem to be initialized
fpg_x11.pas(1042,18) Hint: Local variable "msgp" does not seem to be initialized
fpg_x11.pas(1069,18) Error: Can't determine which overloaded function to call
math.pp(2075,10) Hint: Found declaration: Min(QWord;QWord):QWord;
math.pp(2059,10) Hint: Found declaration: Min(Int64;Int64):Int64;
fpg_x11.pas(1233,24) Hint: Local variable "msgp" does not seem to be initialized
fpg_x11.pas(1253,14) Note: User defined: We need to replace this message with a resouce string
fpg_x11.pas(1292,15) Hint: Local variable "Msg" does not seem to be initialized
fpg_x11.pas(1329,15) Hint: Local variable "Msg" does not seem to be initialized
fpg_x11.pas(1562,39) Hint: Local variable "rw" does not seem to be initialized
fpg_x11.pas(1635,16) Hint: Local variable "s" of a managed type does not seem to be initialized
fpg_x11.pas(1705,16) Hint: Local variable "msgp" does not seem to be initialized
fpg_x11.pas(2323,20) Hint: Local variable "ar1" of a managed type does not seem to be initialized
fpg_x11.pas(2334,18) Hint: Local variable "ar2" of a managed type does not seem to be initialized
fpg_x11.pas(2366,25) Warning: Symbol "RootWindow" is not portable
fpg_x11.pas(2368,16) Hint: Local variable "attr" does not seem to be initialized
fpg_x11.pas(2445,17) Hint: Local variable "hints" does not seem to be initialized
fpg_x11.pas(2842,87) Hint: Local variable "extents" does not seem to be initialized
fpg_x11.pas(2857,87) Hint: Local variable "extents" does not seem to be initialized
fpg_x11.pas(3561,20) Warning: Symbol "RootWindow" is not portable
fpg_x11.pas(3614,33) Hint: Local variable "info" does not seem to be initialized
fpg_x11.pas(3842,17) Hint: Local variable "xev" does not seem to be initialized
fpg_x11.pas(3996,14) Hint: Local variable "ev" does not seem to be initialized
fpg_x11.pas(4046) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode

Any help appreciated.
Title: Re: Error building fpGUI
Post by: MarkMLl on August 07, 2022, 05:57:26 pm
Welcome to the forum :-)

I can't help directly, but to get the ball rolling I think the pertinent points are that you've got fpGUI 1.4.1 plus FPC 3.2.2 hence

Code: [Select]
fpg_x11.pas(1069,18) Error: Can't determine which overloaded function to call
math.pp(2075,10) Hint: Found declaration: Min(QWord;QWord):QWord;
math.pp(2059,10) Hint: Found declaration: Min(Int64;Int64):Int64;

Sourceforge puts a date of 2015-09-02 on fpGUI 1.4.1, which was I think was in the reign of FPC 2.6. So what's probably happened is that Min() has gained an overloaded function since then, i.e. originally it only supported 64-bit signed integers and it has since gained 64-bit unsigned (or vice versa).

If nobody else crops up before your patience starts fraying, take a look at the source line with the error and try to work out whether to cast the parameters using either QWord() or Int64(). Otherwise, if you're really hard up, it might be worth downgrading the compiler to 2.6.4... but I'd really not recommend that.

MarkMLl
Title: Re: Error building fpGUI
Post by: sketch on August 07, 2022, 06:10:53 pm
I'm running Ubuntu 22.04 LTS and fpc 3.2.2.  I get the same error using 1.4.1 from Sourceforge, but this worked:

 678  git clone https://github.com/graemeg/fpGUI.git
 679  sudo apt-get install fp-units-i386
 680  sudo apt-get install libx11-dev
 681  sudo apt-get install libxft-dev
 682  cd fpGUI/
 686  cd src/
 687  ./build.sh
Title: Re: Error building fpGUI
Post by: MarkMLl on August 07, 2022, 06:42:13 pm
Yes, that's probably the way to go. I'd forgotten that the author had gittish tendencies... but in any event I think it's fair to criticise him for not documenting the expected compiler version in the release notes, and for leaving an outdated version on SF without warning.

I'd note that a lot of people are wary of the FPC release from Debian, and instead prefer to use Debian to provide the prerequisites (build-essential, gdb and so on) and then use the current/stable compiler provided by the FPC project as a tar archive. Same goes for the Lazarus IDE: most people quite simply build from source (and the last I saw Debian actually had a package versioning problem in what they were shipping).

MarkMLl
Title: Re: Error building fpGUI
Post by: jules.d on August 07, 2022, 08:36:48 pm
Thanks for the input guys. So I've compiled the libraries and also the corelib and gui programs in the examples folder, but the build failed in the apps folder with the following error message :

Doing docedit in ./docedit
./compileall.sh: 9: cd: can't cd to ./docedit
Fatal: Unable to open file extrafpc.cfg
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
Doing hexview in ./hexviewer
Fatal: Unable to open file extrafpc.cfg
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode


How do I build the uidesigner? I assume this is a kind of visual designer which lets you drag and drop gui elements, like lazarus. The documentation is pretty sketchy. There's a tutorial in docs/quick_guide but the file has a strange extension (.ipf) and it's not easy to read.

I notice that some of the files in the uidesigner folder have .lpi and .lpr extensions. Does this mean that I need lazarus to compile it?

Like I said, I'm new to Free pascal and the last time I did any programming was in 1998, in Turbo pascal, so I'm probably getting ahead of myself, although I've written a few terminal programs in the last few days and looked at the documentation, which I'm finding a bit overwhelming.

Sorry to be so clueless.  :-[

Title: Re: Error building fpGUI
Post by: Fred vS on August 07, 2022, 09:43:38 pm
Thanks for the input guys. So I've compiled the libraries and also the corelib and gui programs in the examples folder, but the build failed in the apps folder with the following error message :
Doing docedit in ./docedit
./compileall.sh: 9: cd: can't cd to ./docedit

Indeed, I just try it and script fails trying to enter /docedit directory.  %)
Very strange, so I did Cut that directory and then all other examples compile ok.
Dont forget to add the /fpGUI/src/extrafpc.cfg file into /fpGUI/examples/apps/

How do I build the uidesigner?

Code: Pascal  [Select][+][-]
  1. > cd /directory_of/fpGUI/uidesigner
  2.  
  3. > fpc @extrafpc.cfg uidesigner.lpr

You may also use the "extended" version of fpGUI designer.
https://github.com/fredvs/uidesigner_ext/releases

I notice that some of the files in the uidesigner folder have .lpi and .lpr extensions. Does this mean that I need lazarus to compile it?

No, you dont need Lazarus to compile fpGUI projects but using a IDE like Lazarus (and his lpi file) will be a great help for debugging.

(You may also use the ṕrj files with the IDE MSEide or ideU).

Fre;D
Title: Re: Error building fpGUI
Post by: MarkMLl on August 07, 2022, 09:54:33 pm
Doing docedit in ./docedit
./compileall.sh: 9: cd: can't cd to ./docedit
...
Doing hexview in ./hexviewer

Do those directories already exist anywhere? It might be that you need to create them manually, or that you're starting off in the wrong directory ("you won't get there from here").

Quote
How do I build the uidesigner? I assume this is a kind of visual designer which lets you drag and drop gui elements, like lazarus. The documentation is pretty sketchy. There's a tutorial in docs/quick_guide but the file has a strange extension (.ipf) and it's not easy to read.

I notice that some of the files in the uidesigner folder have .lpi and .lpr extensions. Does this mean that I need lazarus to compile it?

.ipf: I've got a sketchy recollection that Graeme was an OS/2 fan, and that's an OS/2 helpfile format.

You're correct in associating .lpi with Lazarus: that's a Project Information file and either the Lazarus IDE or the lazbuild program should be able to handle it...

Quote
Like I said, I'm new to Free pascal and the last time I did any programming was in 1998, in Turbo pascal, so I'm probably getting ahead of myself, although I've written a few terminal programs in the last few days and looked at the documentation, which I'm finding a bit overwhelming.

Sorry to be so clueless.  :-[

...however, allowing for how much grief that stuff is giving you you might be better off starting off with Lazarus, which (I can assure you) is a fairly decent IDE.

I think you said you'd already got FPC 3.2.2, in which case I suggest you build Lazarus from source using e.g. https://sourceforge.net/projects/lazarus/files/latest/download : there's known issues with some distreaux's packaging.

MarkMLl
Title: Re: Error building fpGUI
Post by: MarkMLl on August 07, 2022, 09:56:17 pm
Indeed, I just try it and script fails trying to enter /docedit directory.  %)

Fred, I suggest you either bring the SF repo up to date, or tell people where to get the live version.

MarkMLl
Title: Re: Error building fpGUI
Post by: Fred vS on August 07, 2022, 10:10:55 pm
Indeed, I just try it and script fails trying to enter /docedit directory.  %)

Fred, I suggest you either bring the SF repo up to date, or tell people where to get the live version.

MarkMLl

Hello Mark.

I am not maintainer of fpGUI and Graeme seems very busy, many pull-request are waiting on fpGUI-GitHub...

 :-[

Title: Re: Error building fpGUI
Post by: MarkMLl on August 07, 2022, 10:18:59 pm
I am not maintainer of fpGUI and Graeme seems very busy, many pull-request are waiting on fpGUI-GitHub...

In that case I suggest keeping your head /well/ below the parapet.

Seems like a case of githubris to me...

MarkMLl
Title: Re: Error building fpGUI
Post by: Fred vS on August 07, 2022, 10:25:41 pm
I hope all is OK with Graeme.

His last commit was in April of last year.
https://github.com/graemeg/fpGUI/commits/develop
Title: Re: Error building fpGUI
Post by: MarkMLl on August 07, 2022, 10:34:28 pm
I hope all is OK with Graeme.

His last commit was in April of last year.
https://github.com/graemeg/fpGUI/commits/develop

:-( As do we all. But at this point- getting on for 18 months in- I think we need to start thinking about remedial action to avoid the overall community looking bad: at the very least the repo pointed to by https://en.wikipedia.org/wiki/FpGUI needs to be fixed. Does the FPC website itself have any links to the old SF stuff?

MarkMLl
Title: Re: Error building fpGUI
Post by: jules.d on August 08, 2022, 09:36:54 am
Thanks again Fred & Mark for the advice. I got fpGUI working with the uidesigner but I think you're right in that I'll find Lazarus easier to begin with. I never learned OOP with Turbo  pascal so I have some studying to do before I understand classes etc, which I need to know in order to use fpGUI. At least in Lazarus you're shielded from that to a certain extent and can create software without knowing much about what goes on under the hood.

By the way, there is a link to the fpGUI github site under the "General" tab, but it's not at all clear that you should download from there rather than sourceforge.

I tried installing the qt version (I'm using KDE plasma) of Lazarus using apt but got errors when compiling a simple GUI application, so I guess you're right about issues with packaging.

Quote
I think you said you'd already got FPC 3.2.2, in which case I suggest you build Lazarus from source using e.g. https://sourceforge.net/projects/lazarus/files/latest/download : there's known issues with some distreaux's packaging.

So that deb file is the lazarus source, correct? How can I compile the qt version?

Title: Re: Error building fpGUI
Post by: MarkMLl on August 08, 2022, 10:00:04 am
I'd suggest uninstalling (from the Debian POV) the Lazarus you got via apt or whatever.

You will however need the libqt5pas1 package or similar depending on your Debian version.

Code: Text  [Select][+][-]
  1. $ apt-cache search -n libqt | grep pas
  2. libqt5pas-dev - Development files for Qt5Pas
  3. libqt5pas1 - Qt5 interface bindings for Pascal
  4. libqt5keychain1 - Qt API to store passwords (QT5 version)
  5.  

Download https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/ and put it into somewhere suitable (I'm not sure how orthodox this is, but I usually have a user-writable directory e.g. /usr/local/share/lazarus-stable and then set up symlinks to the binaries in /usr/local/bin).

If getting to grips with it for the first time or on a new system, I suggest a sequence like this, making sure that each step completes

Code: [Select]
make all
make clean
make bigide
make clean
make LCL_PLATFORM=qt bigide

"all" will give you the basic IDE and LCL. "bigide" will do the same but add on more components etc. The final step will do the same but for Qt.

YMMV, but that's what works for me.

I'd add that I really don't know what compelling advantage FPGui has over the LCL, other than that it's arguably lighter-weight.

It has however always struck me as unfortunate that Linux didn't have a text-mode UI builder using Curses etc., i.e. something like MS Visual Basic for DOS, or like the better "4GLs" that were popular in the '90s.

Having a proper form editor, plus database support etc., which /didn't/ demand fancy graphical output, really could have been the killer app that Linux (and FPC) needed.

The industry didn't go that way, and now we've got an enormously complex stack of compositor, server, widget set...

MarkMLl
Title: Re: Error building fpGUI
Post by: toby on December 29, 2022, 12:29:57 am
12/28/22

Hi,

i am using fpgfilesize function in my code which is in the fpgui unit so i got the exact same error when i recompiled my program on a 64bit linux system using fpc-3.2.2 (i had originally used fpc-3.1.1 (i think) on a 32bit linux system with fpgui-1.4.1 for previously working compile)

on 64bit linux using fpc-3.2.2 with fpgui-1.4.1 i got
fpg_x11.pas(1099,18) Error: Can't determine which overloaded function to call
math.pp(2075,10) Hint: Found declaration: Min(QWord;QWord):QWord;
math.pp(2059,10) Hint: Found declaration: Min(Int64;Int64):Int64;

-

i didn't see an fpgui update as a solution now (since fpgui version is now 1.5 in the develop.zip)

dillo https://github.com/graemeg/fpGUI/archive/refs/heads/develop.zip

-

specifically this is what i did to get my fpgfilesize/fpgui/fpg_x11.pas to compile

unzip develop.zip

ls fpGUI-develop/src
3rdparty   buildcrosslinux32.sh  build.sh         corelib       fpmake.pp  gui           VERSION_FILE.inc
build.bat  buildcrosswin32.sh    build_wince.bat  extrafpc.cfg  fpreport   reportengine

mv /usr/local/fpc/units/fpgui /usr/local/fpc/units/fpgui-1.4.1
mkdir /usr/local/fpc/units/fpgui
cp fpGUI-develop/src/corelib /usr/local/fpc/units/fpgui
cp fpGUI-develop/src/gui /usr/local/fpc/units/fpgui

i didn't want to change my /etc/fpc.cfg for -Fi for the following .inc so i did
cp fpGUI-develop/src/corelib/fpg_defines.inc /usr/local/fpc/units/fpgui/corelib/x11/fpg_defines.inc
cp fpGUI-develop/src/VERSION_FILE.inc /usr/local/fpc/units/fpgui/corelib/x11/VERSION_FILE.inc
cp fpGUI-develop/src/3rdparty/regex/synregexpr.pas /usr/local/fpc/units/fpgui/corelib/x11/synregexpr.pas

---
Title: Re: Error building fpGUI
Post by: Fred vS on December 29, 2022, 12:36:43 am
@ Toby: Did you try to compile with fpc 3.2.2.? (afaik fpGUI follows only the last release of fpc)
Title: Re: Error building fpGUI
Post by: toby on December 29, 2022, 12:53:26 am

yes Fred vS i used fpc-3.2.2 pm a 64bit linux system with the fpgui-1.5 in the new/current develop.zip


sorry i didn't make that clear

i should have used the following line instead of what i did use

"i didn't see an fpgui update to fpgui-1.5 as a solution now using fpc-3.2.2 (since fpgui version is now 1.5 in the develop.zip)"

-
Title: Re: Error building fpGUI
Post by: Fred vS on December 29, 2022, 02:00:24 am
i am using fpgfilesize function in my code which is in the fpgui unit so i got the exact same error when i recompiled my program on a 64bit linux system using fpc-3.2.2 (i had originally used fpc-3.1.1 (i think) on a 32bit linux system with fpgui-1.4.1 for previously working compile)

on 64bit linux using fpc-3.2.2 with fpgui-1.4.1 i got
fpg_x11.pas(1099,18) Error: Can't determine which overloaded function to call
math.pp(2075,10) Hint: Found declaration: Min(QWord;QWord):QWord;
math.pp(2059,10) Hint: Found declaration: Min(Int64;Int64):Int64;

Hello.

Tested here on Linux 64 bit with fpc 3.2.2 and last fpGUI_develop branch.

fpgfilesize function is part of the fpg_utils unit and doing this:

Code: Pascal  [Select][+][-]
  1. uses
  2. fpg_utils,
  3. ...
  4. begin
  5.  fpgfilesize(ParamStr(0));
  6. ...

Compiles without problems and run gives the right size.
Could you give the code you used?
 
Title: Re: Error building fpGUI
Post by: toby on December 30, 2022, 01:18:47 am

in my previous post i meant fpg_util as the unit having fpgfilesize and not fpgui unit
your code snippet works on all file sizes after the following

1. when using the fpgfilesize function in the fpg_util.pas unit the older fpgui version 1.4.1 fails to compile with fpc-3.2.2
   on my 64bit linux system with saee compiler error shown by the the original poster) (it compiled fine with fpc-3.1.1 on my
   previous 32bit linux system)

2. fpgui version 1.5 in the the current develop.zip at https://github.com/graemeg/fpGUI/archive/refs/heads/develop.zip
   my program using fpgfilesize function will compile on my 64bit linux system with fpc-3.2.2 fine

3. fpgfilesize function in the unit fpg_util.pas in both the older fpgui 1.4.1 and newer fpgui 1.5 both return 'integer' and
   thus when the file size of the file passed as parameter to fpgfilesize is larger then 2.14GB (longint) a range check exception
   is raised and needed to be contained)

4. editing the following files
   /usr/local/fpc/units/fpgui/corelib/fpg_utils.pas
   /usr/local/fpc/units/fpgui/corelib/x11/fpg_utils_impl.inc
   and changing the fpgfilesize function return from 'integer' to 'int64' the range check exception is fixed and not raised any more

i'm guessing you didn't assign the fpgfilesize result to a variable or writeln it with the code you gave

program fpgfs;
uses fpg_utils;
var fs : int64;
begin
fs := fpgfilesize(paramstr(1));
writeln(fs);
end.

ls -la
-rw-r--r-- 1 root root 3176935172 Dec 29 2022 11:53:34 b.mp4

fpgfs(b.mp4)   
3176935172


 

Title: Re: Error building fpGUI
Post by: Fred vS on December 30, 2022, 01:52:15 am
@Toby.

Quote
3. fpgfilesize function in the unit fpg_util.pas in both the older fpgui 1.4.1 and newer fpgui 1.5 both return 'integer' and
   thus when the file size of the file passed as parameter to fpgfilesize is larger then 2.14GB (longint) a range check exception
   is raised and needed to be contained)

4. editing the following files
   /usr/local/fpc/units/fpgui/corelib/fpg_utils.pas
   /usr/local/fpc/units/fpgui/corelib/x11/fpg_utils_impl.inc
   and changing the fpgfilesize function return from 'integer' to 'int64' the range check exception is fixed and not raised any more

Indeed, for large files the result should be int64.

Please create a issue (or better a pull request)  ( Graeme is sometime active those last time ).
https://github.com/graemeg/fpGUI/issues

Thanks.
Title: Re: Error building fpGUI
Post by: Roland57 on December 30, 2022, 03:55:37 am
Hello everybody!

Let me give my two cents.

1° To build fpGUI on Linux 64 with current stable FPC, you have to use the develop branch (of the GitHub repository) like this:

Code: Text  [Select][+][-]
  1. [roland@localhost temp]$ git clone -b develop https://github.com/graemeg/fpGUI.git
  2. ...
  3. [roland@localhost temp]$ cd fpGUI/src
  4. [roland@localhost src (develop)]$ sh build.sh
  5. Which platform are you building for?
  6.  
  7.   L - Linux
  8.   F - FreeBSD
  9.   M - Mac OSX
  10.  
  11. Enter a letter or Ctrl+C to quit: L
  12. creating directory: ../lib/x86_64-linux
  13.  
  14. Compiling for Linux
  15. Compiling X11 CoreLib
  16. Free Pascal Compiler version 3.2.0 [2020/07/05] for x86_64
  17. Copyright (c) 1993-2020 by Florian Klaempfl and others
  18. Target OS: Linux for x86-64
  19. Compiling corelib/x11/fpgui_toolkit.pas
  20. ...
  21. 147818 lines compiled, 7.0 sec
  22. 340 warning(s) issued
  23. 45 note(s) issued
  24. [roland@localhost src (develop)]$

No error, as you can see.

2° To build the apps (including the hexviewer), you have to copy extrafpc.cfg from another example:

Code: Text  [Select][+][-]
  1. [roland@localhost src (develop)]$ cd ../examples/apps
  2. [roland@localhost apps (develop)]$ cp globe/extrafpc.cfg hexviewer/

And there is a small modification to do in compileall.sh (use pushd, popd instead of cd, cd):

Code: Bash  [Select][+][-]
  1. #!/bin/sh
  2. FPC=fpc
  3. for f in `find -name '*.lpr'`
  4. do
  5.   DIR=`dirname $f`
  6.   PROJECT=`basename $f`
  7.   LPRNAME=`basename $PROJECT .lpr`
  8.   echo Doing $LPRNAME in $DIR
  9.   ##cd $DIR
  10.   pushd $DIR
  11.   if [ ! -d units ]; then
  12.     echo 'Missing units dir'
  13.     mkdir units
  14.   fi
  15.   $FPC @extrafpc.cfg $PROJECT;
  16.   ##cd ..
  17.   popd
  18. done

After that, the script build all the applications without error.

Code: Text  [Select][+][-]
  1. [roland@localhost apps (develop)]$ sh compileall.sh
TinyPortal © 2005-2018