Lazarus on Solaris

From Lazarus wiki
Jump to: navigation, search

This howto explains the steps to get Lazarus svn and FPC svn up and running starting from a clean Solaris 10 system on either x86 or SPARC. It assumes that you have already used svn (Subversion) and have built FPC and Lazarus from source before.

There are older notes referring only to the FPC compiler and Solaris 7 at Solaris Port. While the FPC compiler will run on Solaris 8 with a little bit of library fiddling, it's unlikely that Lazarus will run on it due to missing prerequisite libraries.

Install the FPC Compiler Solaris Binaries

For x86:

Get and install fpc 2.4.4 from and the install script


The most recent version available as binaries is 2.4.2, which can be downloaded from There is an install script corresponding to this version at, but see for patches that might be needed; there might be a more recent version of this script with the trunk sources available via Subversion.

In either case it is probably worth making sure that the binaries are no more than one release behind the svn trunk. At the time of writing (July '11) trunk is 2.4.5, so while the x86 binaries at 2.4.4 are OK it might be advisable to get, build and install the 2.4.4 release for SPARC before proceeding any further. As of mid 2015, version 2.7.1 revision 29398 is particularly robust.

It might be necessary to treat ncurses from Sunfreeware (see below) as a prerequisite to recompilation. If necessary, apply the patch from

Install Required Libraries

There is an extensive freeware library containing GNU utilities and libraries at (mirrored at e.g., these are more recent and more complete than the libraries etc. on Sun's Solaris 10 "Companion" CD. Note that these are initially downloaded using a web browser rather than by a graphical package or update manager, so don't waste time hunting for one on your system. Refer to for general instructions.

Install the following packages from SunFreeware or a mirror. This is a long list because it includes a complete set of GTK2 libraries and dependencies, some of which mandate updated GNU binutils which themselves imply an update of gcc, (g)make and so on. In addition a development system will likely require a copy of Subversion, which itself has extensive dependencies. These are the versions for both Intel and SPARC systems at the time of writing (July '11):

fontconfig-2.8.0 †

† Install this only if it's not already on the system as part of Solaris.

The actual file names will be qualified by OS version and architecture, e.g. render-0.8-sol10-intel.local.gz and render-0.8-sol10-sparc.local.gz.

In addition, for a complete Subversion (i.e. including Apache-based server) installation:


It might be less disruptive to build Subversion from source, e.g. According to the INSTALL file the actual dependencies for a client using the svn: (as distinct from http:) protocol are libapr, libapr-util, SQLite and libz; these are available from e.g.

gtar xjf subversion-1.6.17.tar.bz2
gtar xjf subversion-deps-1.6.17.tar.bz2
cd subversion-1.6.17  
export LDFLAGS='-lintl -L/usr/local/lib -R/usr/local/lib'
make install

# I suspect this leaves some symlinks in a parlous state, but it appears usable.

A client that is capable of using the http: protocol will also require an SSL library, this might be problematic on very old systems but a hack that might work is to build additional libraries from source packages from a Linux distro of the same age (e.g. Slackware 8.1 for Solaris 8).

Adapt your PATH variable to get the gnu version of the binutils:

$ export PATH=/usr/local/bin:$PATH

$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Note that when FPC looks for an assembler and linker, it first scans the path looking for gas and gld, and then for as and ld. Make sure that the utilities that are found first are the ones from the binutils package installed above, other versions (i.e. the proprietary assembler and linker supplied with Solaris, or older GNU software) will probably not work as expected. Exact details might depend on what you've done with the system, which shell you're running and so on.

Check your GTK2 installation:

$ gtk-demo

A note on gld (Intel architecture only)

Gnu ld creates binaries that are not completely solaris abi compatible. malloc (libc) for example always returns a null pointer. FPC uses the solaris linker by using the -Xn compiler option (available from 2.4.2 onwards but not documented until 3.2). Solaris ld is in /usr/css/bin and gnu binutils has installed the link /usr/bin/ld :

# rm /usr/bin/ld

# ln -s /usr/css/bin/ld /usr/bin/ld

Note that you need to specify the -Xn compiler option for all your fpc and lazarus programs. Lazarus programs linked without -Xn crash with the message GLib-ERROR ... Failed to allocate 42 bytes... core dump.

A note on paths (all architectures)

The most common causes of problems are missing directories in the current search path, or not being able to find required libraries (e.g. when trying to start the Lazarus IDE or a program that uses the LCL. If running the Bash shell, make sure that the ~/local.profile file exports appropriate PATH and LD_LIBRARY_PATH variables:

# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
# ident "@(#)local.profile      1.10    01/06/23 SMI"
stty istrip

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Get and Build Sources (Intel architecture)

$ svn co fpc

$ cd fpc

$ make clean all OPT="-Xn"

$ su

# make install INSTALL_PREFIX=/usr

/etc/fpc.cfg installed with 2.4.4 is fine for your new 2.5.1 installation.

$ svn co lazarus

$ cd lazarus

$ make clean all OPT="-Xn -k-L/usr/local/lib" PP=/usr/lib/fpc/2.5.1/ppc386

Get and Build Sources (SPARC architecture)

This assumes that version 2.4.4 of the compiler has been built and installed. A later version of the compiler should work, but there are some cases where the Lazarus sources might have problems with 2.4.5/2.5.x due to conditional directives.

In the FPC sources, make sure that packages/Makefile.fpc includes iconvenc and gtk2, if necessary running fpcmake to ensure changes "stick". As a minimum:

dirs_solaris=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
              libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra \
              imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1 httpd13 httpd20 httpd22 numlib iconvenc gtk2 cairo

If Lazarus is to be compiled with database units etc. (i.e. make bigide) then also check the following:

In packages/src/sqldb/Makefile.fpc:

  dirs_solaris=interbase postgres mysql odbc oracle sqlite

$ cd fpc

$ gmake NOGDB=1 OPT='-O- -gl' all

$ su

# make install

# rm /usr/local/bin/ppcsparc

# ln -s /usr/local/lib/fpc/2.4.4/ppcsparc /usr/local/bin/ppcsparc

# exit

/etc/fpc.cfg installed with 2.4.4 is fine for your new 2.5.1 installation.

$ svn co lazarus

$ cd lazarus


$ make clean all


$ make clean bigide

Solaris 11 Express


Depending on the installation media, gnome is already installed or can easily be installed by installing the slim_install package. subversion and gnu-binutils can be installed from the solaris repository with "pkg install" or the graphical Package Manager.


solaris ld is already installed in /usr/bin. The use of -Xn is still mandatory.

Interim note: Lazarus 1.0 and successors

Do not link to this section, it will be superseded.

As of September 2012, Lazarus 1.0 has been released. As with the preceding version (0.9.30), the appropriate version of FPC to use for compilation is 2.6.0; later versions might be better with FPC 2.7.1 as described below.

In the case of SPARC, there was a small number of late-breaking patches to fix code generation issues. While these are documented as having been applied to the development versions of the compiler (2.6.1 and 2.7.1), the more significant ones were also applied to the stable version (2.6.0) shortly before release: see the summary at

Refer to for information on getting a fixes-branch daily snapshot of the compiler, or fetching it from the Subversion repository.

As of some time in 2013/2014, SunFreeware has moved to a subscription model announcing:

Following 20 years of providing free pre-compiled Open Source packages to the Solaris community though sponsorship. no longer provides free downloads as of September 30, 2013 as the sponsorship has terminated.

As of early 2015, the final FPC development trunk version of the 2.6 era (2.7.1 svn release 29398) compiles on SPARC Solaris 10 without problems. Lazarus trunk around svn release 48671 requires libraries etc. as discussed above, a usable mirror for Solaris 10 packages appears to be

Solaris appears to be more sensitive than Linux to whether something is being run as a privileged or unprivileged user. Subversion build might need to be done as root, and FPC installation may need to be done as a root login (i.e. not just using sudo).

In the longer term, the viability of Solaris as an easily-obtained operating system is questionable. might be worth investigating, this might prefer alternative packages from