Recent

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

TCH

  • Full Member
  • ***
  • Posts: 242
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #15 on: June 10, 2024, 10:31:32 pm »
Checked those commits. The first one only applies for FreePascal 3.3.X, which means it does not have to be reversed under 3.2.2. The second one refers to a part which is not exists in 3.2.2's packages/fcl-base/src/syncobjs.pp. Still, i tried to add
Code: Pascal  [Select][+][-]
  1. {$DEFINE NO_SEMAPHORE_SUPPORT}
to it, compiled the file and put the resulting .ppu, .o and .rsj files to their place in /usr/lib/fpc/3.2.2/units/x86_64-openbsd/fcl-base/. Unfortunately still crashes.
Note also that svn2revision is not crucial. Probably it only tries to execute git to get some revision to put in about. Probably the makefiles allow it to ski pit.
Thanks for the tip, i'll try to skip that in the makefiles.
Find out why it doesn't work.
It does not work, because units/x86_64-openbsd/fcl-net/cnetdb.ppu does not exists in the OpenBSD port of FPC 3.2.2, because at the line 76 of packages/fcl-net/fpmake.pp, OpenBSD is missing from the list. This is already fixed in 3.3, but it is still missing in both the binaries and sources of 3.2.2. Since i could not compile the fixes branch of 3.2.2, because of the erroneous Makefile, i need to do this workaround.

TCH

  • Full Member
  • ***
  • Posts: 242
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #16 on: June 10, 2024, 11:03:31 pm »
If i compile like with gmake bigide USESVN2REVISIONINC=0, then it passes those parts, but then it halts with this error:
Code: [Select]
/tmp/lazarus/ide/lazarus.pp(87,2) Fatal: (2013) Cannot open include file "revision.inc"If i comment that line out, then it'll miss the functions from it.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11645
  • FPC developer.
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #17 on: June 11, 2024, 08:40:28 am »
(Looking at that make log) You do realize that FPC requires gmake not BSD default (bsd-)make ?
« Last Edit: June 11, 2024, 08:47:06 am by marcov »

TCH

  • Full Member
  • ***
  • Posts: 242
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #18 on: June 11, 2024, 10:55:20 am »
Whoops, i keep forgetting. (The Lazarus in the ports does use the regular make.) Thanks for pointing out, i'll retry it.

Edit: I just used the commands from here.
« Last Edit: June 11, 2024, 11:10:16 am by TCH »

TRon

  • Hero Member
  • *****
  • Posts: 2866
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #19 on: June 11, 2024, 11:28:06 am »
Whoops, i keep forgetting. (The Lazarus in the ports does use the regular make.) Thanks for pointing out, i'll retry it.

Edit: I just used the commands from here.
because you are basing things off FPC fixes make sure to use the correct FPC to build lazarus with, e.g. (g)make all FPC="/path/and/name/to/your/fpc/fixes/executable"

TCH

  • Full Member
  • ***
  • Posts: 242
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #20 on: June 11, 2024, 11:33:17 am »
because you are basing things off FPC fixes make sure to use the correct FPC to build lazarus with, e.g. (g)make all FPC="/path/and/name/to/your/fpc/fixes/executable"
Unfortunately the compilation of the fixed version has failed again.

Now, i tried to do gmake clean and gmake all. Result:
Code: [Select]
gmake 'FPC=/root/source-fixes_3_2/compiler/ppc1' 'OLDFPC=' next CYCLELEVEL=2
gmake[4]: Entering directory '/root/source-fixes_3_2/compiler'
An unhandled exception occurred at $00000AA64233ED62:
EAccessViolation:
  $00000AA64233ED62
  $00000AA6422EF1C5
And that message repeats a lot. Full log: http://oscomp.hu/depot/gmake_all.log

But it seemed, that without the svn2revision, Lazarus would compile with the original 3.2.2 too, but then tries to include a file which is not there. If that could be prevented, then Lazarus might build fully. But if i comment out that line, then it misses some functions from it, so that entire part and the references to it's functions should be disabled somehow. Any ideas?

