Difference between revisions of "Installing Lazarus on FreeBSD"

From Free Pascal wiki
Jump to navigationJump to search
m (Added FreeBSD supported versions)
(Updated for FreeBSD 11 & 12)
Line 1: Line 1:
 
= Installing Lazarus on FreeBSD =
 
= Installing Lazarus on FreeBSD =
 
{{Warning|Work in Progress - Updates to be made}}
 
  
 
The following applies to FreeBSD 11-STABLE, 11.2 and 11.3, 12-STABLE and 12.0 only. Earlier FreeBSD versions are end-of-life and not supported.
 
The following applies to FreeBSD 11-STABLE, 11.2 and 11.3, 12-STABLE and 12.0 only. Earlier FreeBSD versions are end-of-life and not supported.
Line 7: Line 5:
 
==via the Ports tree==
 
==via the Ports tree==
  
The latest version of Lazarus available in the FreeBSD port tree, is v 2.0.0 We can use that to install Lazarus (GTK2 by default, QT4 or QT5).
+
The latest version of Lazarus available in the FreeBSD port tree is v 2.0.0. We can use that to install Lazarus (GTK2 or QT5).
  
<syntaxhighlight lang="bash">[]# cd /usr/ports/editors/lazarus && make install clean clean-depends</syntaxhighlight>
+
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">[]# cd /usr/ports/editors/lazarus-qt4 && make install clean clean-depends</syntaxhighlight>
+
# cd /usr/ports/editors/lazarus && make install clean
<syntaxhighlight lang="bash">[]# cd /usr/ports/editors/lazarus-qt5 && make install clean clean-depends</syntaxhighlight>
+
</syntaxhighlight>
  
If you start Lazarus IDE and you get a messages about missing source files, then go to '''Environment - Environment Options - Files Tab: FPC source library''' and enter the directory of the FPC source files.  It can be obtained from /usr/ports/distfiles/freepascal
+
or
  
==via pkg==
+
<syntaxhighlight lang="bash">
 +
# cd /usr/ports/editors/lazarus-qt5 && make install clean
 +
</syntaxhighlight>
  
<syntaxhighlight lang="bash">[]# pkg install editors/lazarus</syntaxhighlight>
+
If you start Lazarus IDE at this point by typing '''lazarus''' you will get a dialog which needs you to input the directory in which the Free Pascal sources are located. Small problem, they have not been installed. You can, however, find a compressed tar file of the sources in the '''/usr/ports/distfiles/freepascal''' directory.
<syntaxhighlight lang="bash">[]# pkg install editors/lazarus-qt4</syntaxhighlight>
 
<syntaxhighlight lang="bash">[]# pkg install editors/lazarus-qt5</syntaxhighlight>
 
  
At this point Lazarus might complain about missing source files.  If you don't have them:-
+
You can either install the sources in your home directory or in the system-wide '''/usr/local/share/fpsrc''' directory. You will need to do this as root if you use the system-wide directory.
  
  mkdir /usr/ports/distfiles
+
=== Installing FPC sources in home directory ===
  mkdir /usr/ports/distfiles/freepscal
 
  cd /usr/ports/distfiles/freepascal
 
  wget http://distcache.freebsd.org/ports-distfiles/freepascal/fpc-3.0.4.source.tar.gz
 
  tar xvfz fpc-3.0.4.source.tar.gz
 
  
Change the 3.0.4 to whatever version of fpc you have installed. Then go to '''Environment - Environment Options - Files Tab: FPC source library''' and enter
+
Create a directory to hold the Free Pascal sources under your home directory. Note that when you extract the compressed tar file, it will include a directory of fpc-3.0.4, so if that is good enough for you go ahead and:
  
  /usr/ports/distfiles/freepascal/fpc-3.0.4
+
<syntaxhighlight lang="bash">
 +
tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz
 +
</syntaxhighlight>
  
If when you try to compile something you get this error
+
=== Installing FPC sources in system-wide directory ===
  
  Error: resource compiler "fpcres" not found, switching to external mode
+
As root, create the '''fpcsrc''' directory in '''/usr/local/share''', change to the new directory and:
  
Then you can install fpcres like this
+
<syntaxhighlight lang="bash">
 +
tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz
 +
</syntaxhighlight>
  
<syntaxhighlight lang="bash">[]# pkg install lang/fpc-utils</syntaxhighlight>
+
==via the pkg system==
 +
 
 +
<syntaxhighlight lang="bash">
 +
# pkg install editors/lazarus
 +
</syntaxhighlight>
 +
 
 +
or
 +
 
 +
<syntaxhighlight lang="bash">
 +
# pkg install editors/lazarus-qt5
 +
</syntaxhighlight>
 +
 
 +
At this point Lazarus will complain about the missing Free Pascal source files.  If you don't have them:
 +
 
 +
<syntaxhighlight lang="bash">
 +
  fetch http://distcache.freebsd.org/ports-distfiles/freepascal/fpc-3.0.4.source.tar.gz
 +
</syntaxhighlight>
 +
 
 +
You can either install the sources in your home directory or in the system-wide '''/usr/local/share/fpsrc''' directory. You will need to do this as root if you use the system-wide directory.
 +
 
 +
=== Installing FPC sources in home directory ===
 +
 
 +
