Recent

Author Topic: FPC + Lazarus on FreeBSD  (Read 2760 times)

trev

  • Sr. Member
  • ****
  • Posts: 254
  • Former Delphi 7 and Delphi 10.2 User
Re: FPC + Lazarus on FreeBSD
« Reply #15 on: August 20, 2019, 10:45:30 am »
Unfortunately the old system calls are still present. Looks like you need to use the GENERIC  kernel or include the following options in your custom kernel:

Code: [Select]
options       COMPAT_FREEBSD6         # Compatible with FreeBSD6
options       COMPAT_FREEBSD7         # Compatible with FreeBSD7 (or kernel does not compile)

FreeBSD10 may be necessary if running 11.x; FreeBSD11 may be necessary if running 12.x.

I've logged details on FreeBSD's bugzilla.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

hunghung

  • Full Member
  • ***
  • Posts: 120
Re: FPC + Lazarus on FreeBSD
« Reply #16 on: November 15, 2019, 12:18:00 pm »
Fpcupdeluxe still not work on FreeBSD now  :(

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7619
Re: FPC + Lazarus on FreeBSD
« Reply #17 on: November 15, 2019, 02:18:07 pm »
The Lazarus port was updated today (15/16 August depending on your timezone) to remove the FPC compiler's dependence on old FreeBSD system calls and to also install the FPC source automatically.

I don't see any RTL modifications for old syscalls in that post. They just hardcode some linker paths.


Thaddy

  • Hero Member
  • *****
  • Posts: 9292
Re: FPC + Lazarus on FreeBSD
« Reply #18 on: November 15, 2019, 03:24:04 pm »
Question is: are the recommended calls available? YES.
Should the old calls maybe marked as deprecated? Yes. Should they still be there? Yes....as long as supported. It is still supported by FreeBSD.
@trev
You can't simply remove support for that, unless the OS itself removes it. That is not the case.
« Last Edit: November 15, 2019, 03:27:02 pm by Thaddy »
also related to equus asinus.

trev

  • Sr. Member
  • ****
  • Posts: 254
  • Former Delphi 7 and Delphi 10.2 User
Re: FPC + Lazarus on FreeBSD
« Reply #19 on: November 30, 2019, 04:10:13 am »
Question is: are the recommended calls available? YES.
Should the old calls maybe marked as deprecated? Yes. Should they still be there? Yes....as long as supported. It is still supported by FreeBSD.
@trev
You can't simply remove support for that, unless the OS itself removes it. That is not the case.

Sure, if you want to use 14 year old system calls, fine. FreeBSD is up to 12.1; FreeBSD 6 was released in November 2005. The only supported versions of FreeBSD are 11.3, 12.0 (until Feb 4, 2020) and 12.1. The rest are well and truly end of life.

FreeBSD 11 onwards have newer system calls to achieve the same result which work with the currently supported versions of FreeBSD and don't need old system call kernel compatibility code to be added.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7619
Re: FPC + Lazarus on FreeBSD
« Reply #20 on: November 30, 2019, 01:38:54 pm »
It doesn't matter how old they are, just how long they were supported as main calls. So that seems to be up to FreeBSD10 if FreeBSD 11 introduced the new calls.

And since FreeBSD10 is not that long out support, if you support one set of system calls only, it is not that far off.

And if it is really that interesting to move from an AIXy calling convention that aligns parameters even in registers to save the zeroing of one register.

And of course the biannual rearrangement of the stat record with probably to make sure compatibility is certainly broken.

People that like that philosophy, probably also like submitting patches. I'm anxiously waiting.
« Last Edit: November 30, 2019, 01:47:21 pm by marcov »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1170
Re: FPC + Lazarus on FreeBSD
« Reply #21 on: November 30, 2019, 01:51:52 pm »
As a sidenote.
FPC trunk works flawless on FBSD12 with -dFPC_USE_LIBC.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7619
Re: FPC + Lazarus on FreeBSD
« Reply #22 on: November 30, 2019, 03:28:56 pm »
As a sidenote.
FPC trunk works flawless on FBSD12 with -dFPC_USE_LIBC.

You'd expect that also should suffer from stat differences?


DonAlfredo

  • Hero Member
  • *****
  • Posts: 1170
Re: FPC + Lazarus on FreeBSD
« Reply #23 on: November 30, 2019, 04:12:03 pm »
The stat-structures are all updated and ok as far as I can see.
The sysfs calls are not ok.
So, using libc solves all.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7619
Re: FPC + Lazarus on FreeBSD
« Reply #24 on: December 01, 2019, 04:42:44 pm »
I just tested on a clean FreeBSD 12.1 install with FPC trunk. I didn't touch the linker (still LLVM). I used the bootstrap compiler from fpc 3.0.4: x86_64-freebsd11-ppcx64

ppc1 has a segment violation while compiling system. Afaik it doesn't even reach the compiler code but already fails in the startup code or unit initializations.
« Last Edit: December 01, 2019, 04:49:35 pm by marcov »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1170
Re: FPC + Lazarus on FreeBSD
« Reply #25 on: December 01, 2019, 04:59:45 pm »
That is reported by many FBSD users (@private).
For me, defining FPC_USE_LIBC solves.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7619
Re: FPC + Lazarus on FreeBSD
« Reply #26 on: December 01, 2019, 05:28:04 pm »
I tested some more, turns out so you need to also set the linker to BFD.

Easiest is

0. edit compiler/targets/t_bsd.pas. Go to method TLinkerBSD.setdefaultinfo and set "linkerprogram" to "ld.bfd"
1. install binutils
2. execute EXPORT PATH=/usr/local/bin:$PATH
3 make with OPT=-dFPC_USE_LIBC

Note that 2 is not entirely safe, but is only needed once. If you use the result of such build as starting compiler,  (2) is no longer necessary, since the source modification (0) is then live.

hunghung

  • Full Member
  • ***
  • Posts: 120
Re: FPC + Lazarus on FreeBSD
« Reply #27 on: December 01, 2019, 05:44:55 pm »
I tested some more, turns out so you need to also set the linker to BFD.

Easiest is

0. edit compiler/targets/t_bsd.pas. Go to method TLinkerBSD.setdefaultinfo and set "linkerprogram" to "ld.bfd"
1. install binutils
2. execute EXPORT PATH=/usr/local/bin:$PATH
3 make with OPT=-dFPC_USE_LIBC

Note that 2 is not entirely safe, but is only needed once. If you use the result of such build as starting compiler,  (2) is no longer necessary, since the source modification (0) is then live.

Hi. I want to report to you that on DragonFlyBSD which is a FreeBSD derived distro, they default to the gold linker and fpc simple will fail to link anything. They also ship the ld.bfd linker but I don't know why fpc always pick the ld.gold version, though. As I know now, fpc is ld.bfd only, without support for any other linker, which I think is a pity  :(

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7619
Re: FPC + Lazarus on FreeBSD
« Reply #28 on: December 01, 2019, 06:05:52 pm »
About 2 I think it's not necessary at all. FreeBSD by default put package installed binary into /usr/local/bin so you don't have to add it to PATH manually like on Linux. You should check the corresponding filesystem hierachy before you port your software to a different platform.

1. Did you test before you posted?
2. it is not about ADDING to the path, it is a matter of search order. Both /usr/bin and /usr/local/bin contain LD, and this line makes sure the /usr/local/bin one (ld.bfd) is found before the /usr/bin one (LLVM LLD)

hunghung

  • Full Member
  • ***
  • Posts: 120
Re: FPC + Lazarus on FreeBSD
« Reply #29 on: December 01, 2019, 06:35:49 pm »
About 2 I think it's not necessary at all. FreeBSD by default put package installed binary into /usr/local/bin so you don't have to add it to PATH manually like on Linux. You should check the corresponding filesystem hierachy before you port your software to a different platform.

1. Did you test before you posted?
2. it is not about ADDING to the path, it is a matter of search order. Both /usr/bin and /usr/local/bin contain LD, and this line makes sure the /usr/local/bin one (ld.bfd) is found before the /usr/bin one (LLVM LLD)
Sorry. I'm too careless  :-[