TRon

  • Hero Member
  • *****
  • Posts: 2866
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #21 on: June 11, 2024, 11:38:46 am »
Unfortunately the compilation of the fixed version has failed again.
I am confused about that output... that looks more like output from building FPC rather than Lazarus. These are two separated processes (and requires different solutions/approaches).

TCH

  • Full Member
  • ***
  • Posts: 242
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #22 on: June 11, 2024, 12:00:25 pm »
Yes, currently i am trying to build the fixed version of FPC 3.2.2 with the original version of FPC 3.2.2. I've downloaded the archive you suggested and did a gmake clean and gmake all on it.

The building of Lazarus with the original version of FPC 3.2.2 is currently stucked at the point, where it wants to include a file:
Code: [Select]
/tmp/lazarus/ide/lazarus.pp(87,2) Fatal: (2013) Cannot open include file "revision.inc"I did compile with gmake bigide USESVN2REVISIONINC=0. This bypassed the crashes, but resulted in a missing include file.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11645
  • FPC developer.
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #23 on: June 11, 2024, 12:13:33 pm »

FPC fixes crashes:  that is the job of the openbsd porter. That of course shouldn't happen.   

Doing initial ports, or  wildly different ABI versions (in the past e.g. from FreeBSD 3 to 4), and as said this is where libc based ports are pain. Even more so on LLVM systems since those tools hardly have any errorhandling and the linker can silently drop files if it doesn't like them.

One of the techniques is to compile on a "good" machine and then transfer the files to the target system and do the assembling and linking there using the script (that is generate when you compile with -s).

But before trying with a whole compiler it is easier to start testing simple programs, first hello world, than something that does some findfirst/findnext and expandfilename() to test that functionality and maybe look at it with ktrace/truss for more error information.

As for svn2revisioninc, it seems that the makefiles are not generating an alternative, but you can work around that by creating a  file yourself e.g.

Code: Pascal  [Select][+][-]
  1. // Created by Svn2RevisionInc
  2. const RevisionStr = 'main_3_99-2065-g520eccce1a';
  3.  

or so.


 

TCH

  • Full Member
  • ***
  • Posts: 242
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #24 on: June 11, 2024, 12:20:53 pm »
Before i jump into debugging FPC on low level, i'd like to try compiling Lazarus without the svn2revision. But i am not familiar with these building methods; all i have to do is put revision.inc to the place where it looks for it and put the missing constants and functions into it? Won't it cause problems later in the building process? Or it only will cause problems, if i would use svn2revision after the build, which i won't.

BTW, is there a planned release date for FPC 3.2.4 or 3.4.0?
« Last Edit: June 11, 2024, 12:24:28 pm by TCH »

TRon

  • Hero Member
  • *****
  • Posts: 2866
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #25 on: June 11, 2024, 12:23:16 pm »
Yes, currently i am trying to build the fixed version of FPC 3.2.2 with the original version of FPC 3.2.2. I've downloaded the archive you suggested and did a gmake clean and gmake all on it.
Ah ok. thank you for the clarification.

Never tried compiling fixes on top of itself (I always use the previous compiler for that).

Assuming that FPC 3.2.2 is installed in your system and configured correctly you should be able to build FPC 3.2.3 (fixes) with:
Code: [Select]
cd root/of/fpc/3.2.3/source
(g)make clean all install
But do note that it will try and install in your system. I personally always use the additional arguments INSTALL_PREFIX, INSTALL_BASEDIR and INSTALL_LIBDIR to install the newly build FPC to a directory of my own choice and move the just created ppcx64 executable to the new created/build FPC bin directory.

Then let's say you have your new FPC 3.2.3 located in a directory "/my/new/fpc/3.2.2" then you can build Lazarus with f.e.
Code: [Select]
(g)make clean bigide FPC="/my/new/fpc/3.2.2/bin/fpc"
That is provided that you have configured your FPC 3.2.3 compiler correctly (you can probably get by by using your original FPC 3.2.2 configuration file which should automatically be picked up if you have a working FPC 3.2.2 installation)

