Recent

Author Topic: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5  (Read 18226 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3410
    • StrumPract is the musicians best friend
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #90 on: June 16, 2024, 04:41:07 pm »
Are both linked on the same system?

Not sure I understand, are you talking about the application compiled and running on the same system (option 1)?
Or was the application compiled on one system and run on another system (option 2)?
Or are you talking about fpc itself which should be compiled and used on the same system that will run the application (option 3)?

For options 1 and 2 for MSEgui applications compiled on <> OpenBSD 7.5 works/runs. But not for LCL applications.

For option 3, I fear that this might be the solution but unfortunately we are not able to compile fpc itself on OpenBSD 7.5.
See: https://forum.lazarus.freepascal.org/index.php/topic,67536.msg520296.html#msg520296
« Last Edit: June 16, 2024, 04:56:25 pm by Fred vS »
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

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11935
  • FPC developer.
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #91 on: June 16, 2024, 05:39:18 pm »
Not sure I understand, are you talking about the application compiled and running on the same system (option 1)?
Or was the application compiled on one system and run on another system (option 2)?

2 vs 1,3.  As the crosscompiled binary is compiled on the another system where it was run, while 1 and 3 are not.       

Quote
Or are you talking about fpc itself which should be compiled and used on the same system that will run the application (option 3)?

Since openbsd is a libc target, in theory if laz works, so should fpc, since laz uses a superset of features from the system compared to FPC. But that also assumes FPC was compiled from release sources without patches.

Maybe for compiled fpc to work on the system itself, fpc/rtl/openbsd/x86_64/openbsd_ident.inc needs to be updated to match openbsd 7.5.    Recent FreeBSDs are sensitive in this regard, so maybe OpenBSD too.

Fred vS

  • Hero Member
  • *****
  • Posts: 3410
    • StrumPract is the musicians best friend
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #92 on: June 16, 2024, 05:49:37 pm »
The thing is that OpenBSD has his own libc from their Xenocara project.
So it is not out-of-the-box like other libc systems.
I think making the effort to make fpc fully compatible with OpenBSD is worth it.
OpenBSD chose the right direction to update X11 and have its own libc (part of the Xenocara project).
Their Xorg/Xenocara combination is a much better solution than Wayland (which breaks everything without providing any real solutions).
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

BSaidus

  • Hero Member
  • *****
  • Posts: 596
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #93 on: June 16, 2024, 06:02:31 pm »
The thing is that OpenBSD has his own libc from their Xenocara project.
So it is not out-of-the-box like other libc systems.
I think making the effort to make fpc fully compatible with OpenBSD is worth it.
OpenBSD chose the right direction to update X11 and have its own libc (part of the Xenocara project).
Their Xorg/Xenocara combination is a much better solution than Wayland (which breaks everything without providing any real solutions).
I'm agree with that.
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

TCH

  • Full Member
  • ***
  • Posts: 243
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #94 on: June 17, 2024, 07:01:52 pm »
Okay, after David told me to delete cbindings/version, libQt5Pas compiled and installed without errors. To make Lazarus (and the compiled apps) aware of it, it needed to be symlinked from /usr/local/lib/qt5/ to /usr/local/lib/, but then Lazarus could compile for it and the compiled app ran on OpenBSD 7.5 too. And unlike the GTK3 app, which was able to run, but nothing worked, the Qt5 app works.

So, it is clear now: on OpenBSD 7.5, FreePascal and Lazarus can work with GTK3 and Qt5, it's the GTK2-related Lazarus code which causes a crash in harfbuzz or in it's dependencies.

Fred vS

  • Hero Member
  • *****
  • Posts: 3410
    • StrumPract is the musicians best friend
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #95 on: June 17, 2024, 07:36:32 pm »
So, it is clear now: on OpenBSD 7.5, FreePascal and Lazarus can work with GTK3 and Qt5, it's the GTK2-related Lazarus code which causes a crash in harfbuzz or in it's dependencies.

Yeah, congratulations. you did it. ;D
I assume you need to compile GTK3 and Qt5 applications on a pre-OpenBSD 7.5. machine.
If not, how did you get fpc to work to compile applications that could run on OpenBSD 7.5. system ?
« Last Edit: June 17, 2024, 07:48:39 pm by Fred vS »
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

TCH

  • Full Member
  • ***
  • Posts: 243
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #96 on: June 17, 2024, 08:31:03 pm »
Thanks. And for the help to all of you.

I had no need for GTK3 and/or Qt5 apps on a pre-7.5 OpenBSD, since GTK2 was working perfectly.
I simply compiled my app on OpenBSD 7.4, with Lazarus 2.2.6 for Qt5. Then tried it on OpenBSD 7.5. And it worked almost without problems. (Sometimes bringing up the prefs window crashes the application, but that was on OpenBSD 7.4.)
The same happened with GTK3, except that the GTK3 app did not work without problems: it started, the window came up, but most of the widgets were invisible and also the program segfaulted at quit.

Fred vS

  • Hero Member
  • *****
  • Posts: 3410
    • StrumPract is the musicians best friend
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #97 on: June 17, 2024, 09:38:48 pm »
OK, perfect so you get a solution with Qt5 compiled on OpenBSD 7.4, that produces a working LCL app on OpenBSD 7.5.

But the combat is not yet terminated, we have to find why fpc 3.2.2. on OpenBSD 7.5. produces not running apps.
« Last Edit: June 17, 2024, 09:44:12 pm by Fred vS »
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

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11935
  • FPC developer.
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #98 on: June 17, 2024, 09:58:51 pm »
The thing is that OpenBSD has his own libc from their Xenocara project.
So it is not out-of-the-box like other libc systems.

I don't think that it is it. I think it is something with the startup code, probably related to the changeover to LLVM (or later revisions of the target after the initial change), and/or maybe something they needed for their security work. This is why I pointed to the ELF ident source file.

If you pass wrong structs (to e.g. statfs and stat, the most common libc issues), you see it in strace, and you get a nice traceback in gdb, and that doesn't seem to be the case. Renumbering IOCTLs is another common one.

If binaries from 7.4 fail in the same way on 7.5 as 7.5 native ones when you update the version in the ELF ident in that file on 7.4 to the number that native 7.5 binaries have (elfdump -n), it means that the normal 7.4 binaries run in an emulation (the so called COMPAT library sets).

This has happened before, FreeBSD binaries relied on COMPAT versions to, and in fact 3.2.2 doesn't not run natively beyond 11 or. (but fixes does run native on 13 and  14)

Quote
I think making the effort to make fpc fully compatible with OpenBSD is worth it.

Without a maintainer, it will be hard for a platform in so much flux. Anyway, if no one of you can/wants to do it, try to bundle information in bugreports, preferably in a very reproducible way. A future maintainer might take that as input.

« Last Edit: June 17, 2024, 10:01:43 pm by marcov »

TCH

  • Full Member
  • ***
  • Posts: 243
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #99 on: June 17, 2024, 10:41:52 pm »
But the combat is not yet terminated, we have to find why fpc 3.2.2. on OpenBSD 7.5. produces not running apps.
Weird. At me, FPC produces programs which run. Even Lazarus would run, except it uses GTK2 by default and thus, crashes. But lazbuild works.

Do you have a fresh 7.5 install, or you've upgraded from 7.4? At me it was the latter.
Anyway, if no one of you can/wants to do it, try to bundle information in bugreports, preferably in a very reproducible way. A future maintainer might take that as input.
I'd report this GTK2 crash, but to which project? FreePascal or Lazarus?
« Last Edit: June 17, 2024, 10:44:34 pm by TCH »

Fred vS

  • Hero Member
  • *****
  • Posts: 3410
    • StrumPract is the musicians best friend
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #100 on: June 17, 2024, 10:46:29 pm »
If binaries from 7.4 fail in the same way on 7.5 as 7.5 native ones when you update the version in the ELF ident in that file on 7.4 to the number that native 7.5 binaries have (elfdump -n), it means that the normal 7.4 binaries run in an emulation (the so called COMPAT library sets).
Hum, ok, I see, thanks for the explanation (and glad to hear that OpenBSD has a COMPAT solution).

Without a maintainer, it will be hard for a platform in so much flux. Anyway, if no one of you can/wants to do it, try to bundle information in bugreports, preferably in a very reproducible way. A future maintainer might take that as input.
I only know a little about OpenBSD as I did the conversion for MSEgui, but it was mainly the adapted libc methods.
So I don't have any skin to maintain the platform for fpc, so I could only help create a bugreport.
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

Fred vS

  • Hero Member
  • *****
  • Posts: 3410
    • StrumPract is the musicians best friend
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #101 on: June 17, 2024, 10:53:32 pm »
Weird. At me, FPC produces programs which run. Even Lazarus would run, except it uses GTK2 by default and thus, crashes. But lazbuild works.
Really, fpc 3.2.2 installed on OpenBSD 7.5 produces running apps?  :-\
Woow, perfect (but here even a simple Hello world crash).

Do you have a fresh 7.5 install, or you've upgraded from 7.4? At me it was the latter.
It is a fresh 7.5 install from official site and installed on VMWare Linux AMD64.
With only pkg_add xfce and his config.
« Last Edit: June 17, 2024, 11:31:33 pm by Fred vS »
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

TCH

  • Full Member
  • ***
  • Posts: 243
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #102 on: June 18, 2024, 01:01:37 am »
Really, fpc 3.2.2 installed on OpenBSD 7.5 produces running apps?  :-\
Woow, perfect (but here even a simple Hello world crash).
It is a fresh 7.5 install from official site and installed on VMWare Linux AMD64.
With only pkg_add xfce and his config.
It can be the libc. I still have the older libc.so files (they weren't deleted by sysupgrade), so probably FreePascal simply opened one of the old libc libraries and thus worked, while at you, you symlinked the new libc library as the old and it is not compatible with FPC. But this is just a guess.

Fred vS

  • Hero Member
  • *****
  • Posts: 3410
    • StrumPract is the musicians best friend
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #103 on: June 18, 2024, 02:24:14 am »
It can be the libc. I still have the older libc.so files (they weren't deleted by sysupgrade), so probably FreePascal simply opened one of the old libc libraries and thus worked, while at you, you symlinked the new libc library as the old and it is not compatible with FPC. But this is just a guess.

OK, I tried this:
-  Remove the link libc.so.96.2 (target to installed libc.so.99.0).
- Try fpc ---> ok complains that libc.so.96.2 is missing.
- Copy libc.so.96.2 from fpcupdeluxe cross/lib to /usr/lib of obsd 7.5.
- Try fpc ---> ok, it runs.
- Compile a simple Hello world app ---> ok, it compiles.
- Try the simple Hello world app --> Crash --> Segmentation fault (core dumped).

I think that Marcov has the keys.  ;)
« Last Edit: June 18, 2024, 02:34:25 am by Fred vS »
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

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11935
  • FPC developer.
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #104 on: June 18, 2024, 11:20:08 am »
I think that Marcov has the keys.  ;)

I don't have OpenBSD, nor do I plan to. I just comment based on FreeBSD porting experiences.  I also don't know for sure if OpenBSD supports compat. But compat is a special case where the  dynamic loader/linker does something based on the identifier binary. Besides compat, the OpenBSD could do other things (like enforce certain security measures) based on ELF id.


 

TinyPortal © 2005-2018