Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile ok, running fails at beginning. #58

Open
OH1KH opened this issue Mar 7, 2024 · 7 comments
Open

Compile ok, running fails at beginning. #58

OH1KH opened this issue Mar 7, 2024 · 7 comments

Comments

@OH1KH
Copy link

OH1KH commented Mar 7, 2024

Hi!
Tried to compile this https://github.com/OH1KH/cqrlog/tree/loc_testing with QT5 widgets. At start it did not compile, but after some Googling I found that I must update libqt5pas too for my Fedora39.

After installed your rpm compile was ok, but program does not run. It dies right at start splash with QT error.
Normally I use Lazarus 2.2.6 and with that compile and run works ok. I just want to be prepared to situation where Fedora updates Lazarus to 3.x

The error is in this clip:
image

The program, when appears to start ok, claims many dependencies. Do not care. I can test it more if I just get it run a bit further.

@davidbannon
Copy link
Owner

Need a bit more info OH1KH please.

What version of Lazarus are you using ?

When you installed libqt5Pas, did you also install libqt5pas-dev ?

Do you know the version of Qt5 you have there ?

Davo

@OH1KH
Copy link
Author

OH1KH commented Mar 8, 2024

This is the test setup in virtual machine F39
image

Working daily used setup is on other machine:
[saku@hamtpad ~]$ cat /etc/fedora-release
Fedora release 38 (Thirty Eight)
[saku@hamtpad ~]$ fpc -version
[0.008] Free Pascal Compiler version 3.2.2 [2023/01/19] for x86_64
[saku@hamtpad ~]$ lazarus-ide --version
2.2.6 Revision: Unknown

qt5-qtbase-common-5.15.11-7.fc38.noarch
qt5-qtbase-5.15.11-7.fc38.x86_64
qt5pas-2.6-2020601.fc38.x86_64
qt5pas-devel-2.6-2020601.fc38.x86_64

If i trace program start the error appears when line 2258 of application.inc calls AForm.HandleNeeded

 if FMainForm = AForm then 
       AForm.Handle Needed;  

Next debugger step launches the error and debugger points to qtwidgets.pas line 5845
image

image

@davidbannon
Copy link
Owner

OK, some superficial comments before we try and drill down.

Firstly, if using Lazarus 2.2.6, you do not need to libqt5pas from this repo, thats only necessary for Lazarus 3.0 and later. However, I routinely used that libqt5pas with earlier Lazarus without any problems. Just not recommended. I'm guessing you used the Lazarus from your Fedora repo (good) ? The libqt5pas from there would have been fine.