I do not know about details of the revision.inc file creation but perhaps it is using something not present on your system and chokes on it (I'll try have a look)

TRon

  • Hero Member
  • *****
  • Posts: 2866
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #26 on: June 11, 2024, 12:27:15 pm »
Before i jump into debugging FPC on low level, i'd like to try compiling Lazarus without the svn2revision. But i am not familiar with these building methods; all i have to do is put revision.inc to the place where it looks for it and put the missing constants and functions into it? Won't it cause problems later in the building process? Or it only will cause problems, if i would use svn2revision after the build, which i won't.
If you do not build from git sources then you a) probably do not have git installed and b) the revision file will not be created (it does not even exists when you downloaded the sources without using git and the creation of it will fail which is no biggy other than mention of it in the log) and all it does is add a git number to your version information (so you are literally not missing anything other than some git revision number attached to your version info string)

PS: please add something like:
Code: [Select]
your build command and options 2>&1 | tee log.txt
to your build so that you can analyze the build log and paste (portion) of it in case of failure. That talk a lot easier then only  a couple of error lines where the build stops.
« Last Edit: June 11, 2024, 12:30:42 pm by TRon »

TCH

  • Full Member
  • ***
  • Posts: 242
    • Oldschool computer
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #27 on: June 11, 2024, 12:34:13 pm »
Assuming that FPC 3.2.2 is installed in your system and configured correctly you should be able to build FPC 3.2.3 (fixes) with:
Code: [Select]
cd root/of/fpc/3.2.3/source
(g)make clean all install
But do note that it will try and install in your system. I personally always use the additional arguments INSTALL_PREFIX, INSTALL_BASEDIR and INSTALL_LIBDIR to install the newly build FPC to a directory of my own choice and move the just created ppcx64 executable to the new created/build FPC bin directory.

Then let's say you have your new FPC 3.2.3 located in a directory "/my/new/fpc/3.2.2" then you can build Lazarus with f.e.
Code: [Select]
(g)make clean bigide FPC="/my/new/fpc/3.2.2/bin/fpc"
That is provided that you have configured your FPC 3.2.3 compiler correctly (you can probably get by by using your original FPC 3.2.2 configuration file which should automatically be picked up if you have a working FPC 3.2.2 installation)
This was what i tried (although i wanted to overwrite my version), but gmake all crashed, before anything could be installed: http://oscomp.hu/depot/gmake_all.log
I do not know about details of the revision.inc file creation but perhaps it is using something not present on your system and chokes on it (I'll try have a look)
It is missing, because it was instructed to skip it (gmake bigide USESVN2REVISIONINC=0), because if it is not, then it also crashes with those messages with exit.c, atexit.c, heap.inc and si_c.inc.
If you do not build from git sources then you a) probably do not have git installed and b) the revision file will not be created (it does not even exists when you downloaded the sources without using git and the creation of it will fail which is no biggy other than mention of it in the log) and all it does is add a git number to your version information (so you are literally not missing anything other than some git revision number attached to your version info string)
I have git installed, but i used the source archive you have shown me. But about the revision file: is it generated by the Lazarus build, or that is part of the FreePascal sources?

TRon

  • Hero Member
  • *****
  • Posts: 2866
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #28 on: June 11, 2024, 12:44:51 pm »
I'll try reply at your remarks/questions later but first things first:
Quote
gmake[7]: *** [Makefile:3218: system.ppu] Illegal instruction (core dumped)
Can you try a rebuild with additional argument OPT="-O-" and see if that helps ?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11645
  • FPC developer.
Re: Building Lazarus 3.4 with FreePascal 3.2.2 fails under OpenBSD 7.5
« Reply #29 on: June 11, 2024, 12:50:47 pm »
Maybe it is better to start the generated compiler (  compiler/ppc1) in gdb, and then get the traceback where it sigsegvs.

But there is a chance that this happens in startup code etc, if they messed with libc going from version to version.

 

TinyPortal © 2005-2018