Recent

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

erick

  • New member
  • *
  • Posts: 8
FPC + Lazarus on FreeBSD
« on: August 13, 2019, 08:03:16 pm »
I've been working for hours trying to get Lazarus+FreeBSD to work together.  The system has to be for FreeBSD 12.0, I don't have a choice.

FPCUPDELUXE doesn't work because it complains of no SVN (svn works fine on the system from the command line).  Too bad, that was my preferred way.

FreeBSD pkg system installs Lazarus 2.0.0 and FPC 3.0.4-2  But it complains about no source when you start up Lararus.  So I added the source code from that release from sourceforge, but then in complains there is no packages directory. 

Merely creating a packages directory does not work.

I need to build projects with Mormot and others with Indy10, both of which are coming from Delphi heritage.

I dont' have an example of what the required 'packages' part is, if it is a file or a directory or what.  And reading scads of posts, I haven't found someone who explains it.

Thanks for any hints you can provide.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1118
Re: FPC + Lazarus on FreeBSD
« Reply #1 on: August 13, 2019, 08:09:51 pm »
Fpcupdeluxe should work.
Would be good to know more details about the error, so it can be improved to work on your system too.

erick

  • New member
  • *
  • Posts: 8
Re: FPC + Lazarus on FreeBSD
« Reply #2 on: August 13, 2019, 08:20:07 pm »
fpcupdeluxe fails with:
fpcupdeluxe: ERROR: FPCNativeInstaller (CheckAndGetTools): Could not find SVN executable. Please make sure it is installed.

While the command line version works fine:
root@maggot2:~ # svn
Type 'svn help' for usage.

erick

  • New member
  • *
  • Posts: 8
Re: FPC + Lazarus on FreeBSD
« Reply #3 on: August 13, 2019, 08:26:27 pm »
I also tried using WGET / LibCURL for download, but no effect on the SVN error

erick

  • New member
  • *
  • Posts: 8
Re: FPC + Lazarus on FreeBSD
« Reply #4 on: August 13, 2019, 08:32:40 pm »
Okay, creating a symbolic link to svn in the local directory gets me farther.

...
Executing: svn update rtl --non-interactive --trust-server-cert --quiet /root/fpcupdeluxe/fpc300bootstrap/rtl (working dir: /root/fpcupdeluxe/fpcsrc)

fpcupdeluxe: ERROR: FPCNativeInstaller (BuildModule: FPC): Error (SVN) getting sources for intermediate bootstrap compiler. Error: -2

Not sure where to go from there.


Thanks
Erick

Xor-el

  • Sr. Member
  • ****
  • Posts: 363
Re: FPC + Lazarus on FreeBSD
« Reply #5 on: August 13, 2019, 08:35:09 pm »
@erick, using this version https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.6.2y2/fpcupdeluxe-x86_64-freebsd should fix the SVN issue and allow you download the source but compilation and building is another problem you will encounter due to fpc linker issues in freebsd.

erick

  • New member
  • *
  • Posts: 8
Re: FPC + Lazarus on FreeBSD
« Reply #6 on: August 13, 2019, 08:47:09 pm »
So does that mean there is no solution for FPC and FreeBSD? 

I don't need the GUI, but packages are pretty important.  I tried 2.0.0 IDE + 3.0.4 with fpupdeluxe which others had success with, but I get linker errors.

Erick
« Last Edit: August 13, 2019, 08:48:54 pm by erick »

Xor-el

  • Sr. Member
  • ****
  • Posts: 363
Re: FPC + Lazarus on FreeBSD
« Reply #7 on: August 13, 2019, 09:01:41 pm »
@erick, exactly the same error I get with both trunk and stable in freebsd 12.0

trev

  • Full Member
  • ***
  • Posts: 156
Re: FPC + Lazarus on FreeBSD
« Reply #8 on: August 14, 2019, 01:38:17 am »
I successfully installed the FreeBSD port /usr/ports/editors/lazarus on FreeBSD 12.0 with a simple 'make install' using a GENERIC kernel or fixing my custom kernel as below. This gave me a working Lazarus 2.0 and fpc 3.0.4.

