Difference between revisions of "Installing Lazarus/zh CN"

From Free Pascal wiki
Jump to navigationJump to search
m (OSX -> macOS)
 
(29 intermediate revisions by 5 users not shown)
Line 66: Line 66:
 
从 2.0 发布版开始,FPC 融合进了 Subversion (SVN)。现在还没有 CVS 镜像,所以你必须使用 SVN 才能得到 FPC 的源代码。
 
从 2.0 发布版开始,FPC 融合进了 Subversion (SVN)。现在还没有 CVS 镜像,所以你必须使用 SVN 才能得到 FPC 的源代码。
  
===== Download Daily Source Snapshot of Development Tree (version 2.3.x) =====
+
(译注:下略,请参见英文)
You can download today's development (v 2.3.x) sources in the form of a packed snapshot from the SVN source repository: these snapshots are updated on a daily basis, and reflect the state of the source repository. The files are kept at the site which has the SVN archive.
 
Entire public sources archive of v2.3.x: [ftp://ftp.freepascal.org/pub/fpc/snapshot/v23/source/fpc.zip fpc.zip] (24 MB)
 
 
 
===== Download Daily Source Snapshot of Release Tree (version 2.2.x) =====
 
You can download today's development (v 2.2.x) sources that will lead to the next stable release in form of a packed snapshot from the SVN source repository: these snapshots are updated on a daily basis, and reflect the state of the source repository. The files are kept at the site which has the SVN archive.
 
Entire public sources archive of v2.2.x: [ftp://ftp.freepascal.org/pub/fpc/snapshot/v22/source/fpc.zip fpc.zip] (24 MB)
 
 
 
 
===== Connect to Source Repository with SVN (replaces section on connection to CVS) =====
 
As an alternative to the daily zip files of the SVN sources, the SVN repository has been made accessible for everyone, with read-only access. This means that you can directly access the code, and you will have really the last-minute sources available. It is also a method which requires less bandwidth once you have done the first download (checkout in SVN lingo).
 
===== Development snapshots =====
 
How to do this?
 
(You need to have SVN installed, of course. Look  [http://subversion.tigris.org/ here] for instructions on how to do that.)
 
 
 
Change Directory (cd) to the parent directory of your development area, eg
 
 
 
[]$ cd /home/username/FreePascal
 
 
 
To retrieve the full source repository, all publicly available modules, type
 
 
 
[]$ svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
 
 
 
Normally, you should perform this step just once.
 
 
 
To update the sources which were downloaded (checkout) above
 
 
 
[]$svn update fpc
 
 
 
 
 
===== Fixes to 2.2.x =====
 
 
 
The fixes need a separate directory, create a separate directory 'fixes', enter it, and repeat the above checkout command with the URL http://svn.freepascal.org/svn/fpc/branches/fixes_2_2:
 
 
 
[]$ cd mysvn/fixes
 
[]$ svn checkout http://svn.freepascal.org/svn/fpc/branches/fixes_2_2 fpc
 
 
 
and to update:
 
 
 
[]$ svn update fpc
 
 
 
The sources of docs are in a separate repository called fpcdocs, so the command to get them is
 
 
 
[]$ svn checkout http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs
 
 
 
If you want to learn more about subversion, read this excellent [http://svnbook.red-bean.com/ Subversion book] which is also available online in different formats for free.
 
 
 
For the curious: You have only read-only access, so don't try to commit anything :-)
 
 
 
 
For more information, see the [http://www.freepascal.org/develop.html FreePascal] website
 
For more information, see the [http://www.freepascal.org/develop.html FreePascal] website
  
=== Installing Free Pascal under Windows ===
+
=== 在 Windows 下安装Free Pascal ===
  
==== FPC Binaries for Windows ====
+
==== FPC 二进制的Windows版 ====
  
 
By far the easiest way to get a working installation of Free Pascal is to download the current binary Windows release of Lazarus from the SourceForge repository - the release contains the current versions of the FreePascal compiler and the FreePascal libraries as well as the lazarus IDE. If you want to install from sources, read on!
 
By far the easiest way to get a working installation of Free Pascal is to download the current binary Windows release of Lazarus from the SourceForge repository - the release contains the current versions of the FreePascal compiler and the FreePascal libraries as well as the lazarus IDE. If you want to install from sources, read on!
Line 126: Line 78:
 
Installing from the sources -- see the next section to know how to get them -- is not for novices, since you need a starting compiler as well.
 
Installing from the sources -- see the next section to know how to get them -- is not for novices, since you need a starting compiler as well.
  
==== FPC Sources for Windows ====
+
==== FPC windows版的源代码 ====
 
<<<< See section above under [[#FPC Sources|FPC Sources]] for Linux, where the use of SVN is described >>>>
 
<<<< See section above under [[#FPC Sources|FPC Sources]] for Linux, where the use of SVN is described >>>>
  
The easiest way to get the Free Pascal sources is via SVN; see the next section for more on that. You can also download the package as a whole -- see http://www.freepascal.org/develop.html for the daily snapshot of the 2.3.x release tree.
+
(略,请参见英文页面)
  
Windows FPC Sources via SVN ()
+
=== 安装 FreeBSD/auto版的Free Pascal ===
 
 
You will need to have a SVN client such as TortoiseSVN installed in order to perform the steps below. The exact commands vary between SVN clients; the ones given below are to be used under SVN home's client, which is available for download here.
 
 
 
First create a directory in which you'd like to put the sources. Any normal user can do this. Create a directory for fpc (e.g. C:\Source), then do the following at the command prompt:
 
  C:\Source> svn co http://svn.freepascal.org/svn/svn/trunk fpc
 
Hint: To download/update the latest changes you can simply do
 
  C:\> cd Source\FPC
 
  C:\Source\FPC> svn up
 
''ToDo: Write me.''
 
 
 
See: http://www.freepascal.org/down-win32.html . You can find a list of mirrors at http://www.freepascal.org/sdown.html. Download FPC as one big file, unzip it and run the install.exe.
 
 
 
Extending your PATH variable to the fpc directory:
 
 
 
* Win98: Edit autoexec.bat and add the line: PATH=%PATH%;C:\pp\bin\bin\win32
 
* WinXP/2k: My Computer (Right Click) ->  Properties -> Advanced (Page) -> Enviroment Variables -> System Variables -> Edit "PATH", Add "C:\pp\bin\bin\win32" there.
 
 
 
Then restart windows.
 
 
 
''ToDo: Explain how to download fpc sources and build the compiler''
 
 
 
=== Installing Free Pascal under FreeBSD/auto ===
 
  
 
Latest FreeBSD ports collection has 2.2.0 stable version in ports/lang/fpc. But they are scattered over 57 (!) packages and do not install the sources, so it is almost always better to install manually (see below). Nevertheless here is how to install the port.
 
Latest FreeBSD ports collection has 2.2.0 stable version in ports/lang/fpc. But they are scattered over 57 (!) packages and do not install the sources, so it is almost always better to install manually (see below). Nevertheless here is how to install the port.
  
 
This can be done as root.
 
This can be done as root.
 
+
下面这些能被root完成
 
  []# cd /usr/ports/lang/fpc && make install && make clean
 
  []# cd /usr/ports/lang/fpc && make install && make clean
  
Line 169: Line 99:
 
  []$ fpc
 
  []$ fpc
  
=== Installing Free Pascal under BSD/manually ===
+
=== 安装BSD/manually版本的 Free Pascal ===
  
 
Effectively, you need
 
Effectively, you need
Line 176: Line 106:
  
 
1. e.g. for fpc ftp://ftp.freepascal.org/fpc/dist/Linux/separate/sources.tar preferably an export (no CVS/ dirs). The above file misses this.
 
1. e.g. for fpc ftp://ftp.freepascal.org/fpc/dist/Linux/separate/sources.tar preferably an export (no CVS/ dirs). The above file misses this.
2. Lazarus source snapshot.
+
2. Lazarus source 快照
 
* _any_ starting compiler from the 2.2.0 branch) You can do a check by parsing the output of ppc386 -i if it is 2.2.0 .. 2.3.x it is ok.
 
* _any_ starting compiler from the 2.2.0 branch) You can do a check by parsing the output of ppc386 -i if it is 2.2.0 .. 2.3.x it is ok.
 
* - dependant packages. (for FreeBSD that is gtk12, glib12 and gdk_pixbuf and GNU make, iconv and gettext)
 
* - dependant packages. (for FreeBSD that is gtk12, glib12 and gdk_pixbuf and GNU make, iconv and gettext)
Line 186: Line 116:
 
3. (build) enter work/fpc/ and run
 
3. (build) enter work/fpc/ and run
  
   $MAKE all OPT='-gl -O3p3'  PP=/path/to/startingcompiler-name-ppc386
+
   $MAKE all OPT='-gl'  PP=/path/to/startingcompiler-name-ppc386
 
  (/path/to/ can be omitted when ppc386 is in the path)
 
  (/path/to/ can be omitted when ppc386 is in the path)
 
  ($MAKE is make on linux and gmake on BSD)
 
  ($MAKE is make on linux and gmake on BSD)
Line 208: Line 138:
 
* BSDHIER=1 on all make commands forces BSD hierarchy conventions.
 
* BSDHIER=1 on all make commands forces BSD hierarchy conventions.
  
=== Installing Free Pascal under Mac OS X ===
+
=== Installing Free Pascal under macOS ===
  
 
You also need the Apple Developer tools, X11, and GTK 1.2:
 
You also need the Apple Developer tools, X11, and GTK 1.2:
  
Developer-tools: Are included on the original OSX installation CDs, or download at ADC (free registration required):
+
Developer-tools: Are included on the original operating system installation CDs, or download at ADC (free registration required):
 
: http://developer.apple.com/.
 
: http://developer.apple.com/.
  
Line 219: Line 149:
 
On an already installed system:  
 
On an already installed system:  
  
MacOSX 10.3: download at:
+
macOS 10.3: download at:
 
: http://www.apple.com/downloads/macosx/apple/x11formacosx.html
 
: http://www.apple.com/downloads/macosx/apple/x11formacosx.html
  
MacOSX 10.4: install X11 from the DVD.
+
macOS 10.4: install X11 from the DVD.
  
 
GTK 1.2: Downloading the GTK packages and installing them properly can be a time consuming task. Therefore there are various package managers. One of them is fink:
 
GTK 1.2: Downloading the GTK packages and installing them properly can be a time consuming task. Therefore there are various package managers. One of them is fink:
Line 232: Line 162:
 
The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click.
 
The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click.
  
Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under MacOSX this is deactivated. You can activate it for all X11 applications by typing in the terminal:
+
Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under macOS this is deactivated. You can activate it for all X11 applications by typing in the terminal:
 
         defaults write com.apple.x11 wm_click_through -bool true
 
         defaults write com.apple.x11 wm_click_through -bool true
  
Line 245: Line 175:
 
For Lazarus you need the FPC sources as well:
 
For Lazarus you need the FPC sources as well:
  
*Install SVN for MacOS X: A good package is provided by [http://www.codingmonkeys.de/mbo/ Martin Ott].
+
*Install SVN for macOS: A good package is provided by [http://www.codingmonkeys.de/mbo/ Martin Ott].
  
 
Create a directory, where you would like to put the sources. You don't need to be root to do this. Any normal user can do this.  
 
Create a directory, where you would like to put the sources. You don't need to be root to do this. Any normal user can do this.  
Line 257: Line 187:
 
  []$ svn up
 
  []$ svn up
  
== Installing Lazarus ==
+
== 安装 Lazarus ==
  
=== Installing Lazarus under Linux ===
+
=== 在Linux下安装 Lazarus ===
  
 
==== Ubuntu / Debian ====
 
==== Ubuntu / Debian ====
Line 267: Line 197:
 
Experimental: [[How to setup a FPC and Lazarus Ubuntu repository]]
 
Experimental: [[How to setup a FPC and Lazarus Ubuntu repository]]
  
==== Building debs the easy way ====
+
==== 轻松建立 debs ====
  
 
The easiest way to get a current working installation of Lazarus is to download build your own .deb packages by following the instructions at:
 
The easiest way to get a current working installation of Lazarus is to download build your own .deb packages by following the instructions at:
Line 273: Line 203:
 
[[How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository]]
 
[[How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository]]
  
==== Installing using rpms ====
+
==== 用rpms安装 ====
  
 
The next easiest way is to the RPMs for FreePascal and Lazarus from the SourceForge repository.
 
The next easiest way is to the RPMs for FreePascal and Lazarus from the SourceForge repository.
Line 295: Line 225:
 
   rpm -ivh lazarus-*
 
   rpm -ivh lazarus-*
  
====Installing on Mandriva====
+
====Mandriva 上安装====
===== Lazarus 0.9.22 on Mandriva 2007 (2007.0) (i386) (GTK-1)=====
 
 
 
Installation in Mandriva is very easy. However, there are a few points to check as the installation proceeds. Here is a typical installation using the .tar modules (see the trick for the theme at the end of the procedure!):
 
 
 
- During the Mandriva installation, select the "Gnome desktop" group. Although you will use lazarus in KDE or other desktop, this will install some GTK modules needed by the lazarus environment.
 
 
 
- Install the FPC 2.0.4 compiler using either the .rpm or .tar, modules. Using the .tar modules you would type: "sh install.sh" then RETURN many times. I do this in superuser mode.
 
 
 
- Install the compiler source code. just untar the file "fpc-src-2.0.4.source.tgz" in the folder /usr/local/src/fpc/ then rename the  created folder "fpc" to "2.0.4" . When complete, you have the folder /usr/local/src/fpc/2.0.4/ that contains all the source code. The source code is only needed by lazarus editor, but you can recompile FPC and have an optimized version of the libraries, and show that everything is working well:
 
 
 
- If you want to compile FPC (optional), then go to the FPC source directory (/usr/local/src/fpc/2.0.4/) and type "./configure", "make clean","make all","make install","make clean". FPC is now installed. Check the content of "/etc/fpc.cfg". This file has to be modified when the make fails.
 
 
 
- Lazarus can be installed in user mode: just unzip/untar the file "lazarus-0.9.22.0.tar.gz" in your user directory. Then just type "make clean all" in the user mode. The last phase of the process (link) usually fails due to missing lbrary files:
 
 
 
- Check in the directory /usr/lib/ for the following symbolic links:
 
 
 
libglib.so -> libglib-1.2.so.0
 
 
 
libgtk.so -> libgtk-1.2.so.0.9.1
 
 
 
libgdk.so -> libgdk-1.2.so.0.9.1
 
 
 
libgdk_pixbuf.so -> libgdk_pixbuf.so.2.0.0
 
 
 
The file "libgdk_pixbuf.so.2.0.0" is included in the module "libgdk_pixbuf-2.0.22.0-10mdv2007.0.rpm" This file name is critical. In particular, DO NOT use "libgdk_pixbuf-2.0.so.0" (misleading isn't!).
 
 
 
After all the links have been fixed, the "Linking ../lazarus" stage will not crash any more and the "./lazarus" command should start the program!
 
 
 
- Go to the "environment/environment options" menu and change the "FPC source directory" to /user/local/src/fpc/2.0.4
 
 
 
USEFULL TO KNOW:
 
 
 
- The last step is to fix the theme. The package "galaxy-gnome-1.0.4-3mdv2007.0" is available in the
 
Mandriva control center. Install it.
 
 
 
- The package "gtk-theme-switch-1.0.1-4mdv2007.0.i586.rpm" is
 
available on the web! (strangely it did not show in the control center)
 
Install it manually by typing "rpm -iv --test gtk-theme-switch-1.0.1-4mdv2007.0.i586.rpm" then retype the line without the "--test" in my case there was a warning message related to
 
the signature. I decided to ignore it!
 
 
 
- in the USER MODE, type "switch", then chose "galaxy" theme.
 
 
 
The Lazarus / FPC tool is now installed!
 
 
 
===== Lazarus 0.9.20 on Mandriva 2007/or -2006 32 bit =====
 
Write this urpmi-command as root:
 
<pre>
 
urpmi http://surfnet.dl.sourceforge.net/sourceforge/lazarus/lazarus-0.9.20-0.i386.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-2.0.4-0.i586.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-docs-2.0.4-0.i586.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-src-2.0.4-0.i386.rpm
 
</pre>
 
It seems like Lazarus 0.9.20 depends on fpc 2.0.4, and Mandriva 2007 is shipped with fpc-2.1.1-0.2mdk.i586. To prevent your system to upgrade to fpc-2.1.1 or newer in the future, when you run commands as urpmi --auto-select, you can write fpc in /etc/urpmi/skip.list.
 
 
 
===== Lazarus untested snapshot on Mandriva 2007 32 bit =====
 
<pre>
 
urpmi $(for RPM in $(lynx --source http://michael-ep3.physik.uni-halle.de/Lazarus/ | grep i386.rpm | cut -d '"' -f 4-4) ; do echo -n http://michael-ep3.physik.uni-halle.de/Lazarus/$RPM ' '; done )
 
</pre>
 
 
 
===== Installing Lazarus + fpc For Mandriva 2007 X86_64 =====
 
This has worked for Mandriva 2007.0 X86_64 (AMD X2 4800+)
 
  
* Download the X86_64 snapshots from http://michael-ep3.physik.uni-halle.de/Lazarus/ Lazarus Snapshots
+
(译注:略,参见英文页面)
* I used these:
 
<pre>
 
fpc-2.0.4-20061006.x86_64.rpm
 
fpc-src-2.0.4-20061006.x86_64.rpm
 
lazarus-0.9.19-20061006.x86_64.rpm
 
</pre>
 
* To install the current snapshot:
 
<pre>
 
urpmi $(for RPM in $(lynx --source http://michael-ep3.physik.uni-halle.de/Lazarus/ | grep 64.rpm | cut -d '"' -f 4-4) ; do echo -n http://michael-ep3.physik.uni-halle.de/Lazarus/$RPM ' '; done )
 
</pre>
 
* Once the RPMs have been installed.  Run lazarus for the first time.  It will pop up a dialog complaining that the "/usr/bin/ppc386" and "/usr/lib/lazarus" are not valid.  Accept ("OK") the alternate choices it suggests.
 
* When compiling your first project, you may find that lazarus complains of missing libs (e.g. gdk, glib, etc.).  Install the necessary libs as needed, I installed these (that I recall, YMMV):
 
<pre>
 
glib-devel
 
lib64gtk+1.2-devel
 
lib64gtk+2.0_0-devel
 
lib64gdk-pixbuf2
 
lib64gdk-pixbuf2-devel
 
</pre>
 
  
====Installing on Suse====
+
====Suse 上安装====
 
===== Installing Lazarus 0.9.18. For Suse 10.1 users =====
 
===== Installing Lazarus 0.9.18. For Suse 10.1 users =====
 +
(译注:略,参见英文页面)
  
This have worked on SUSE10.0 and FC5.
+
==== 从源代码安装 ====
 
 
Start Linux and login as "Root"<br><br>
 
Free Pascal Compiler requires:<br>
 
- Gnu binutils (gnu as, gnu ld, gnu make) - check it out with "YAST"
 
 
 
Download these binary files (RPM)
 
:* fpc-2.0.4-0.i586.rpm (yes i586 and not i386)
 
:* fpc-src-2.0.4-0.i386.rpm
 
 
 
install them opening a terminal session (mouse's right button -> Menu: Open in terminal)
 
:* rpm -Uvh fpc-2.0.4-0.i586.rpm
 
:* rpm -Uvh fpc-src-2.0.4-0.i386.rpm
 
 
 
Lazarus requires these components:
 
1) glib devel
 
2) gtk devel
 
3) gdk-pixbuf-devel
 
4) gtk+-devel.<br>
 
 
 
'''Important''': The lazarus rpm requires the gtk 1 or 1.2 version, not the version 2 of the above packages.
 
 
 
The last component seems does not work with Suse, then once we have installed the first three components we can force installation with -nodeps option:
 
:*rpm -Uvh --nodeps lazarus-0.9.18-0.i386.rpm
 
 
 
'''Note''': If you did not install the devel packages, you can setup the links yourself (/opt/gnome/lib):
 
  libgtk-1.2.so.0 -> libgtk.so
 
  libglib-1.2.so.0 -> libglib.so
 
  libgdk-1.2.so.0 -> libgdk.so
 
  libgdk_pixbuf.so.2.0.0 -> libgdk_pixbuf.so
 
These filenames are for OpenSuSE 10.2.
 
 
 
==== Installing from source ====
 
 
If you prefer to install from source and compile the files yourself, follow these instructions. Because the whole lazarus stuff is installed into one directory, uninstall is very easy and you don't need to be root to install lazarus. You can get tgz files for fpc, fpcsrc and lazarus from the downloads section or you can download it directly via svn.
 
If you prefer to install from source and compile the files yourself, follow these instructions. Because the whole lazarus stuff is installed into one directory, uninstall is very easy and you don't need to be root to install lazarus. You can get tgz files for fpc, fpcsrc and lazarus from the downloads section or you can download it directly via svn.
  
Here is an example of installing 0.9.18 to Ubuntu 6.06. If you understand Linux commands and bash script, you can get what steps are needed. Just copy the script (change the version number when new version has been released), paste it into a text editor, and save it as something like "install_lazarus.sh". Give it execute permission, and run it in
+
(译注:略,参见英文页面)
a console.
 
Note: In this example, fpc is installed in /opt. So when prompted 'Install prefix', enter '/opt/fpc'.
 
 
 
  #!/bin/sh
 
 
 
  #installing required packages
 
  sudo apt-get install build-essential
 
  sudo apt-get install libgtk2.0-dev
 
  sudo apt-get install libgdk-pixbuf-dev
 
 
 
  #installing FreePascal source
 
  cd /opt
 
  sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-src-2.0.4.source.tgz
 
  sudo tar -xvf fpc-src-2.0.4.source.tgz
 
  sudo mv fpc fpcsrc
 
 
 
  #installing FreePascal
 
  sudo mkdir fpc
 
  cd fpc
 
  sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-2.0.4.i386-linux.tar
 
  sudo tar -xvf fpc-2.0.4.i386-linux.tar
 
  echo "Enter '/opt/fpc' when prompted 'Install prefix'"
 
  sudo sh install.sh
 
 
 
  #adding fpc path to the PATH
 
  echo "#FPC PATH" >> ~/.bash_profile
 
  echo "if [ -d /opt/fpc/bin ] ; then" >> ~/.bash_profile
 
  echo PATH=/opt/fpc/bin:"${PATH}" >> ~/.bash_profile
 
  echo "fi" >> ~/.bash_profile
 
 
 
  #installing Lazarus
 
  cd ../
 
  sudo wget http://nchc.dl.sourceforge.net/lazarus/lazarus-0.9.18-0.tar.gz
 
  sudo tar -zxvf lazarus-0.9.18-0.tar.gz
 
  PATH=/opt/fpc/bin:"${PATH}"
 
  sudo chmod -R 777 lazarus
 
  cd lazarus
 
  make clean all
 
  ./lazarus
 
 
 
Note: You have to manually set fpc-src path in the Environmental Options.
 
 
 
===== Downloading Lazarus SVN =====
 
 
 
The lazarus repository has moved from cvs to svn (Subversion). SVN provides an easy way to update your sources by only downloading the changes. This is the recommended way and saves you a lot of time. A connection to the internet is needed for this: you don't need to be root. Lazarus does not need any special permissions, neither during installation nor at runtime.
 
 
 
With the move we also changed the directory layout of the lazarus sources. The main difference
 
is that all ide sources are moved from the root to a separate ide subdir. As anybody might understand, this has an impact on the Makefiles, the searchpaths etc. We are in progress of fixing things, so if something doesn't work, please let us know.
 
 
 
;Now the most important thing.... getting the sources:
 
 
 
  []$ svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus
 
(or any other dir where you want to place your sources)
 
  
On subsequent occasions, to update simply type
+
==== Debian GNU/Linux下安装 Lazarus ====
 
 
  []$ svn update lazarus
 
 
 
For more information on Subversion, see:
 
http://subversion.tigris.org/
 
 
 
Note: the CVS is still accessable, but it frozen. This means
 
that no new updates are comitted.
 
 
 
===== Compiling and running =====
 
Whether you checkout from cvs or svn, the next step is:
 
 
 
;compile lazarus:
 
[]$ cd lazarus
 
[]$ make  (gmake on BSD)
 
 
 
 
 
If fpc is installed correctly, the compilation should work without problems. If not, see FAQ.
 
 
 
;Start lazarus
 
[]$ ./lazarus
 
 
 
The IDE should start. If you started lazarus in a terminal, you can see some notes about missing settings. This is normal at first start. The IDE automatically tries to find out where the freepascal compiler and its sources are installed by searching in the most common directories.
 
 
 
;Check the paths:
 
: Use the IDE menu to go to
 
:: Environment -> Environment Options -> Files
 
 
 
The 'FPC Source directory' should point to your fpc source directory. This directory normally ends with /fpc/ or /fpcsrc/ (e.g. /usr/src/fpcsrc or /home/username/freepascal/fpc) and contains directories like 'compiler', 'docs', 'fcl', 'rtl' and 'packages'.
 
 
''ToDo: explain the other paths''
 
 
 
;Hint:
 
To update lazarus you can use
 
[]$ svn update lazarus
 
then for either update pathway:
 
[]$ make clean all  (gmake on BSD)
 
This will rebuild lazarus and create an IDE without lazarus packages. To link your installed packages do '''after''' the above:
 
[]$ make idepkg
 
 
 
==== Installing Lazarus under Debian GNU/Linux ====
 
  
 
There are preliminary Debian packages for lazarus available for download. They are not the latest versions, however. Make sure you read /usr/share/doc/lazarus/README.Debian carefully before you start using it. Feedback is needed and appreciated; please send your comments to Carlos Laviola <claviola@debian.org>.
 
There are preliminary Debian packages for lazarus available for download. They are not the latest versions, however. Make sure you read /usr/share/doc/lazarus/README.Debian carefully before you start using it. Feedback is needed and appreciated; please send your comments to Carlos Laviola <claviola@debian.org>.
Line 522: Line 250:
 
==== Another way to install Lazarus under Debian ====
 
==== Another way to install Lazarus under Debian ====
 
Added by [[User:Kirkpatc]].
 
Added by [[User:Kirkpatc]].
 +
(译注:略,参见英文页面)
  
;Simple Lazarus Installation in Debian
+
=== 在Windows下安装Lazarus ===
(assume new Debian installation, without development libraries loaded)
 
  
From sourceforge repository, download latest fpc, fpclib and lazarus releases; follow links from http://lazarus.freepascal.org, click the "downloads" button on the left, then click on "binaries" then "linux" then "Current Lazarus RPM". This will bring you to
+
当前版本的视窗版Lazarus二进制包的安装非常轻松,它‘打开盒子就能用’(out-of-the-box)。
: http://sourceforge.net/project/showfiles.php?group_id=89339
 
then download the following files (or more recent, if available)
 
* fpc-2.0.0-0.i586.rpm
 
* fpcsrc-2.0.0-0.i386.rpm
 
* lazarus-0.9.8-fpc_2.0.0_0.i386.rpm
 
cd to the directory where these files are stored, then become root (su) and type:
 
  
alien -c fpc*    //this will convert both the fpc and fpcsrc files to debian format and convert the install scripts
+
==== 安装Lazarus到优盘 ====
alien -c laz*
 
then install the generated Debian (.deb) packages by (as root):
 
  
dpkg -i fpc*.deb laz*.deb
+
甚至能把整个Lazarus/FPC包安装到一个便携式USB驱动器(优盘,容量至少256MB),针对某些环境,比如你不允许安装软件的视窗工作站,或者你没有获得超级管理员权限。你必须注意,调整编译路径、环境选项,还有 fpc.cfg文件。也许,必须要保持编译测试的文件夹位置,在你的U盘。
or use kpackage or a similar utility to install the generated fpc, fpcsrc and lazarus .deb files.
 
  
And if you do not have alien type:
+
<< 问:有谁知道,怎样设置‘相对路径’在这些标签和文件中,以保证寻址工作正常,当你移动U盘到另一台电脑会遇到一个不同的盘符的?
  
apt-get install alien
+
答: 我就是这么做的。关联很复杂,但这是我发现的最佳方案(译注:确实很复杂,谁看明白了接着翻译吧。请参见[http://pengtu.net/wp2/ooo/lazarus-green 《Lazarus中文版免重装的方法》])。 I have a "bin" directory on my USB drive, where I have several scripts and utilities installed. Inside that directory is a batch file called "setenv.bat" which sets an environment variable called THUMBDRIVE. It is set by using this command in the batch file:
 +
  set THUMBDRIVE=%CD:~0,2%
 +
This is used in setenv.bat to set some paths to other things I have installed on the USB drive. I also have a link in the root directory of the thumb drive with this property:
 +
  %SystemRoot%\system32\cmd.exe /k bin\setenv
 +
so that when I click on that link when the thumb drive folder is diplayed after inserting it, it will open a command prompt at the thumb drive with the environment variables set from setenv.bat.
  
Please note that, on Linux distributions like Ubuntu, you'll have to add 'sudo' in front of all commands. In Ubuntu previous command would be
+
Also inside the bin directory is [http://sed.sf.net sed] (the actual binary is one I obtained from the mingw distribution). So I created another batch file called fixlaz.bat which takes one argument, the drive letter which is currently in the Lazarus/fpc settings files that you want to change (note that this is the previous drive letter the last time you ran fixlaz.bat, not the current one of your USB drive which fixlaz.bat already knows). You will need to create this batch file to fit where you installed Lazarus in the root directory structure of the drive if you didn't install it directly in the root folder, and then repeat these lines also for the editoroptions.xml and fpc.cfg files (fpc.cfg is the the fpc bin directory, which might be buried deep in the lazarus folder):
 +
  copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
 +
  sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml
  
sudo apt-get install alien
+
So to use it, I would type at the command prompt of the USB drive:
 
+
  fixlaz G:
You need to produce a configuration file, which will reside in /etc/fpc.cfg. Still as root, cd to the main fpc directory /usr/lib/fpc/2.0.0 and then type
+
if "G:" was the previous drive letter used the last time I ran it. This will then scan the file(s) and replace "G:" with the current drive letter of the USB drive, which is in the %THUMBDRIVE% environment variable (after running setenv.bat). Note that you could write it to save the current drive letter in a separate file, so that you wouldn't have to remember it yourself the next time. But this works well enough for me right now.
sh ./samplecfg /usr/lib/fpc/2.0.0 /etc
+
>>
Check the contents of your new configuration file (cat /etc/fpc.cfg) and make any changes you want using vi or another text editor. Also make sure that there are no old configuration files in for example your home directory (~/.fpc.cfg).
 
 
 
You need to install the development packages of the GTK and pixbuf libraries, so
 
apt-get install libgtk2.0-dev
 
apt-get install libgdk-pixbuf-dev
 
Then you should be ready to start programming!
 
 
 
=== Installing Lazarus under Windows ===
 
 
 
The current releases of the Windows Lazarus binary packages install very easily, and should work 'out-of-the-box'.  
 
 
 
It is even possible to install the whole Lazarus/FPC package on a portable USB drive (capacity at least 256 MB), for use in environments where you are not allowed to install software on your Windows workstation or where you haven't got administrator privileges. You do have to be a little careful about adjusting the paths in the compiler and environment options and the fpc.cfg file. It may also be necessary to keep the directory for test compilation on your portable drive. << DOES ANYONE KNOW HOW TO SET UP RELATIVE PATHS IN THESE TAGS AND FILES, SO THAT THE ADDRESSING WORKS WHEN YOU MOVE THE USB DEVICE TO ANOTHER MACHINE WHERE IT HAS A DIFFERENT DRIVE LETTER? >>
 
  
 
The binary package is available for Linux and Windows from
 
The binary package is available for Linux and Windows from
Line 572: Line 285:
 
You can also use a Lazarus Snapshot. For download locations see [[Lazarus Snapshots Downloads]].
 
You can also use a Lazarus Snapshot. For download locations see [[Lazarus Snapshots Downloads]].
  
Tipp:
+
小提示:
It's perhaps a good idea to reboot your Windows after you installed Lazarus and before you try to install aditional lazarus components as zeoslib fore example.
 
  
==== Installing from source ====
+
这也许是个好主意:在安装Lazarus之后重启你的Windows,然后再去安装额外的Lazarus组件,比如zeoslib。
 +
 
 +
==== 从源代码安装 ====
 
If you prefer to install from sources, then follow these instructions (Thanks to Joe for the initial Step-by-step description)
 
If you prefer to install from sources, then follow these instructions (Thanks to Joe for the initial Step-by-step description)
 +
(译注:略,参见英文页面)
  
 
+
=== 在FreeBSD下安装 Lazarus ===
You have to download the lazarus source from one of the [[Lazarus Snapshots Downloads|snapshots servers]].
 
Then unzip it to c:\lazarus for example [below called $(LazarusDir)].
 
 
 
Or you use SVN:
 
  []$ svn checkout http://svn.freepascal.org/svn/lazarus/trunk/
 
 
 
You have to install at least fpc-2.0.2, but a fpc-2.0.4 or fpc 2.1.x snapshot is also possible. It compiles for me, and lazarus.exe works. The path to my fpc is: c:\pp\bin\win32. In this directory you can find a lot of exe (make, grep, ppc386, and so on).
 
 
 
Open a command line. Start->Run...>command or choose MS-DOS icon.
 
 
 
Type:
 
//Replace $(LazarusDir) with the path you have unzipped/checked out Lazarus
 
cd $(LazarusDir)\ide
 
set path=c:\pp\bin\win32;$(LazarusDir)  //of course change the first to
 
                                        //the path of yours
 
windres -i lazarus.rc -o lazarus.res
 
cd $(LazarusDir)
 
make
 
 
 
If you are lucky then you can type: lazarus.exe. The source editor, dialogs and the property editor work, but not perfectly... Look and you will see.
 
 
 
You can compile examples also:
 
 
 
cd $(LazarusDir)\examples
 
make
 
 
 
<s>If you extracted lazarus to another drive, eg.: d:\lazarus. It can happen that you need the gnu utility to make it. If you have it, you can take its path to set path=...;<gmakepath> but it is simpler not to choose drive d:\</s>
 
 
 
That's all.
 
 
 
=== Installing Lazarus under FreeBSD ===
 
  
 
'''FreeBSD 5+'''
 
'''FreeBSD 5+'''
Line 630: Line 314:
 
'''[other OpenBSD/NetBSD/DragonFlyBSD goes here]'''
 
'''[other OpenBSD/NetBSD/DragonFlyBSD goes here]'''
  
=== Installing Lazarus under Mac OS X ===
+
=== 在Mac OS X下安装 Lazarus ===
  
 
Works pretty much the same as under Linux. But you first need to install the Apple developer tools, X11, and GTK 1.2.
 
Works pretty much the same as under Linux. But you first need to install the Apple developer tools, X11, and GTK 1.2.
Line 653: Line 337:
 
Click Done. Now you can start Lazarus by choosing Applications | Lazarus.
 
Click Done. Now you can start Lazarus by choosing Applications | Lazarus.
  
=== Additional experiences and advice on installing FPC and Lazarus ===
+
=== 关于安装FPC和Lazarus附加的经验和劝告 ===
  
 
On linux, getting Lazarus to work can be complicated if you have an older version installed. If you have already installed earlier versions of FPC and/or Lazarus, you have to take great care that the PATHS are adjusted so that only your new versions are called.
 
On linux, getting Lazarus to work can be complicated if you have an older version installed. If you have already installed earlier versions of FPC and/or Lazarus, you have to take great care that the PATHS are adjusted so that only your new versions are called.
Line 660: Line 344:
  
 
The rpm versions often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib.
 
The rpm versions often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib.
 +
rpm版本经常把FPC安装在/bin或者/usr/bin里面,那些类库被装在/lin或者/lib里。
  
If you perform a make install on a source version or use a .tar.gz, the compiler is usually installed in /usr/local/bin with the libraries in /usr/local/lib.
+
If you perform a make install on a source version or use a .tar.gz, the compiler is usually installed in /usr/local/bin with the libraries in /usr/local/lib.如果你执行一个安装版本或者使用一个.tar.gz,这个编译程序通常被安装在/usr/local/bin里,类库会被安装在/usr/local/lib里。
  
 
So if earlier versions have been installed from rpm, make sure all links are changed to reflect the directory structure of your new compiler. The place to make the changes is in /etc/fpc.cfg ; make sure there are no remnant configuration files in your home directory or in your FPC download directory. Typically they are found in ~/.fpc.cfg
 
So if earlier versions have been installed from rpm, make sure all links are changed to reflect the directory structure of your new compiler. The place to make the changes is in /etc/fpc.cfg ; make sure there are no remnant configuration files in your home directory or in your FPC download directory. Typically they are found in ~/.fpc.cfg
Line 669: Line 354:
 
In /usr/local/bin or /usr/bin there is a file called fpc ; this is the executable that is called when you invoke the compiler. One of the first things it does is to open ppc386 in the same directory. This has to be the same version as the fpc file, or can be a link pointing to the true ppc386 in some other directory (such as a library directory, or the fpc directory in your own development space); be sure to update your link if you install a newer version of the compiler.
 
In /usr/local/bin or /usr/bin there is a file called fpc ; this is the executable that is called when you invoke the compiler. One of the first things it does is to open ppc386 in the same directory. This has to be the same version as the fpc file, or can be a link pointing to the true ppc386 in some other directory (such as a library directory, or the fpc directory in your own development space); be sure to update your link if you install a newer version of the compiler.
  
Try running the compiler from the command line using one of the simple example programs or one which you wrote yourself.
+
Try running the compiler from the command line using one of the simple example programs or one which you wrote yourself.尝试使用命令行运行编译程序,编译一个简单的例子程序或者是你自己以前写的些代码。
  
 
Turning to Lazarus:
 
Turning to Lazarus:
Line 682: Line 367:
 
You may find further problems when you start programming or compiling; most of these will be related to PATH selection.
 
You may find further problems when you start programming or compiling; most of these will be related to PATH selection.
  
Many of the difficulties are dealt with in the Lazarus FAQ, found either on this WiKi site, or a more complete list on the main Lazarus site
+
Many of the difficulties are dealt with in the Lazarus FAQ, found either on this WiKi site, or a more complete list on the main Lazarus site。有一些困难已经被发现,你可能通过Lazarus的FAQ解决困难,或者其它完整的列表在Lazaru的主站点。有困难就先到下面的地址查查。
  
 
http://www.lazarus.freepascal.org/modules.php?op=modload&name=FAQ&file=index
 
http://www.lazarus.freepascal.org/modules.php?op=modload&name=FAQ&file=index
  
From the top menu select Run -> Compiler Options (or Project -> Compiler Options in more recent releases of Lazarus) and select the Paths tab on the resulting dialog. There are several boxes for entry of paths for Unit files, Include files, Other source files, Libraries etc. For each of these, it is worth pressing the ... (ellipsis) button on the right, and you will be given a blank window for inserting path information, and a lower window giving some suggestions. Select as many as you like (or ALL!) and press the ADD button to transfer the selections to the upper window. When your selection is complete, press OK and move on to the next box. If you know of other paths which need to be followed, press the Browse button associated with each box, and insert the additional paths.
+
From the top menu select Run(在顶层菜单选择运行Run) -> Compiler Options(编译选项) (or Project(或者选择项目) -> Compiler Options in more recent releases of Lazarus) and select the Paths tab on the resulting dialog并且设置对话结果的路径. 那是几个输入框是设置路径的输入项 有单元文件的路径, Include(包括)文件的路径,其它资源文件的路径, 类库路径等等。 For each of these, it is worth pressing the ... (ellipsis) button on the right, and you will be given a blank window for inserting path information, and a lower window giving some suggestions. Select as many as you like (or ALL!) and press the ADD button to transfer the selections to the upper window. When your selection is complete, press OK and move on to the next box. If you know of other paths which need to be followed, press the Browse button associated with each box, and insert the additional paths.
 +
 
 +
当你认为路径正确时, 尝试编译你的应用程序. 如果得到路径错误 ('can't find unit .......'不能发现单元文件) 那么执行后退(go back) 并且检查你的路径, both in /etc/fpc.cfg and in your Run(运行) -> Compiler Options dialog (编译选项对话窗口)(or Project(项目) -> Compiler Options depending on your version).
  
When you think you have got your paths right, try to compile your application. If there are further path-related errors ('can't find unit .......') then go back and check your paths, both in /etc/fpc.cfg and in your Run -> Compiler Options dialog (or Project -> Compiler Options depending on your version).
+
一担你设定的环境和路径正确, 它需要保存设置到一个文件, otherwise(否则) you will have to go through this process for each new project.  
 +
  In the Run -> Compiler options dialog there is a Load/Save button;
 +
译者注:由于我使用的是lazarus v0.9.24 所以我发现compiler options在Project菜单里,不是在Run菜单里。
 +
select this and then save the setings to the filename of your choice: mine is ~/FreePascal/default.cfg. Then each time I start a new project, I can go to the Run -> Compiler Options dialog (or Project -> Compiler Options), select Load/Save, and load my default.cfg file to the new project. You can, of course, modify the options for each new project if you so desire.
  
Once you have got the environment and PATHS correct, it is worth saving the settings to a file, otherwise you will have to go through this process for each new project. In the Run -> Compiler options dialog there is a Load/Save button; select this and then save the setings to the filename of your choice: mine is ~/FreePascal/default.cfg. Then each time I start a new project, I can go to the Run -> Compiler Options dialog (or Project -> Compiler Options), select Load/Save, and load my default.cfg file to the new project. You can, of course, modify the options for each new project if you so desire.
+
译者注(添加):如果您使用的是ubuntu 8.10 并且您是使用新立得获取的lazarus和free pascal 在使用lazarus时,(Environment环境设置)fpc的路径应该是:
 +
  /usr/share/fpcsrc/2.2.0/
  
== Original contributors and changes ==
+
== 最初的贡献者和变化 ==
 
This page has been converted from the epikwiki [http://lazarus-ccr.sourceforge.net/index.php?wiki=InstallingLazarus version].
 
This page has been converted from the epikwiki [http://lazarus-ccr.sourceforge.net/index.php?wiki=InstallingLazarus version].
 
* Initially imported and formatted. [[User:Tom | VlxAdmin]] 9/22/2003
 
* Initially imported and formatted. [[User:Tom | VlxAdmin]] 9/22/2003
Line 708: Line 399:
 
* Considerable re-write and re-organization of installation section - 11 Dec 2004 [[User:Kirkpatc]]
 
* Considerable re-write and re-organization of installation section - 11 Dec 2004 [[User:Kirkpatc]]
 
* Fixed broken link - 9 Oct 2005 [[User:Avantman42]]
 
* Fixed broken link - 9 Oct 2005 [[User:Avantman42]]
 +
 +
 +
{{AutoCategory}}
 +
[[Category:FPC/zh_CN]]
 +
[[Category:Lazarus/zh_CN]]
 +
[[Category:Install/zh_CN]]

Latest revision as of 12:35, 16 February 2020

Deutsch (de) English (en) español (es) suomi (fi) français (fr) magyar (hu) 日本語 (ja) 한국어 (ko) polski (pl) português (pt) русский (ru) slovenčina (sk) Tiếng Việt (vi) 中文(中国大陆)‎ (zh_CN)

概述

那些只想装上 Lazarus,然后就开始编程的人,最简单的方式就是下载,安装一个最新的,合适的,稳定的,二进制发行版(比如 Linux 的“.rpm”包,Windows 的“.exe”安装程序,或者 Mac OS X 的“.dmg”包)。你可以读一读 Linux 或 Windows 标题下面的“fpc 二进制文件”小节,或者是看看 在 Windows 或 Linux 里安装 Lazarus 里的第一段:剩下的大部分信息都可以不予理睬。

对于想要参与编译器或者 IDE 开发的人,或者需要最新工具的人,就需要通过源代码来安装,那么这里的所有信息都是有用的。

Lazarus 提供了两个主要部分:

  • LCL —— Lazarus Component Library(Lazarus 组件库)
  • IDE —— RAD 工具

以上部分分别相关于:

  • FPC —— Free Pascal 编译器
  • FCL —— Free Pascal Component Library(Free Pascal 组件库),含有大部分 Lazarus 所需的非图形化组件

Lazarus 系统需求

  1. FreePascal 编译器,包,还有源代码。(*注意*:所有文件必须是相同版本或日期)
  2. 得到支持的 widget 工具集
    Win32
    将使用本地 Win32 API
    Linux/xxxBSD
    GTK+ 1.2.x : 大部分 Linux 分发版和 *BSDs 已经安装了 GTK+ 1.2.x 库。你能在 http://www.gtk.org 找到。
    你也需要 gdk-pixbuf, 0.13 或更高版(最好是0.18或更高版),你能找到两年来最新的分发版。源代码在这里 ftp://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/
    Mac OS X
    GTK+ 1.2.x : 你需要苹果开发工具,X11,还有 GTK1.2。请看下面的 Mac OS X 安装部分。
    GTK+ 2.x
    警告:GTK2 界面还没有完成,只是用于测试。
    你能在最新分发版里找到。源代码在 http://www.gtk.org。

FAQ —— Frequently Asked Questions(常见问题解答)请见 http://www.lazarus.freepascal.org ,有些问题能够在本地‘FAQ’中找到。

以下部分,描述了怎样得到 Free Pascal 以及怎样正确安装 Lazarus。

安装 Free Pascal 编译器

下面的网址更多地讨论了如何安装和构建 Free Pascal 编译器 http://www.stack.nl/~marcov/buildfaq.pdf - 对某些用户来说,可能有些过于详细了,但是这里是非常全面的。

Lazarus 需要 fpc (FreePascal) 版本 2.2.0 或更高的版本,还需要相同版本的已编译 fpc 库(二进制文件)和fpc 源代码。


在 Linux 下安装 Free Pascal

FPC 二进制文件

最新的 FreePascal 发布版本是 2.2.0, 可以从 FreePascal 的网站获得(http://www.freepascal.org/download.html, 然后选择一个镜像) 也可以从 sourceforge 获得(http://sourceforge.net/projects/lazarus)。

在下载 Lazarus 的地方(http://www.lazarus.freepascal.org )你可以得到 Free Pascal 编译器的 RPM 包。如果你不能使用 RPM 包进行安装,你可以从 http://www.freepascal.org 下载 Tar 压缩包。如果你想自己编译成执行程序(二进制文件),请参考 BSD 部分。

指导:

警告:如果你不使用 RPM(即便你是一个准备使用 RPM 的外行),最好取得最新的稳定版 FPC(目前是2.2.0),然后通过源代码安装 Lazarus。

启动 linux,然后以 ROOT 登陆。

http://sourceforge.net/project/showfiles.php?group_id=89339 下载最新的文件。 比如:

  • fpc-2.0.4-0.i586.rpm
  • fpcsrc-2.0.4-0.i386.rpm
  • lazarus-0.9.22-0.i386.rpm

然后安装它们:

  • rpm -Uvh fpc-2.0.4-0.i586.rpm
  • rpm -Uvh fpcsrc-2.0.4-0.i386.rpm
  • rpm -Uvh lazarus-0.9.22-0.i386.rpm

Debian 用户可能要求助于其它方法(警告,这不会生成 fpc.cfg)或者使用 tar 包进行安装。

FPC 源代码

从 2.0 发布版开始,FPC 融合进了 Subversion (SVN)。现在还没有 CVS 镜像,所以你必须使用 SVN 才能得到 FPC 的源代码。

(译注:下略,请参见英文) For more information, see the FreePascal website

在 Windows 下安装Free Pascal

FPC 二进制的Windows版

By far the easiest way to get a working installation of Free Pascal is to download the current binary Windows release of Lazarus from the SourceForge repository - the release contains the current versions of the FreePascal compiler and the FreePascal libraries as well as the lazarus IDE. If you want to install from sources, read on!

You can get the installer zip for fpc 2.2.0 at Free Pascal's download section http://www.freepascal.org/download.html, then choose a mirror). Installing from the sources -- see the next section to know how to get them -- is not for novices, since you need a starting compiler as well.

FPC windows版的源代码

<<<< See section above under FPC Sources for Linux, where the use of SVN is described >>>>

(略,请参见英文页面)

安装 FreeBSD/auto版的Free Pascal

Latest FreeBSD ports collection has 2.2.0 stable version in ports/lang/fpc. But they are scattered over 57 (!) packages and do not install the sources, so it is almost always better to install manually (see below). Nevertheless here is how to install the port.

This can be done as root. 下面这些能被root完成

[]# cd /usr/ports/lang/fpc && make install && make clean

Other possibility is to use portinstall.

[]# portinstall fpc

Once fpc is installed you can check if it's working by simply running

[]$ fpc

安装BSD/manually版本的 Free Pascal

Effectively, you need

A file with all sources, or two (fpc and lazarus)

1. e.g. for fpc ftp://ftp.freepascal.org/fpc/dist/Linux/separate/sources.tar preferably an export (no CVS/ dirs). The above file misses this. 2. Lazarus source 快照

  • _any_ starting compiler from the 2.2.0 branch) You can do a check by parsing the output of ppc386 -i if it is 2.2.0 .. 2.3.x it is ok.
  • - dependant packages. (for FreeBSD that is gtk12, glib12 and gdk_pixbuf and GNU make, iconv and gettext)

FPC build:

1. (fetch) necessary files (FPC source, starting compiler) 2. (extract) Then de-tgz in work directory, 3. (build) enter work/fpc/ and run

 $MAKE all OPT='-gl'  PP=/path/to/startingcompiler-name-ppc386
(/path/to/ can be omitted when ppc386 is in the path)
($MAKE is make on linux and gmake on BSD)

4. (install) then, again in work/fpc, run

$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX
(THEPREFIX= usually is /usr/lcoal, but e.g. on NetBSD it is /usr/pkg for ports)
Create a symlink:
  ln -s $THEPREFIX/lib/fpc/2.2.0/ppc386 $THEPREFIX/bin/ppc386
     install sourceinstall PREFIX=$THEPREFIX

5. (configure) run compiler/utils/samplecfg $THEPREFIX/lib/fpc/2.2.0 $ETCDIR 6. (optional, test), see if ppc386 -i gives output, else give a warning that user need to add $PREFIX/bin to his current path. Try to compiler a program with -viwn, and see if that gives errors. Notes:

  • If you need fpcmake package lists, you need to generate or supply them yourself, (in the port, or in an extra archive) either way, do a dummy install to /tmp/pack and determine the files installed with find . >ll
  • $THEPREFIX and $ETCDIR should be user configurable. Otherwise local installs aren't possible.
  • BSDHIER=1 on all make commands forces BSD hierarchy conventions.

Installing Free Pascal under macOS

You also need the Apple Developer tools, X11, and GTK 1.2:

Developer-tools: Are included on the original operating system installation CDs, or download at ADC (free registration required):

http://developer.apple.com/.

Apple X11: On a new system: choose "Customize" in the install dialog, check "X11".

On an already installed system:

macOS 10.3: download at:

http://www.apple.com/downloads/macosx/apple/x11formacosx.html

macOS 10.4: install X11 from the DVD.

GTK 1.2: Downloading the GTK packages and installing them properly can be a time consuming task. Therefore there are various package managers. One of them is fink:

Download fink from http://fink.sourceforge.net/download/index.php?phpLang=en; follow the install instructions.

In the Terminal, run

       sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines

The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click.

Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under macOS this is deactivated. You can activate it for all X11 applications by typing in the terminal:

       defaults write com.apple.x11 wm_click_through -bool true
Free Pascal Compiler

Then download and install the Free Pascal Compiler (at least 2.2.0) from:

https://sourceforge.net/project/showfiles.php?group_id=89339

When compiling GTK-related software, you need to add two lines to the fpc.cfg file, to enable use of libraries:

-Fl/sw/lib
-Fl/usr/X11R6/lib

For Lazarus you need the FPC sources as well:

  • Install SVN for macOS: A good package is provided by Martin Ott.

Create a directory, where you would like to put the sources. You don't need to be root to do this. Any normal user can do this. First create a directory for fpc

(e.g. /Users/username/freepascal)

then open a terminal and do the following:

[]$ svn co http://svn.freepascal.org/svn/fpc/trunk fpc

This will create a directories called 'fpc', which can be later used in the IDE. Hint: To download/update the latest changes you can simply do

[]$ cd /Users/username/freepascal/fpc
[]$ svn up

安装 Lazarus

在Linux下安装 Lazarus

Ubuntu / Debian

The easiest way to get a current working installation of Lazarus is to download the .deb files for FreePascal and Lazarus from the SourceForge repository.

Experimental: How to setup a FPC and Lazarus Ubuntu repository

轻松建立 debs

The easiest way to get a current working installation of Lazarus is to download build your own .deb packages by following the instructions at:

How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository

用rpms安装

The next easiest way is to the RPMs for FreePascal and Lazarus from the SourceForge repository.

You need to download the selected version of

  • the compiler (eg fpc-2.2.0-0.i386.rpm)
  • the pascal source library (eg fpc-src-2.2.0-0.i386.rpm)
  • the Lazarus package (eg lazarus-0.9.24-0.i386.rpm).

Here is an example of a script to install or update to ver.0.9.24 from a mirror, nchc. Save it as something like "InstallLazarus.sh", give it execute permission, and run after getting root privileges using su. Don't mind if you get "not installed" message.

 #!/bin/sh
 URL=http://nchc.dl.sourceforge.net/sourceforge/lazarus
 wget $URL/fpc-2.2.0-0.i386.rpm
 wget $URL/fpc-src-2.2.0-0.i386.rpm
 wget $URL/lazarus-0.9.24-0.i386.rpm
 rpm -ev lazarus
 rpm -ev fpc
 rpm -ev fpc-src
 rpm -ivh fpc-*
 rpm -ivh lazarus-*

在 Mandriva 上安装

(译注:略,参见英文页面)

在 Suse 上安装

Installing Lazarus 0.9.18. For Suse 10.1 users

(译注:略,参见英文页面)

从源代码安装

If you prefer to install from source and compile the files yourself, follow these instructions. Because the whole lazarus stuff is installed into one directory, uninstall is very easy and you don't need to be root to install lazarus. You can get tgz files for fpc, fpcsrc and lazarus from the downloads section or you can download it directly via svn.

(译注:略,参见英文页面)

在 Debian GNU/Linux下安装 Lazarus

There are preliminary Debian packages for lazarus available for download. They are not the latest versions, however. Make sure you read /usr/share/doc/lazarus/README.Debian carefully before you start using it. Feedback is needed and appreciated; please send your comments to Carlos Laviola <claviola@debian.org>.

Note that for a fully working Lazarus install, no older or incompatible versions of, for example, the fpc source or fpc compiler must be installed. Remove them by typing

 dpkg -r <package name>   

without .deb extension. And then install the newest versions as described.

Another way to install Lazarus under Debian

Added by User:Kirkpatc. (译注:略,参见英文页面)

在Windows下安装Lazarus

当前版本的视窗版Lazarus二进制包的安装非常轻松,它‘打开盒子就能用’(out-of-the-box)。

安装Lazarus到优盘

甚至能把整个Lazarus/FPC包安装到一个便携式USB驱动器(优盘,容量至少256MB),针对某些环境,比如你不允许安装软件的视窗工作站,或者你没有获得超级管理员权限。你必须注意,调整编译路径、环境选项,还有 fpc.cfg文件。也许,必须要保持编译测试的文件夹位置,在你的U盘。

<< 问:有谁知道,怎样设置‘相对路径’在这些标签和文件中,以保证寻址工作正常,当你移动U盘到另一台电脑会遇到一个不同的盘符的?

答: 我就是这么做的。关联很复杂,但这是我发现的最佳方案(译注:确实很复杂,谁看明白了接着翻译吧。请参见《Lazarus中文版免重装的方法》)。 I have a "bin" directory on my USB drive, where I have several scripts and utilities installed. Inside that directory is a batch file called "setenv.bat" which sets an environment variable called THUMBDRIVE. It is set by using this command in the batch file:

  set THUMBDRIVE=%CD:~0,2%

This is used in setenv.bat to set some paths to other things I have installed on the USB drive. I also have a link in the root directory of the thumb drive with this property:

 %SystemRoot%\system32\cmd.exe /k bin\setenv

so that when I click on that link when the thumb drive folder is diplayed after inserting it, it will open a command prompt at the thumb drive with the environment variables set from setenv.bat.

Also inside the bin directory is sed (the actual binary is one I obtained from the mingw distribution). So I created another batch file called fixlaz.bat which takes one argument, the drive letter which is currently in the Lazarus/fpc settings files that you want to change (note that this is the previous drive letter the last time you ran fixlaz.bat, not the current one of your USB drive which fixlaz.bat already knows). You will need to create this batch file to fit where you installed Lazarus in the root directory structure of the drive if you didn't install it directly in the root folder, and then repeat these lines also for the editoroptions.xml and fpc.cfg files (fpc.cfg is the the fpc bin directory, which might be buried deep in the lazarus folder):

 copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
 sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml

So to use it, I would type at the command prompt of the USB drive:

 fixlaz G:

if "G:" was the previous drive letter used the last time I ran it. This will then scan the file(s) and replace "G:" with the current drive letter of the USB drive, which is in the %THUMBDRIVE% environment variable (after running setenv.bat). Note that you could write it to save the current drive letter in a separate file, so that you wouldn't have to remember it yourself the next time. But this works well enough for me right now. >>

The binary package is available for Linux and Windows from

http://sourceforge.net/project/showfiles.php?group_id=89339

Download the latest release (currently Lazarus-0.9.15-20060415-win32.exe) and launch the application. You will be taken through a typical Windows installation, in which the FPC compiler and source libraries are installed within the same directory structure as Lazarus, and the IDE should launch and operate without significant problems, provided you have uninstalled(!!!) any previous version of Lazarus and/or FPC (often found in the C:\pp directory).

You can also use a Lazarus Snapshot. For download locations see Lazarus Snapshots Downloads.

小提示:

这也许是个好主意:在安装Lazarus之后重启你的Windows,然后再去安装额外的Lazarus组件,比如zeoslib。

从源代码安装

If you prefer to install from sources, then follow these instructions (Thanks to Joe for the initial Step-by-step description) (译注:略,参见英文页面)

在FreeBSD下安装 Lazarus

FreeBSD 5+

The latest version of Lazarus into FreeBSD port tree is 0.9.22. We can to install lazarus using FreeBSD ports.

[]# cd /usr/ports/editors/lazarus && make install clean clean-depends

If you get the messages about missing source files, go to [menu bar >> 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

Good luck, that worked for me. --Jrmarino 21:29, 4 Jan 2006 (CET)

Installing Lazarus under PC-BSD 1.0rc1+

You can install Lazarus on PB-BSD by simply downloading the Lazarus PBI from PBI Dir

Note that you must install glib* port from /usr/port/devel/glib* or glib packages by pkg_add -r glib12 glib20. I will fix this in new PBI releases.

[other OpenBSD/NetBSD/DragonFlyBSD goes here]

在Mac OS X下安装 Lazarus

Works pretty much the same as under Linux. But you first need to install the Apple developer tools, X11, and GTK 1.2.

Easy-to-install snapshots are also from the snaphot servers.

If you install all 3 .dmg snapshot files, this also installs the FPC compiler and the FPC and Lazarus source too. If you only need to run Lazarus to develop and compile your own apps, you don't need to install the FPC and Lazarus sources as described above. If you need to rebuild Lazarus or want to help with its development, then you should to install the Lazarus source to a folder where you have read-write permission, as described above.

If you want to experiment and develop the Carbon widgetset interface, look at Carbon Interface.

There are at least two ways to start Lazarus under OS X:

Start X11. In the terminal window, type:

cd /usr/local/share/lazarus
./lazarus

You can also run Lazarus from the X11 menu. Choose Applications | Customize, click Add Item, then under Name enter Lazarus and under Command enter:

open -a /usr/local/share/lazarus/lazarus

Click Done. Now you can start Lazarus by choosing Applications | Lazarus.

关于安装FPC和Lazarus附加的经验和劝告

On linux, getting Lazarus to work can be complicated if you have an older version installed. If you have already installed earlier versions of FPC and/or Lazarus, you have to take great care that the PATHS are adjusted so that only your new versions are called.

Pitfalls that I have experienced in various attempts with SuSE linux include:

The rpm versions often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib. rpm版本经常把FPC安装在/bin或者/usr/bin里面,那些类库被装在/lin或者/lib里。

If you perform a make install on a source version or use a .tar.gz, the compiler is usually installed in /usr/local/bin with the libraries in /usr/local/lib.如果你执行一个安装版本或者使用一个.tar.gz,这个编译程序通常被安装在/usr/local/bin里,类库会被安装在/usr/local/lib里。

So if earlier versions have been installed from rpm, make sure all links are changed to reflect the directory structure of your new compiler. The place to make the changes is in /etc/fpc.cfg ; make sure there are no remnant configuration files in your home directory or in your FPC download directory. Typically they are found in ~/.fpc.cfg

Make sure the links in /etc/fpc.cfg point to the correct versions of the libraries (particularly if you have older versions still lurking around).

In /usr/local/bin or /usr/bin there is a file called fpc ; this is the executable that is called when you invoke the compiler. One of the first things it does is to open ppc386 in the same directory. This has to be the same version as the fpc file, or can be a link pointing to the true ppc386 in some other directory (such as a library directory, or the fpc directory in your own development space); be sure to update your link if you install a newer version of the compiler.

Try running the compiler from the command line using one of the simple example programs or one which you wrote yourself.尝试使用命令行运行编译程序,编译一个简单的例子程序或者是你自己以前写的些代码。

Turning to Lazarus:

If you use a downloaded snapshot (.tar.gz) or get the source from CVS, enter your lazarus directory and type

make
./lazarus 

and hopefully the IDE should load. There may be a message saying it can't find the sources; if so, go to the menu at the top and select Environment -> Environment options and insert the name of the directory where you expect to find your lazarus files (eg ~/FreePascal/lazarus), your compiler (e.g. /usr/local/bin/ppc386), the FreePascal source directory (e.g. /usr/local/lib/fpc/$version/fpc or a directory in your own space e.g. ~/FreePascal/fpc). Then close the dialog and start programming.

You may find further problems when you start programming or compiling; most of these will be related to PATH selection.

Many of the difficulties are dealt with in the Lazarus FAQ, found either on this WiKi site, or a more complete list on the main Lazarus site。有一些困难已经被发现,你可能通过Lazarus的FAQ解决困难,或者其它完整的列表在Lazaru的主站点。有困难就先到下面的地址查查。

http://www.lazarus.freepascal.org/modules.php?op=modload&name=FAQ&file=index

From the top menu select Run(在顶层菜单选择运行Run) -> Compiler Options(编译选项) (or Project(或者选择项目) -> Compiler Options in more recent releases of Lazarus) and select the Paths tab on the resulting dialog并且设置对话结果的路径. 那是几个输入框是设置路径的输入项 有单元文件的路径, Include(包括)文件的路径,其它资源文件的路径, 类库路径等等。 For each of these, it is worth pressing the ... (ellipsis) button on the right, and you will be given a blank window for inserting path information, and a lower window giving some suggestions. Select as many as you like (or ALL!) and press the ADD button to transfer the selections to the upper window. When your selection is complete, press OK and move on to the next box. If you know of other paths which need to be followed, press the Browse button associated with each box, and insert the additional paths.

当你认为路径正确时, 尝试编译你的应用程序. 如果得到路径错误 ('can't find unit .......'不能发现单元文件) 那么执行后退(go back) 并且检查你的路径, both in /etc/fpc.cfg and in your Run(运行) -> Compiler Options dialog (编译选项对话窗口)(or Project(项目) -> Compiler Options depending on your version).

一担你设定的环境和路径正确, 它需要保存设置到一个文件, otherwise(否则) you will have to go through this process for each new project.

 In the Run -> Compiler options dialog there is a Load/Save button; 

译者注:由于我使用的是lazarus v0.9.24 所以我发现compiler options在Project菜单里,不是在Run菜单里。 select this and then save the setings to the filename of your choice: mine is ~/FreePascal/default.cfg. Then each time I start a new project, I can go to the Run -> Compiler Options dialog (or Project -> Compiler Options), select Load/Save, and load my default.cfg file to the new project. You can, of course, modify the options for each new project if you so desire.

译者注(添加):如果您使用的是ubuntu 8.10 并且您是使用新立得获取的lazarus和free pascal 在使用lazarus时,(Environment环境设置)fpc的路径应该是:

  /usr/share/fpcsrc/2.2.0/

最初的贡献者和变化

This page has been converted from the epikwiki version.

  • Initially imported and formatted. VlxAdmin 9/22/2003
  • Changed Joe's part for Windows to require fpc 1.0.10. Vincent 9/25/2003
  • Updated "What is required for lazarus". AndrewJohnson 10/1/2003
  • Finished formatted the InstallingLazarus page VlxAdmin 2/22/2004
  • Posted some notes about Installing FPC and Lazarus: mostly reflecting experiences in trying to get the PATHS right in Linux. 3/11/2004 User:Kirkpatc
  • Copied the contents of my note into the main InstallingLazarus section, edited it slightly. I don't know how to remove the original note. 3/12/2004 User:Kirkpatc
  • Removed the original note. Tidied the wiki and formatting a bit. VlxAdmin
  • Corrected a couple of typos - 3/12/2004 User:Kirkpatc
  • Added link for daily snapshot deb packages - 3/27/2004 Vincent
  • Fixed links in GettingLazarus (downloading binaries) and several other pages. 22 July 2004 User:Kirkpatc
  • Added link for lazarus deb packages - 19 August 2004 VincentSnijders
  • Added a short note on installing in Debian - 23 Nov 2004 User:Kirkpatc
  • Considerable re-write and re-organization of installation section - 11 Dec 2004 User:Kirkpatc
  • Fixed broken link - 9 Oct 2005 User:Avantman42