Forum > Other
Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
TCH:
I have three scripts to make FreePascal/Lazarus installation on OpenBSD easy:
install_freepascal_binaries.sh:
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#!/bin/sh if [ "$1" = "" ]then echo 'Usage: install_freepascal.sh <x86_64/i386> <version> [1=force install]' exit 0fi case "$1" in "i386") CARCH="386" ;; "x86_64") CARCH="x64" ;; *) echo "Invalid architecture." exit 2 ;;esac if [ -f "/usr/bin/ppc""$CARCH" -a "$3" != "1" ]then echo "FreePascal binaries seems to be already installed. Force install if you want to reinstall them." exit 0fi cd /tmpDNAME="fpc-""$2"".""$1""-openbsd"ANAME="$DNAME"".tar"ftp "https://downloads.sourceforge.net/project/freepascal/OpenBSD/""$2""/""$ANAME"if [ ! -f "$ANAME" ]then echo "Could not download FreePascal binaries." exit 1fitar -xvf "$ANAME"rm "$ANAME"cd "$DNAME"echo "Install to /usr/ instead of /usr/local/"./install.shcd ..rm -rf "$DNAME"echo "FreePascal binaries have been successfully installed." install_freepascal_sources.sh:
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#!/bin/sh if [ "$1" = "" ]then echo 'Usage: install_freepascal_sources.sh <version> [1=force install]' exit 0fi TNAME="/usr/share/fpcsrc/""$1"if [ -f "$TNAME""/Makefile" -a "$2" != "1" ]then echo "FreePascal sources seems to be already installed. Force install if you want to reinstall them." exit 0fi cd /tmpDNAME="fpc-""$1"ANAME="$DNAME"".source.zip"ftp "https://netcologne.dl.sourceforge.net/project/freepascal/Source/""$1""/""$ANAME" -o "$ANAME" -S dontif [ ! -f "$ANAME" ]then echo "Could not download FreePascal sources." exit 1fiunzip "$ANAME"rm "$ANAME"mkdir -p `dirname "$TNAME"`mv "fpc-""$1" "$TNAME"cd "$TNAME"FTOED="packages/fcl-net/fpmake.pp"if [ ! -f "$FTOED" ]then echo "$FTOED"" is missing." exit 2fised -i "s/'cnetdb\.pp',\[linux,freebsd,solaris,android\]/'cnetdb\.pp',\[linux,freebsd,openbsd,dragonfly,solaris,android\]/" "$FTOED"echo "FreePascal sources have been successfully installed." install_lazarus.sh:
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#!/bin/sh if [ "$1" = "" ]then echo 'Usage: install_lazarus.sh <version> [revision] [1=force install]' exit 0fi TNAME="/usr/local/share/lazarus/lazarus"if [ -f "$TNAME" -a "$3" != "1" ]then echo "Lazarus seems to be already installed. Force install if you want to reinstall it." exit 0fi cd /tmpif [ ! -d "lazarus" ];then REV="" if [ "$2" != "" ]; then REV="-""$2" fi ANAME="lazarus-""$1""$REV"".zip" ftp "https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20""$1""/""$ANAME" -o "$ANAME" -S dont if [ ! -f "$ANAME" ]; then echo "Could not download Lazarus sources." exit 1 fi unzip "$ANAME" rm "$ANAME"ficd lazarusgmake clean bigideif [ -f lazarus ];then mkdir -p `dirname "$TNAME"` gmake install if [ -f "$TNAME" ]; then cd .. rm -rf lazarus else echo "Install failed." exit 2 fielse echo "Build failed." exit 3fiecho "Lazarus has been successfully installed."When i do:
--- Code: ---install_freepascal_binaries.sh x86_64 3.2.2
install_freepascal_sources.sh 3.2.2
install_lazarus.sh 3.4 0
--- End code ---
The compiling dies at one point by stating:
--- Code: ---Can't find unit cNetDB used by netdb
--- End code ---
This is the very same message as earlier, however, this time /usr/share/fpcsrc/3.2.2/packages/fcl-net/fpmake.pp is already patched to have
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- T:=P.Targets.AddUnit('cnetdb.pp',[linux,freebsd,openbsd,dragonfly,solaris,android]);instead of
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- T:=P.Targets.AddUnit('cnetdb.pp',[linux,freebsd,dragonfly,solaris,android]);yet the compiling dies with this message.
Am i doing something wrong? Should not the sources of FreePascal reside in /usr/share/fpcsrc/3.2.2? Or is it /usr/share/fpcsrc/fpc-3.2.2? AFAIK, it should be the first, but in my current OpenBSD 7.4 system, it is the latter one. Granted, i did not use these scripts last time to build Lazarus, but ibara's port, which worked. Until now.
OpenBSD 7.5 broke something again and after upgrading the system and - more precisely - harfbuzz, Lazarus dies with this error message:
--- Code: ---(lazarus:40076): GLib-GObject-CRITICAL **: 15:58:36.054: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
[FORMS.PP] ExceptionOccurred
Sender=EAccessViolation
Exception=Access violation
Stack trace:
$000008A747750768
$000008A74774E80E
$000008A74774F02F
$000008A7664A56BE
$000008A74773A44D
$000008A7664A3B16
$000008A7663D7572
$000008A747734410
$000008A747751052
$000008A74774E80E
$000008A74774F02F
$000008A7664A56BE
$000008A74773A44D
$000008A7664A3B16
$000008A4E5F94652 FREESTYLEOBJECT, line 7715 of gtk2proc.inc
$000008A4E5F94777 RELEASEALLSTYLES, line 7742 of gtk2proc.inc
$000008A4E5E2BFF1 FREEALLSTYLES, line 1650 of gtk2widgetset.inc
[FORMS.PP] ExceptionOccurred
--- End code ---
And if i try to rebuild Lazarus from the ports (cd /usr/ports/devel/lazarus && make clean='all depends' && make install), then this:
--- Code: ---gmake -C ide ide
gmake[1]: Entering directory '/usr/ports/pobj/lazarus-2.2.0_0/lazarus/ide'
/bin/mkdir -p ../units/x86_64-openbsd/gtk2
../tools/svn2revisioninc .. revision.inc
Created /usr/ports/pobj/lazarus-2.2.0_0/lazarus/ide/revision.inc for revision: Unversioned directory
An unhandled exception occurred at $00000B4CF72602F2:
EAccessViolation:
$00000B4CF72602F2 line 177 of /usr/src/lib/libc/stdlib/atexit.c
$00000B4CF72727E5 line 54 of /usr/src/lib/libc/stdlib/exit.c
$00000B4A04264983
An unhandled exception occurred at $00000B4A0427FB50:
EAccessViolation:
$00000B4A0427FB50
$00000B4CF72727E5 line 54 of /usr/src/lib/libc/stdlib/exit.c
$00000B4A04264983
--- End code ---
And then this latter error message repeats forever.
This is why i decided to dust off my old approach and build Lazarus from scratch, but that does not work either.
Any ideas are appreciated.
marcov:
Make sure you clean the sources thoroughly before you rebuild after a patch.
I usually kill *.ppu *.o and packages/fpmake
Anyway, 3.2.2 is 3 years old at this moment. Please test with the fixes_3_2 branch.
TCH:
--- Quote from: marcov on June 09, 2024, 09:24:41 pm ---Make sure you clean the sources thoroughly before you rebuild after a patch.
I usually kill *.ppu *.o and packages/fpmake
--- End quote ---
I am not rebuilding, i am building from scratch. The system has been entirely purged of FreePascal binaries, sources and Lazarus and then the archives have been downloaded and extracted to their place. Then the change was issued via sed. Only then i started the build. There is nothing to be cleaned.
--- Quote from: marcov on June 09, 2024, 09:24:41 pm ---Anyway, 3.2.2 is 3 years old at this moment. Please test with the fixes_3_2 branch.
--- End quote ---
Where can i download the OpenBSD binaries from that branch? I'd give it a try. (Although i don't think it'll help: if Lazarus 3.4 compiles with 3.2.2 on macOS, Linux, FreeBSD, etc., then why would a newer compiler fix a unit-detection problem which origins from the package and not the compiler?)
marcov:
--- Quote from: TCH on June 09, 2024, 10:06:57 pm ---
--- Quote from: marcov on June 09, 2024, 09:24:41 pm ---Make sure you clean the sources thoroughly before you rebuild after a patch.
I usually kill *.ppu *.o and packages/fpmake
--- End quote ---
I am not rebuilding, i am building from scratch.
--- End quote ---
Good.
--- Quote from: TCH on June 09, 2024, 10:06:57 pm ---
--- Quote from: marcov on June 09, 2024, 09:24:41 pm ---Anyway, 3.2.2 is 3 years old at this moment. Please test with the fixes_3_2 branch.
--- End quote ---
Where can i download the OpenBSD binaries from that branch?
--- End quote ---
You can't. That is work in progress branch, not a release, so source only. But it should build with a 3.2.2 a starting compiler. The rule is generally the next FPC release (and the next release froum fixes_3_2_2 would be 3.2.4) can be build with the previous release.
--- Quote ---I'd give it a try. (Although i don't think it'll help: if Lazarus 3.4 compiles with 3.2.2 on macOS, Linux, FreeBSD, etc., then why would a newer compiler fix a unit-detection problem which origins from the package and not the compiler?)
--- End quote ---
Well, that obviously means that the problem must be in OS specific code!
And your exception messages also seems to point to that, with the limited info given; one is in glib, an external library (a fundament for GTK) and one is in atexit, which is libc initialization/finalization related, which in turn both point to problems in the OpenBSD specific startup code that initializes libc (openbsd/<cpu>/cprt0.as) or its libc headers.
(Note that I haven't compiled OpenBSD (or NetBSD) in over a decade, but I'm still doing FreeBSD occasionally, and actually that target is a bit modernized in 3.2.4, whenever it lands )
TCH:
--- Quote from: marcov on June 09, 2024, 10:33:10 pm ---You can't. That is work in progress branch, not a release, so source only. But it should build with a 3.2.2 a starting compiler. The rule is generally the next FPC release (and the next release froum fixes_3_2_2 would be 3.2.4) can be build with the previous release.
--- End quote ---
http://downloads.freepascal.org/fpc/snapshot/fixes/source/fpc.zip or http://downloads.freepascal.org/fpc/snapshot/fixes/source/fpcbuild.zip?
--- Quote from: marcov on June 09, 2024, 10:33:10 pm ---Well, that obviously means that the problem must be in OS specific code!
--- End quote ---
Okay, but where? Last time it was caused by a missing unit entry for cnetdb.pp in /usr/share/fpcsrc/3.2.2/packages/fcl-net/fpmake.pp, but this time the entry is there. What else can produce this error?
--- Quote from: marcov on June 09, 2024, 10:33:10 pm ---And your exception messages also seems to point to that, with the limited info given; one is in glib, an external library (a fundament for GTK) and one is in atexit, which is libc initialization/finalization related, which in turn both point to problems in the OpenBSD specific startup code that initializes libc (openbsd/<cpu>/cprt0.as) or its libc headers.
--- End quote ---
I think those error messages are caused by some kind of ABI-breakage. I've already ran into a similar case when i upgraded OpenBSD 7.2 to 7.3. Lazarus 2.2.6 currently works on OpenBSD 7.4 and i can even upgrade to 7.5, it will work then too. It only dies, when i upgrade the harfbuzz package after the system upgrade. (.libs1-harfbuzz-2.9.1+.libs1-harfbuzz-5.2.0+harfbuzz-8.2.1 updated to harfbuzz-8.3.0, i've reported the issue to ibara.)
Navigation
[0] Message Index
[#] Next page