Without the options below (included in a GENERIC kernel by default), the build failed with a core dump when trying to run the bootstrap compiler

Code: [Select]
options       COMPAT_FREEBSD32       # Compatible with i386 binaries
options       COMPAT_FREEBSD4         # Compatible with FreeBSD4
options       COMPAT_FREEBSD5         # Compatible with FreeBSD5
options       COMPAT_FREEBSD6         # Compatible with FreeBSD6
options       COMPAT_FREEBSD7         # Compatible with FreeBSD7
options       COMPAT_FREEBSD9         # Compatible with FreeBSD9
options       COMPAT_FREEBSD10       # Compatible with FreeBSD10

Not all of the above options are probably essential, but it was easier to just enable them all rather than compiling multiple kernels.  The actual core dumps seemed to be complaining about missing FreeBSD 6 (released 2005) calls. For example:

Code: [Select]
compat6.mmap()                           ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
process killed, signal = 12 (core dumped)

I don't believe I needed to install the source code for fpc separately.
« Last Edit: August 14, 2019, 02:05:58 am by trev »
o Lazarus v2.1.0 r61676, FPC v3.3.1 r42640, macOS 10.14.6 (with supplemental update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04

erick

  • New member
  • *
  • Posts: 8
Re: FPC + Lazarus on FreeBSD
« Reply #9 on: August 14, 2019, 04:45:43 am »
Thanks so much, I will try this. 

Erick

trev

  • Full Member
  • ***
  • Posts: 156
Re: FPC + Lazarus on FreeBSD
« Reply #10 on: August 14, 2019, 11:13:39 am »
In fact I did have to install the FPC source code manually. You can find it in: /usr/ports/distfiles/freepascal/

As root,

cd /usr/local/share && mkdir fpsrc && tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz

which will install the source in /usr/local/share/fpsrc/fpc-3.0.4 in case you want to later try a differemt version (eg trunk).
o Lazarus v2.1.0 r61676, FPC v3.3.1 r42640, macOS 10.14.6 (with supplemental update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04

erick

  • New member
  • *
  • Posts: 8
Re: FPC + Lazarus on FreeBSD
« Reply #11 on: August 14, 2019, 04:00:35 pm »
Excellent, I can no compile console apps.  GUI apps, with absolutely nothing added  give SIGSEGV, but I can survive without GUI apps.

Thanks very much.
Erick


erick

  • New member
  • *
  • Posts: 8
Re: FPC + Lazarus on FreeBSD
« Reply #12 on: August 14, 2019, 04:11:35 pm »
Arrgh, linking in libraries to the Lazarus system still fails.  It's not at a usuable state yet.  I'm not sure where the useful error messages go, or i'd report the problem. 

trev

  • Full Member
  • ***
  • Posts: 156
Re: FPC + Lazarus on FreeBSD
« Reply #13 on: August 15, 2019, 12:35:13 am »
Very strange. I can compile my latest multi-platform (Windows/macOS/FreeBSD/Ubuntu) Lazarus GUI application on FreeBSD 12.0 (patch level 9) without any errors and it works almost* as expected.

*SSL only worked on FreeBSD after upgrading to FPC trunk.
o Lazarus v2.1.0 r61676, FPC v3.3.1 r42640, macOS 10.14.6 (with supplemental update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04

trev

  • Full Member
  • ***
  • Posts: 156
Re: FPC + Lazarus on FreeBSD
« Reply #14 on: August 16, 2019, 03:15:37 am »
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.

As root, portsnap auto should update your ports tree; then delete ~/.config, ~/.lazarus and pkg delete lazarus and fpc\*

You can then make install in /usr/ports/editors/lazarus again.
o Lazarus v2.1.0 r61676, FPC v3.3.1 r42640, macOS 10.14.6 (with supplemental update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04