Sign in Join
Wiki copytemporary

Installing Lazarus/zh CN: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## 概述
22
33那些只想装上 Lazarus,然后就开始编程的人,最简单的方式就是下载,安装一个最新的,合适的,稳定的,二进制发行版(比如 Linux 的“.rpm”包,Windows 的“.exe”安装程序,或者 Mac OS X 的“.dmg”包)。你可以读一读 Linux 或 Windows 标题下面的“fpc 二进制文件”小节,或者是看看 在 Windows 或 Linux 里安装 Lazarus 里的第一段:剩下的大部分信息都可以不予理睬。
44
55对于想要参与编译器或者 IDE 开发的人,或者需要最新工具的人,就需要通过源代码来安装,那么这里的所有信息都是有用的。
66
77Lazarus 提供了两个主要部分:
88
99- LCL —— Lazarus Component Library(Lazarus 组件库)
1010- IDE —— RAD 工具
1111
1212以上部分分别相关于:
1313
1414- FPC —— Free Pascal 编译器
1515- FCL —— Free Pascal Component Library(Free Pascal 组件库),含有大部分 Lazarus 所需的非图形化组件
1616
1717### Lazarus 系统需求
1818
19191. FreePascal 编译器,包,还有源代码。(*注意*:所有文件必须是相同版本或日期)
20202. 得到支持的 widget 工具集
2121 :;Win32: 将使用本地 Win32 API
2222
2323 :;Linux/xxxBSD: GTK+ 1.2.x : 大部分 Linux 分发版和 *BSDs 已经安装了 GTK+ 1.2.x 库。你能在 <http://www.gtk.org> 找到。\
2424 你也需要 gdk-pixbuf, 0.13 或更高版(最好是0.18或更高版),你能找到两年来最新的分发版。源代码在这里 <ftp://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/>
2525
2626 :;Mac OS X: GTK+ 1.2.x : 你需要苹果开发工具,X11,还有 GTK1.2。请看下面的 Mac OS X 安装部分。
2727
2828 :;GTK+ 2.x: 警告:GTK2 界面还没有完成,只是用于测试。\
2929 你能在最新分发版里找到。源代码在 <http://www.gtk.org>。
3030
3131FAQ —— Frequently Asked Questions(常见问题解答)请见 <http://www.lazarus.freepascal.org> ,有些问题能够在本地‘FAQ’中找到。
3232
3333以下部分,描述了怎样得到 Free Pascal 以及怎样正确安装 Lazarus。
3434
3535## 安装 Free Pascal 编译器
3636
3737下面的网址更多地讨论了如何安装和构建 Free Pascal 编译器 <http://www.stack.nl/~marcov/buildfaq.pdf> - 对某些用户来说,可能有些过于详细了,但是这里是非常全面的。
3838
3939Lazarus 需要 fpc (FreePascal) 版本 2.2.0 或更高的版本,还需要相同版本的已编译 fpc 库(二进制文件)和fpc 源代码。
4040
4141### 在 Linux 下安装 Free Pascal
4242
4343#### FPC 二进制文件
4444
4545最新的 FreePascal 发布版本是 2.2.0, 可以从 FreePascal 的网站获得(http://www.freepascal.org/download.html, 然后选择一个镜像) 也可以从 sourceforge 获得(http://sourceforge.net/projects/lazarus)。
4646
4747在下载 Lazarus 的地方(http://www.lazarus.freepascal.org )你可以得到 Free Pascal 编译器的 RPM 包。如果你不能使用 RPM 包进行安装,你可以从 <http://www.freepascal.org> 下载 Tar 压缩包。如果你想自己编译成执行程序(二进制文件),请参考 BSD 部分。
4848
4949指导:
5050
5151警告:如果你不使用 RPM(即便你是一个准备使用 RPM 的外行),最好取得最新的稳定版 FPC(目前是2.2.0),然后通过源代码安装 Lazarus。\
5252启动 linux,然后以 ROOT 登陆。\
5353从 <http://sourceforge.net/project/showfiles.php?group_id=89339> 下载最新的文件。 比如:
5454
5555:* fpc-2.0.4-0.i586.rpm
5656
5757:* fpcsrc-2.0.4-0.i386.rpm
5858
5959:* lazarus-0.9.22-0.i386.rpm\
6060然后安装它们:
6161
6262:* rpm -Uvh fpc-2.0.4-0.i586.rpm
6363
6464:* rpm -Uvh fpcsrc-2.0.4-0.i386.rpm
6565
6666:* rpm -Uvh lazarus-0.9.22-0.i386.rpm\
6767Debian 用户可能要求助于其它方法(警告,这不会生成 fpc.cfg)或者使用 tar 包进行安装。
6868
6969#### FPC 源代码
7070
7171从 2.0 发布版开始,FPC 融合进了 Subversion (SVN)。现在还没有 CVS 镜像,所以你必须使用 SVN 才能得到 FPC 的源代码。
7272
7373(译注:下略,请参见英文) For more information, see the [FreePascal](http://www.freepascal.org/develop.html) website
7474
7575### 在 Windows 下安装Free Pascal
7676
7777#### FPC 二进制的Windows版
7878
7979By 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!
8080
8181You 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.
8282
8383#### FPC windows版的源代码
8484
8585\<\<\<\< See section above under FPC Sources for Linux, where the use of SVN is described \>\>\>\>
8686
8787(略,请参见英文页面)
8888
8989### 安装 FreeBSD/auto版的Free Pascal
9090
9191Latest 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.
9292
9393This can be done as root. 下面这些能被root完成
9494
95-`[]# cd /usr/ports/lang/fpc && make install && make clean`
95+```text
96+[]# cd /usr/ports/lang/fpc && make install && make clean
97+```
9698
9799Other possibility is to use portinstall.
98100
99-`[]# portinstall fpc`
101+```text
102+[]# portinstall fpc
103+```
100104
101105Once fpc is installed you can check if it's working by simply running
102106
103-`[]$ fpc`
107+```text
108+[]$ fpc
109+```
104110
105111### 安装BSD/manually版本的 Free Pascal
106112
107113Effectively, you need
108114
109115A file with all sources, or two (fpc and lazarus)
110116
1111171\. 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 快照
112118
113119- _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.
114120- \- dependant packages. (for FreeBSD that is gtk12, glib12 and gdk_pixbuf and GNU make, iconv and gettext)
115121
116122FPC build:
117123
1181241\. (fetch) necessary files (FPC source, starting compiler) 2. (extract) Then de-tgz in work directory, 3. (build) enter work/fpc/ and run
119125
120-` $MAKE all OPT='-gl'  PP=/path/to/startingcompiler-name-ppc386`\
121-`(/path/to/ can be omitted when ppc386 is in the path)`\
122-`($MAKE is make on linux and gmake on BSD)`
126+```text
127+ $MAKE all OPT='-gl' PP=/path/to/startingcompiler-name-ppc386
128+(/path/to/ can be omitted when ppc386 is in the path)
129+($MAKE is make on linux and gmake on BSD)
130+```
123131
1241324\. (install) then, again in work/fpc, run
125133
126-`$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX`\
127-`(THEPREFIX= usually is /usr/lcoal, but e.g. on NetBSD it is /usr/pkg for ports)`\
128-`Create a symlink:`\
129-`  ln -s $THEPREFIX/lib/fpc/2.2.0/ppc386 $THEPREFIX/bin/ppc386`\
130-`     install sourceinstall PREFIX=$THEPREFIX`
134+```text
135+$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX
136+(THEPREFIX= usually is /usr/lcoal, but e.g. on NetBSD it is /usr/pkg for ports)
137+Create a symlink:
138+ ln -s $THEPREFIX/lib/fpc/2.2.0/ppc386 $THEPREFIX/bin/ppc386
139+ install sourceinstall PREFIX=$THEPREFIX
140+```
131141
1321425\. (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:
133143
134144- 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
135145
136146- \$THEPREFIX and \$ETCDIR should be user configurable. Otherwise local installs aren't possible.
137147
138148- BSDHIER=1 on all make commands forces BSD hierarchy conventions.
139149
140150### Installing Free Pascal under macOS
141151
142152You also need the Apple Developer tools, X11, and GTK 1.2:
143153
144154Developer-tools: Are included on the original operating system installation CDs, or download at ADC (free registration required):
145155
146156
147157<http://developer.apple.com/>.
148158
149159Apple X11: On a new system: choose "Customize" in the install dialog, check "X11".
150160
151161On an already installed system:
152162
153163macOS 10.3: download at:
154164
155165
156166<http://www.apple.com/downloads/macosx/apple/x11formacosx.html>
157167
158168macOS 10.4: install X11 from the DVD.
159169
160170GTK 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:
161171
162172
163173Download fink from <http://fink.sourceforge.net/download/index.php?phpLang=en>; follow the install instructions.
164174
165175In the Terminal, run
166176
167-`       sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines`
177+```text
178+ sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines
179+```
168180
169181The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click.
170182
171183Tip: 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:
172184
173-`       defaults write com.apple.x11 wm_click_through -bool true`
185+```text
186+ defaults write com.apple.x11 wm_click_through -bool true
187+```
174188
175189Free Pascal Compiler
176190
177191Then download and install the Free Pascal Compiler (at least 2.2.0) from:
178192
179193
180194<https://sourceforge.net/project/showfiles.php?group_id=89339>
181195
182196When compiling GTK-related software, you need to add two lines to the fpc.cfg file, to enable use of libraries:
183197
184-`-Fl/sw/lib`\
185-`-Fl/usr/X11R6/lib`
198+```text
199+-Fl/sw/lib
200+-Fl/usr/X11R6/lib
201+```
186202
187203For Lazarus you need the FPC sources as well:
188204
189205- Install SVN for macOS: A good package is provided by [Martin Ott](http://www.codingmonkeys.de/mbo/).
190206
191207Create 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
192208
193209
194210(e.g. /Users/username/freepascal)
195211
196212then open a terminal and do the following:
197213
198-`[]$ svn co `[`http://svn.freepascal.org/svn/fpc/trunk`](http://svn.freepascal.org/svn/fpc/trunk)` fpc`
214+```text
215+[]$ svn co http://svn.freepascal.org/svn/fpc/trunk fpc
216+```
199217
200218This 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
201219
202-`[]$ cd /Users/username/freepascal/fpc`\
203-`[]$ svn up`
220+```text
221+[]$ cd /Users/username/freepascal/fpc
222+[]$ svn up
223+```
204224
205225## 安装 Lazarus
206226
207227### 在Linux下安装 Lazarus
208228
209229#### Ubuntu / Debian
210230
211231The easiest way to get a current working installation of Lazarus is to download the .deb files for FreePascal and Lazarus from the SourceForge repository.
212232
213233Experimental: [[How to setup a FPC and Lazarus Ubuntu repository]]
214234
215235#### 轻松建立 debs
216236
217237The easiest way to get a current working installation of Lazarus is to download build your own .deb packages by following the instructions at:
218238
219239[[How to setup a FPC and Lazarus Ubuntu repository]]
220240
221241#### 用rpms安装
222242
223243The next easiest way is to the RPMs for FreePascal and Lazarus from the SourceForge repository.
224244
225245You need to download the selected version of
226246
227247- the compiler (eg fpc-2.2.0-0.i386.rpm)
228248- the pascal source library (eg fpc-src-2.2.0-0.i386.rpm)
229249- the Lazarus package (eg lazarus-0.9.24-0.i386.rpm).
230250
231251Here 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.
232252
233-` #!/bin/sh`\
234-` URL=`[`http://nchc.dl.sourceforge.net/sourceforge/lazarus`](http://nchc.dl.sourceforge.net/sourceforge/lazarus)\
235-` wget $URL/fpc-2.2.0-0.i386.rpm`\
236-` wget $URL/fpc-src-2.2.0-0.i386.rpm`\
237-` wget $URL/lazarus-0.9.24-0.i386.rpm`\
238-` rpm -ev lazarus`\
239-` rpm -ev fpc`\
240-` rpm -ev fpc-src`\
241-` rpm -ivh fpc-*`\
242-` rpm -ivh lazarus-*`
253+```text
254+ #!/bin/sh
255+ URL=http://nchc.dl.sourceforge.net/sourceforge/lazarus
256+ wget $URL/fpc-2.2.0-0.i386.rpm
257+ wget $URL/fpc-src-2.2.0-0.i386.rpm
258+ wget $URL/lazarus-0.9.24-0.i386.rpm
259+ rpm -ev lazarus
260+ rpm -ev fpc
261+ rpm -ev fpc-src
262+ rpm -ivh fpc-*
263+ rpm -ivh lazarus-*
264+```
243265
244266#### 在 Mandriva 上安装
245267
246268(译注:略,参见英文页面)
247269
248270#### 在 Suse 上安装
249271
250272##### Installing Lazarus 0.9.18. For Suse 10.1 users
251273
252274(译注:略,参见英文页面)
253275
254276#### 从源代码安装
255277
256278If 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.
257279
258280(译注:略,参见英文页面)
259281
260282#### 在 Debian GNU/Linux下安装 Lazarus
261283
262284There 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\>.
263285
264286Note 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
265287
266-` dpkg -r <package name>   `
288+```text
289+ dpkg -r <package name>
290+```
267291
268292without .deb extension. And then install the newest versions as described.
269293
270294#### Another way to install Lazarus under Debian
271295
272296Added by User:Kirkpatc. (译注:略,参见英文页面)
273297
274298### 在Windows下安装Lazarus
275299
276300当前版本的视窗版Lazarus二进制包的安装非常轻松,它‘打开盒子就能用’(out-of-the-box)。
277301
278302#### 安装Lazarus到优盘
279303
280304甚至能把整个Lazarus/FPC包安装到一个便携式USB驱动器(优盘,容量至少256MB),针对某些环境,比如你不允许安装软件的视窗工作站,或者你没有获得超级管理员权限。你必须注意,调整编译路径、环境选项,还有 fpc.cfg文件。也许,必须要保持编译测试的文件夹位置,在你的U盘。
281305
282306\<\< 问:有谁知道,怎样设置‘相对路径’在这些标签和文件中,以保证寻址工作正常,当你移动U盘到另一台电脑会遇到一个不同的盘符的?
283307
284308答: 我就是这么做的。关联很复杂,但这是我发现的最佳方案(译注:确实很复杂,谁看明白了接着翻译吧。请参见[《Lazarus中文版免重装的方法》](http://pengtu.net/wp2/ooo/lazarus-green))。 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:
285309
286-`  set THUMBDRIVE=%CD:~0,2%`
310+```text
311+ set THUMBDRIVE=%CD:~0,2%
312+```
287313
288314This 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:
289315
290-` %SystemRoot%\system32\cmd.exe /k bin\setenv`
316+```text
317+ %SystemRoot%\system32\cmd.exe /k bin\setenv
318+```
291319
292320so 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.
293321
294322Also inside the bin directory is [sed](http://sed.sf.net) (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):
295323
296-` copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak`\
297-` sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml`
324+```text
325+ copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
326+ sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml
327+```
298328
299329So to use it, I would type at the command prompt of the USB drive:
300330
301-` fixlaz G:`
331+```text
332+ fixlaz G:
333+```
302334
303335if "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. \>\>
304336
305337The binary package is available for Linux and Windows from
306338
307339<http://sourceforge.net/project/showfiles.php?group_id=89339>
308340
309341Download 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).
310342
311343You can also use a Lazarus Snapshot. For download locations see [[Lazarus Snapshots Downloads]].
312344
313345小提示:
314346
315347这也许是个好主意:在安装Lazarus之后重启你的Windows,然后再去安装额外的Lazarus组件,比如zeoslib。
316348
317349#### 从源代码安装
318350
319351If you prefer to install from sources, then follow these instructions (Thanks to Joe for the initial Step-by-step description) (译注:略,参见英文页面)
320352
321353### 在FreeBSD下安装 Lazarus
322354
323355**FreeBSD 5+**
324356
325357The latest version of Lazarus into FreeBSD port tree is 0.9.22. We can to install lazarus using FreeBSD ports.
326358
327-`[]# cd /usr/ports/editors/lazarus && make install clean clean-depends`
359+```text
360+[]# cd /usr/ports/editors/lazarus && make install clean clean-depends
361+```
328362
329363If 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
330364
331365Good luck, that worked for me. --Jrmarino 21:29, 4 Jan 2006 (CET)
332366
333367### Installing Lazarus under PC-BSD 1.0rc1+
334368
335369You can install Lazarus on PB-BSD by simply downloading the Lazarus PBI from [PBI Dir](http://www.pbidir.com/)
336370
337371Note 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.
338372
339373**\[other OpenBSD/NetBSD/DragonFlyBSD goes here\]**
340374
341375### 在Mac OS X下安装 Lazarus
342376
343377Works pretty much the same as under Linux. But you first need to install the Apple developer tools, X11, and GTK 1.2.
344378
345379Easy-to-install snapshots are also from the [[Lazarus Snapshots Downloads|snaphot servers]].
346380
347381If 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.
348382
349383If you want to experiment and develop the Carbon widgetset interface, look at [[Carbon Interface]].
350384
351385There are at least two ways to start Lazarus under OS X:
352386
353387Start X11. In the terminal window, type:
354388
355-`cd /usr/local/share/lazarus`\
356-`./lazarus`
389+```text
390+cd /usr/local/share/lazarus
391+./lazarus
392+```
357393
358394You can also run Lazarus from the X11 menu. Choose Applications \| Customize, click Add Item, then under Name enter Lazarus and under Command enter:
359395
360-`open -a /usr/local/share/lazarus/lazarus`
396+```text
397+open -a /usr/local/share/lazarus/lazarus
398+```
361399
362400Click Done. Now you can start Lazarus by choosing Applications \| Lazarus.
363401
364402### 关于安装FPC和Lazarus附加的经验和劝告
365403
366404On 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.
367405
368406Pitfalls that I have experienced in various attempts with SuSE linux include:
369407
370408The 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里。
371409
372410If 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里。
373411
374412So 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
375413
376414Make sure the links in /etc/fpc.cfg point to the correct versions of the libraries (particularly if you have older versions still lurking around).
377415
378416In /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.
379417
380418Try running the compiler from the command line using one of the simple example programs or one which you wrote yourself.尝试使用命令行运行编译程序,编译一个简单的例子程序或者是你自己以前写的些代码。
381419
382420Turning to Lazarus:
383421
384422If you use a downloaded snapshot (.tar.gz) or get the source from CVS, enter your lazarus directory and type
385423
386-`make`\
387-`./lazarus `
424+```text
425+make
426+./lazarus
427+```
388428
389429and 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.
390430
391431You may find further problems when you start programming or compiling; most of these will be related to PATH selection.
392432
393433Many 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的主站点。有困难就先到下面的地址查查。
394434
395435<http://www.lazarus.freepascal.org/modules.php?op=modload&name=FAQ&file=index>
396436
397437From 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.
398438
399439当你认为路径正确时, 尝试编译你的应用程序. 如果得到路径错误 ('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).
400440
401441一担你设定的环境和路径正确, 它需要保存设置到一个文件, otherwise(否则) you will have to go through this process for each new project.
402442
403-` In the Run -> Compiler options dialog there is a Load/Save button; `
443+```text
444+ In the Run -> Compiler options dialog there is a Load/Save button;
445+```
404446
405447译者注:由于我使用的是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.
406448
407449译者注(添加):如果您使用的是ubuntu 8.10 并且您是使用新立得获取的lazarus和free pascal 在使用lazarus时,(Environment环境设置)fpc的路径应该是:
408450
409-`  /usr/share/fpcsrc/2.2.0/`
451+```text
452+ /usr/share/fpcsrc/2.2.0/
453+```
410454
411455## 最初的贡献者和变化
412456
413457This page has been converted from the epikwiki [version](http://lazarus-ccr.sourceforge.net/index.php?wiki=InstallingLazarus).
414458
415459- Initially imported and formatted. VlxAdmin 9/22/2003
416460- Changed Joe's part for Windows to require fpc 1.0.10. Vincent 9/25/2003
417461- Updated "What is required for lazarus". AndrewJohnson 10/1/2003
418462- Finished formatted the InstallingLazarus page VlxAdmin 2/22/2004
419463- 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
420464- 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
421465- Removed the original note. Tidied the wiki and formatting a bit. VlxAdmin
422466- Corrected a couple of typos - 3/12/2004 User:Kirkpatc
423467- Added link for daily snapshot deb packages - 3/27/2004 Vincent
424468- Fixed links in GettingLazarus (downloading binaries) and several other pages. 22 July 2004 User:Kirkpatc
425469- Added link for lazarus deb packages - 19 August 2004 VincentSnijders
426470- Added a short note on installing in Debian - 23 Nov 2004 User:Kirkpatc
427471- Considerable re-write and re-organization of installation section - 11 Dec 2004 User:Kirkpatc
428472- Fixed broken link - 9 Oct 2005 User:Avantman42
429473
430474---
431475*From the Free Pascal wiki, page "Installing Lazarus/zh CN", as it stood on 2020-02-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
432476Category: FPC/zh CN
433477Category: Install/zh CN
434478Category: Lazarus/zh CN

Back to history