Create a directory to hold the Free Pascal sources under your home directory. Note that when you extract the compressed tar file, it will include a directory of fpc-3.0.4, so if that is good enough for you go ahead and:
 +
 
 +
<syntaxhighlight lang="bash">
 +
tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz
 +
</syntaxhighlight>
 +
 
 +
=== Installing FPC sources in system-wide directory ===
 +
 
 +
As root, create the '''fpcsrc''' directory in '''/usr/local/share''', change to the new directory and:
 +
 
 +
<syntaxhighlight lang="bash">
 +
tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz
 +
</syntaxhighlight>
  
 
==via the Lazarus repository==
 
==via the Lazarus repository==
  
This option will often be used if you want to follow Lazarus Trunk, a Fixes branch, or some other release (eg: compiling from a source tarball).
+
This option will often be used if you want to follow Lazarus trunk, a Fixes branch, or some other release (eg compiling from a source tarball).
 +
 
 +
* Use the SubVersion or Git repositories to checkout a copy of the source code you want, or unpack a downloaded source archive into a suitable location. Recent versions of FreeBSD include the '''svn''' command as '''svnlite''', so you do not need to install full Subversion package to checkout a copy of the source code.
  
* Use the SubVersion or Git repositories to checkout a copy of the source code you want, or unpack a downloaded source archive into a suitable location
+
* The readme.txt file in Lazarus directory mentions '''make clean all'''. This only works if you are using Linux. Under FreeBSD you need to replace '''make''' with '''gmake'''.
* The readme.txt file in Lazarus directory mentions 'make clean all'. This works if you are using Linux. Under FreeBSD 9.1 I had to replace 'make' with 'gmake'.
 
  
   cd /patch/to/lazarus_source
+
<syntaxhighlight lang="bash">
 +
   cd /path/to/lazarus_source
 
   gmake clean all
 
   gmake clean all
 +
</syntaxhighlight>
 +
 +
==Installation troubleshooting==
 +
 +
Troubleshooting details that should (hopefully) be applicable across platforms may be found in the article [[Installation Troubleshooting]].
 +
 +
Some additional notes for FreeBSD installations can be found in the article [[FreeBSD]].
  
  
 
[[Category:Install]]
 
[[Category:Install]]
 
[[Category:FreeBSD]]
 
[[Category:FreeBSD]]

Revision as of 11:49, 14 August 2019

Installing Lazarus on FreeBSD

The following applies to FreeBSD 11-STABLE, 11.2 and 11.3, 12-STABLE and 12.0 only. Earlier FreeBSD versions are end-of-life and not supported.

via the Ports tree

The latest version of Lazarus available in the FreeBSD port tree is v 2.0.0. We can use that to install Lazarus (GTK2 or QT5).

# cd /usr/ports/editors/lazarus && make install clean

or

# cd /usr/ports/editors/lazarus-qt5 && make install clean

If you start Lazarus IDE at this point by typing lazarus you will get a dialog which needs you to input the directory in which the Free Pascal sources are located. Small problem, they have not been installed. You can, however, find a compressed tar file of the sources in the /usr/ports/distfiles/freepascal directory.

You can either install the sources in your home directory or in the system-wide /usr/local/share/fpsrc directory. You will need to do this as root if you use the system-wide directory.

Installing FPC sources in home directory

Create a directory to hold the Free Pascal sources under your home directory. Note that when you extract the compressed tar file, it will include a directory of fpc-3.0.4, so if that is good enough for you go ahead and:

tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz

Installing FPC sources in system-wide directory

As root, create the fpcsrc directory in /usr/local/share, change to the new directory and:

tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz

via the pkg system

# pkg install editors/lazarus

or

# pkg install editors/lazarus-qt5

At this point Lazarus will complain about the missing Free Pascal source files. If you don't have them:

  fetch http://distcache.freebsd.org/ports-distfiles/freepascal/fpc-3.0.4.source.tar.gz

You can either install the sources in your home directory or in the system-wide /usr/local/share/fpsrc directory. You will need to do this as root if you use the system-wide directory.

Installing FPC sources in home directory

Create a directory to hold the Free Pascal sources under your home directory. Note that when you extract the compressed tar file, it will include a directory of fpc-3.0.4, so if that is good enough for you go ahead and:

tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz

Installing FPC sources in system-wide directory

As root, create the fpcsrc directory in /usr/local/share, change to the new directory and:

tar xvzf /usr/ports/distfiles/freepascal/fpc-3.0.4.source.tar.gz

via the Lazarus repository

This option will often be used if you want to follow Lazarus trunk, a Fixes branch, or some other release (eg compiling from a source tarball).

  • Use the SubVersion or Git repositories to checkout a copy of the source code you want, or unpack a downloaded source archive into a suitable location. Recent versions of FreeBSD include the svn command as svnlite, so you do not need to install full Subversion package to checkout a copy of the source code.
  • The readme.txt file in Lazarus directory mentions make clean all. This only works if you are using Linux. Under FreeBSD you need to replace make with gmake.
  cd /path/to/lazarus_source
  gmake clean all

Installation troubleshooting

Troubleshooting details that should (hopefully) be applicable across platforms may be found in the article Installation Troubleshooting.

Some additional notes for FreeBSD installations can be found in the article FreeBSD.