The app you are building was initially made with Lazarus 2.0.6 ? Again guessing, I would assume that was not, then based on Qt5, Qt5 was pretty rough back then, only becoming really useful with the 2.2 series (IMHO). So. have you tried to build a GTK2 version ? (Don't, please, even think about GTK3). Generally, in theory, Lazarus is widgetset agnostic. But in practice, a larger app is bound to have a few widgetset specific tweaks.

On the other hand, if cqrlog is, out of the box, a qt5 app, disregard gtk2, its way past its use by date.

Personally, I cannot suggest a magic fix from that (well prepared) debugging info you have provided. qrllog is rather a strange beast to be honest. Apparently still under active development but using Lazarus 2.0.6 and FPC 3.0.4 ? And U20.04. Only in the last week did I finally replace my U20.04, (thats why I have been a bit slow responding by the way). But I have not used Laz 2.0.6 or FPC 3.0.4 for some years.

And you are using a Testing branch ? Testing branches have bugs ! Have you spoken to the author ?

I suggest you revert back to a clean 2.2.6 and use the distro provided libqt5pas. I doubt my newer one is a problem but just to be sure. Thats a quick test.

Next, a scary option, you could install Lazarus 2.0.6 and its Qt5 library and see if the problem you are experiencing is related to changes in Lazarus. You can get L2.0.6 from the Lazarus website but not the qt5Pas library, so, may be easier to use a VM ? You obviously have a VM system there ? Virtual Box ? Build a U20.04 VM, install its Lazarus and libqt5pas and do your testing there.

The very fact that the author of cqrlog is sticking with Lazarus 2.0.6 might mean its dependent on something that has changed in later releases. Lazarus is quite a dynamic thing, changes a lot, FPC is pretty stable by comparison.

David

@OH1KH
Copy link
Author

OH1KH commented Mar 11, 2024

Firstly. I just informed what Lazarus version works. That is 2.2.6. It ,as well as FPC, are from Lazarus-ide(sourgeforce).
The qt5pas is from Fedora repo.
That means the highest version I have used to compile cqrlog ok and produce properly running binary with QT5 widgets.

Forget the L 2.0.6 it is out of date. Has been for years and compile with later versions both GTK2 and QT5 have resulted properly running version.
The step to L3.X is defective for QT5. It compiles, but does not run any more. GTK2 compiled version still runs ok.

If this is the future all(?) program windows must be recreated to get them running with L3.x compile. I can not believe it can be so that older source does not run any more if it compiles without warnings/errors, there must be bug somewhere.
If there is something that is not backward compatible compiler should warn about that.

I am using test branch. I am author of test branch. Petr, the original author, has not been active with this program during past few years so most of develop has been done by me. I have spent hundreds, maybe some thousand hours with it.
But I think I do not need to learn how the programming tool itself works. It should produce running binary at least what comes to widget handling.
Some things, like regexp handling, has been changed along versions and must have been fixed from cqrlog source. That is understandable, but if window creating and handling fails it is not problem in cqrlog's source.
It is inside the programming tool.

@davidbannon
Copy link
Owner

OK, let me get this straight.

  1. It builds and works fine if you use Lazarus 2.2.6 from the Fedora Repository.

  2. If you install Lazarus 3.0 (or Lazarus 3.2 ?) from SourceForge AND use the libqt5pas library from here, it does not work ?

So, it seems to me like there are three possible causes of this problem. They are -

A problem in the Library here.
Something wrong in how I build libqt5pas. But so far, no one else has reported a problem like this, over a 1000 downloads of this release.
The best way to establish this is for you to build your own library using the source in the Lazarus Source package. Instructions in the source, my notes here may also be of use. Its a simple enough process but takes a fair time to build. Especially if you are used to Lazarus's very quick build times. If you have any problems, please get back to me.

A problem with Lazarus itself
Sure, things change between releases. Thats why we have new releases. But a lot of people are using Lazarus, version 3.0 is default in Debian Trixie (pre-release) and it is there in Updates for bookworm. It will be Lazarus 3.0 in the next Ubuntu LTS release in a month or so. I am not aware of anything that affects Qt5 like that.

A problem in your code
Its quite possible something "worked" in Lazarus 2.2.6 but does not in Lazarus 3.0. Sometimes code uses "undocumented features", developers are free to change those things. And sometimes, even documented things change, these are listed on the Wiki.

Finding which of the above two requires debugging the code, understanding what triggers the problem, usually making a simple demo of the problem. That usually leads to a understanding of the situation and a fix is obvious. Or, that simple demo forms the basis of a bug report. Lazarus developers respond pretty quickly to good bug reports.

Please let me know how you go with the first point above. The other two points are better directed to the FPC/Lazarus forum or bug tracker.

Davo
.

@OH1KH
Copy link
Author

OH1KH commented Mar 12, 2024

OK. I give up.
My skills are not good enough to dig out the problem from qt56.pas. It needs qt and Laz knowledge that I do not have.
Maybe some day someone makes backward compatible qt5 libraries for Laz3.x

@OH1KH OH1KH closed this as completed Mar 12, 2024
@davidbannon
Copy link
Owner

Hi OH1Kh, sorry, I did not see you had closed this until recently, hope you get this message, your branch of cq... does not have an issue facility ?

Anyway, I had a look at the project, did not get far because it requires mysql and I don't have that installed.

But there are a number of issues that need addressing, most are probably harmless but one of them may well be a pointer to your problem. These issues show up with gtk2 as well as qt5.

So, I suggest you -
Create a number of project modes, at least leave default alone, add gtk2 and qt5 release and debug modes. Use the button, "create debug and release modes" and use its debug mode for your widget set specific modes (same with release too perhaps). Then, deal with the errors the debug mode show you, overrun are particularyly bad, uninitialised vars can be bad (setlength() being the exception, its a bad definition, been in use too long to change, use the thing Lazarus offers you to hide that error on that line).

As it is at present, those problems will possibly create instability, possibly with one widget set today and a different one tomorrow.

Its a very big project, must be careful in big projects that these "little problems" don't build up. I also note it uses openssl, fpc 3.2.2 will not work with Openssl on a system unless libssl-dev is installed, I have no idea how to make it work on windows or mac. The solution is to use a FPC fixes, but that might just be another issue you don't need right now.

Just some advice.

Davo

@davidbannon davidbannon reopened this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants