Sign in Join
Wiki copytemporary

Installing Lazarus/ru: what changed

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

OldNewLine
11## Обзор
22
33Ознакомится с более подробной инструкцией по сборке можно [здесь](http://www.stack.nl/~marcov/buildfaq.pdf).
44
55Для загрузки исполняемых файлов Lazarus смотрите [Загрузка и установка релизной версии Lazarus](http://wiki.lazarus.freepascal.org/Getting_Lazarus/ru#Загрузка_и_установка_релизной_версии_Lazarus)
66
77Для тех, кто просто хочет установить Lazarus и начать использовать его для написания программ, наиболее простым способом является загрузка и установка последней стабильной версии исполняемых файлов (таких, как rpm-пакеты для Linux, установочные exe-файлы для Windows или dmg-пакеты для Mac OS X). Вы можете прочитать об этом в разделах "Исполняемые файлы FPC" для Linux и Windows или в первых параграфах в разделах установки Lazarus в средах Linux или Windows; оставшуюся часть информации можно спокойно пропустить.
88
99Для тех, кто хочет принимать участие в разработке компилятора, IDE или использовать актуальные инструменты, необходима установка из исходных файлов.
1010
1111Lazarus состоит из двух основных частей:
1212
1313- LCL - Lazarus Component Library, библиотека компонентов Lazarus
1414- IDE - RAD, среда быстрой разработки
1515
1616В свою очередь они зависят от:
1717
1818- FPC - компилятор Free Pascal
1919- FCL - Free Pascal Component library, библиотека компонентов компилятора FPC, содержащая большое количество невизуальных компонентов, используемых в Lazarus
2020
2121### Системные требования Lazarus
2222
23231. компилятор Free Pascal, пакеты и исходные файлы. (*важно*: той же версии/даты сборки)
24242. поддерживаемый набор виджетов
2525 :;Win32: может быть использован внутренний набор Win32 API или набор виджетов Qt.
2626
2727 :;Linux/xxxBSD: GTK+ 2.x or Qt : Most Linux distributions and *BSDs already install the GTK+ 2.x libraries. You can also find them at <http://www.gtk.org>.\
2828 Qt is also supported with all distributions (auto installed if you prefer KDE).\
2929 :;Mac OS X: You need the Apple developer tools. See Installing under Mac OS X below. Qt can be used too.
3030
3131FAQ - Frequently Asked Questions (часто задаваемые вопросы) доступны по ссылке <http://www.lazarus.freepascal.org> . Некоторые вопросы можно найти в файле 'FAQ'.
3232
3333Qt widget set is supported on Linux 32/64,Win32/64,Mac OS X, Haiku and embedded linux (qtopia) platforms.\
3434Более подробно узнать про установку можно по ссылке <http://wiki.lazarus.freepascal.org/index.php/Qt_Interface>\
3535В следующих разделах описывается как можно получить компилятор Free Pascal и как правильно установить Lazarus.
3636
3737## Краткое руководство
3838
3939Хотя остальная часть этой страницы содержит много ценной информации, многим пользователям может понадобиться не более, чем следующие «краткие руководства» - возможно?
4040
4141#### Linux
4242
4343- См. [[Installing Lazarus on Linux]]
4444
4545#### macOS
4646
4747- См. [[Installing Lazarus on MacOS X/ru|Установка Lazarus на MacOS X]]
4848
4949#### Windows
5050
5151Безусловно, самый простой и распространенный способ установки Lazarus на Windows - это перейти на [сайт загрузки Lazarus](https://sourceforge.net/projects/lazarus/files/) SourceForge, выбрать подходящий комбинированный пакет FPC/Lazarus, скачать и установить.
5252
5353## Установка компилятора Free Pascal
5454
5555Существует подробная инструкция, как устанавливать и собирать компилятор Free Pascal, доступная по ссылке <http://www.stack.nl/~marcov/buildfaq.pdf> - для некоторых пользователей она может быть слишком подробной, но при этом в ней дана исчерпывающая информация.
5656
5757Для Lazarus 1.8 требуется fpc (Free Pascal) версии 3.0.4 или выше, а также необходимо, чтобы библиотеки fpc (исполняемые файлы) и исходные файлы fpc были одинаковых версий.
5858
5959### Установка Free Pascal в Linux
6060
6161#### Исполняемые файлы FPC
6262
6363Последнюю стабильную версию Free Pascal 3.0.4 можно получить на сайте Free Pascal (перейдите по ссылке <http://www.freepascal.org/download.var> и далее выберите зеркало) или на сайте SourceForge (http://sourceforge.net/projects/lazarus).
6464
6565В разделе загрузок Lazarus (http://www.lazarus.freepascal.org ) можно получить RPM- или DEB-пакеты компилятора Free Pascal (компилятор для Linux). Если вам не нужны RPM или debian дистрибутивы, вы можете загрузить и установить tar-архивы с <http://www.freepascal.org>. Если вы хотите самостоятельно скомпилировать исполняемые файлы, смотрите в разделе BSD.
6666
6767Инструкции:
6868
6969> **Warning:** если вы **не используете RPM- или debian-пакеты** (даже если вы планируете использовать другие) лучшим вариантом будет получение актуальной стабильной версии fpc (на данный момент 3.0.4) и установка Lazarus из исходных файлов.
7070
71-\
7271Запустите Linux и войдите в систему под **root**'ом.
7372
7473Загрузите актуальные версии файлов с <https://sourceforge.net/projects/lazarus/files/>. Например:
7574
7675:* fpc-3.0.4-1.i686.rpm
7776
7877:* fpc-src-3.0.4-1.i686.rpm
7978
8079:* lazarus-2.0.6-1.i686.rpm и установите их с помощью команды:
8180
8281:* rpm -Uvh *.rpm
8382
8483Пользователям системы Debian рекомендуется использовать deb-пакеты, но можно использовать и другие (внимание: они не создают fpc.cfg), например установить tar-архивы.
8584
8685#### Исходные файлы FPC
8786
8887Исходные файлы FPC хранятся в репозитории Subversion (SVN), в котором отслеживаются все изменения. Если у вас уже есть исходные файлы, пожалуйста, посмотрите инструкции по их установке в разделе #Installing Free Pascal from source under Linux/BSD.
8988
9089##### Загрузка ежедневных исходных файлов из ветки разработки
9190
9291Вы можете загрузить ежедневно обновляемые исходные файлы в форме упакованных ночных сборок из репозитория SVN: они обновляются ежедневно и отображают состояние исходных файлов. Они не протестированы, могут не работать или даже привести к нарушению работы вашей системы. Файлы сохранены на сайте, который содержит архив SVN. Версия FPC может варьироваться. Расположены по адресу: [1](http://www.hu.freepascal.org/lazarus/)
9392
9493##### Обновление исходных файлов с помощью SVN
9594
9695В качестве альтернативы ежедневным zip-файлам исходников SVN, репозиторий SVN сделан доступным для всех с доступом только для чтения. Это означает, что вы можете получить прямой доступ к коду, и у вас будут действительно доступные исходники на последний момент. Это также метод, который требует меньшей полосы пропускания после первой загрузки (извлечение в SVN lingo).
9796
9897##### Получение исходных файлов
9998
10099Как это можно сделать? Для начала вам необходим установленный клиент для SVN. Используйте менеджер установки и установите утилиту, например, TortoiseSVN для Windows или смотрите подробней на сайте [2](http://subversion.tigris.org/).
101100
102101Использование командной строки SVN: измените текущую директорию (cd) на родительскую директорию, которая используется для работы, например, чтобы получить полные исходные файлы из репозитория в поддиректорию fpc домашней директории и напишите
103102
104103``` bash
105104cd ~
106105svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
107106```
108107
109108Для обновления исходных файлов, загруженных с помощью команды, указанной выше
110109
111110``` bash
112111cd ~
113112svn update fpc
114113```
115114
116115##### Получение отдельных веток
117116
118117Если текущая версия транка находится в состоянии быстрого изменения и не подходит для большого использования, если вы не хотите работать с самим компилятором, вы можете остаться на версии, которая обновлена с исправлениями. Чтобы сделать это, вы должны найти стабильную ветку, которую вы хотите отслеживать, вместо девелоперской **trunk** версии по умолчанию. Пример ниже показывает, как вы можете отслеживать версию fixes_2_6; конечно замените \[номер версии\] по мере необходимости в зависимости от того, какие ветки вы хотите отслеживать.
119118
120119Этот пример хранит исправления в другой папке в вашем домашнем каталоге - не имеет смысла помещать две версии исходного кода в один каталог ...
121120
122121``` bash
123122cd ~
124123svn checkout http://svn.freepascal.org/svn/fpc/branches/fixes_2_6 fpc_fixes_2_6
125124```
126125
127126Обычное обновление:
128127
129128``` bash
130129cd ~
131130svn update fpc_fixes_2_6
132131```
133132
134133##### Документация
135134
136135Исходные файлы документации расположены в отдельном репозитории с именем fpcdocs, поэтому для их получения необходима следующая команда
137136
138137``` bash
139138cd ~
140139svn checkout http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs
141140```
142141
143142Если вы хотите больше узнать о subversion, прочитайте эту отличную [книгу по Subversion](http://svnbook.red-bean.com/), которая также бесплатно доступна в разных форматах.
144143
145144Более подробную информацию смотрите на [сайте Free Pascal](http://www.freepascal.org/develop.var).
146145
147146### Установка Free Pascal в Windows
148147
149148#### Исполняемые файлы FPC для Windows
150149
151150Самым простым способом получения установочных файлов Free Pascal является загрузка текущей стабильной версии исполняемых файлов Lazarus для Windows из репозитория SourceForge [3](http://sourceforge.net/projects/lazarus/files/) - эти файлы содержат текущие стабильные версии компилятора и необходимых библиотек Free Pascal, а также среду разработки Lazarus.
152151
153152Если вы хотите установить из исходных файлов читайте дальше!
154153
155154Вы можете загрузить zip-архив с fpc в разделе загрузок Free Pascal (перейдите по ссылке <http://www.freepascal.org/download.var> и далее выберите зеркало). Установка из исходных файлов -- смотрите следующий раздел, чтобы узнать как это сделать -- не для новичков, так как для этого вам необходим изначально установленный компилятор.
156155
157156#### Исходные файлы FPC для Windows
158157
159158\<\<\<\< Смотрите выше в разделе Исходные файлы FPC для Linux, где описано использование SVN \>\>\>\>
160159
161160Наиболее простым способом получить исходные файлы Free Pascal является использование SVN; смотрите следующий раздел для более подробной информации. Также вы можете загрузить установочный пакет целиком -- смотрите на сайте <http://www.freepascal.org/develop.var> ежедневные сборки ветки 3.0.x.
162161
163162Исходные файлы FPC для Windows с помощью SVN
164163
165164Вам необходим установленный SVN-клиент, например [TortoiseSVN](http://tortoisesvn.tigris.org/), для выполнения дальнейших шагов. Точные команды отличаются для разных SVN-клиентов; приведенные ниже команды должны использоваться для SVN-клиента, который можно скачать здесь.
166165
167166Для начала создайте директорию, в которую вы хотите поместить исходные файлы. С этим может справиться любой пользователь. Создайте директорию для fpc (например C:\Source), после чего чего выполните следующую команду в командной строке:
168167
169168``` bash
170169C:\Source> svn co http://svn.freepascal.org/svn/fpc/trunk fpc
171170```
172171
173172Совет: для загрузки/обновления файлов с последними изменениями вы просто можете выполнить
174173
175174```dos
176175C:\> cd Source\FPC
177176C:\Source\FPC> svn up
178177```
179178
180179Смотрите: <http://www.freepascal.org/down/i386/win32.var> . Загрузите FPC одним большим файлом, распакуйте его и запустите install.exe.
181180
182181Добавьте путь к директории fpc в переменную среды:
183182
184183- Win98: отредактируйте autoexec.bat и добавьте строку: PATH=%PATH%;C:\pp\bin\bin\win32
185184- WinXP/2k: Мой компьютер (правая кнопка мыши по ярлыку) -\> Свойства -\> Дополнительно (вкладка) -\> Переменные среды -\> Системные переменные -\> Изменить "PATH", добавить здесь "C:\pp\bin\bin\win32".
186185
187186После этого перезагрузите windows.
188187
189188После установки исполняемых файлов FPC вы можете собирать исходные файлы FPC из subversion.
190189
191190Советы:
192191
193192- Для Windows 7 (и выше) требуются повышенные права пользователя для работы в командной строке. Щелкните правой кнопкой мыши по ярлыку "Командная строка" в меню Пуск и выберите "Запустить от имени Администратора".
194193- YOUR-PREFIX полностью зависит от места установки FPC. При составлении данной статьи исполняемые файлы по умолчанию располагаются в директории "C:\FPC" и помещаются в "C:\FPC\3.0.4". В системе Linux сценарии "make install" были скорректированы для создания новой поддиректории ЕСЛИ версия FPC изменилась с момента последней сборки. В сценариях для Windows это не сделано. Поэтому, если вы знаете, что имя поддиректории, например 3.1.1, то вы можете указать это. Однако, по причине частой смены версий, рекомендуется просто выбрать и сохранить один PREFIX вне зависимости от версий FPC. Хорошим значением для prefix является C:\FPC, но вы также должны убедиться, что директория C:\FPC\bin\i386-win32\\ добавлена в переменную среды PATH (смотрите выше, как прописать путь и изменить версию исполняемых файлов на только что скомпилированные).
195194
196195Инструкции:
197196
198197- В командной строке перейдите к расположенным исходным файлам FPC, например напишите "cd c:\Developer\FPC"
199198- Для сборки FPC напишите "make all"
200199- Для перезаписи существующих файлов FPC напишите "make install PREFIX=YOUR-PREFIX"
201200- Для установки исходных файлов напишите "make install sourceinstall PREFIX=YOUR-PREFIX"
202201
203202#### Компиляция/установка FPC и Lazarus из исходных файлов с помощью SVN (Win32)
204203
20520414 Dec 2017 версия FPC **3.0.4** или **trunk** - версия Lazarus **1.9.x**
206205
207206##### Шаг \#1: Создать каталоги и скачать исходные файлы
208207
209208Создайте следующие каталоги:
210209
211210` c:\freepascal\`\
212211` c:\freepascal\binutils\`\
213212` c:\freepascal\binutils\i386-win32\`\
214213` c:\freepascal\fpc\`\
215214` c:\freepascal\fpc\3.0.4\`\
216215` c:\freepascal\laz\`
217216
218217или для fpc из trunk:
219218
220219` c:\freepascal\`\
221220` c:\freepascal\binutils\`\
222221` c:\freepascal\binutils\i386-win32\`\
223222` c:\freepascal\fpc\`\
224223` c:\freepascal\fpc\trunk\`\
225224` c:\freepascal\laz\`
226225
227226Вам понадобится последняя *стабильная* версия компилятора для сборки новой версии компилятора. Скачайте файл ppc386 (сам компилятор) с FTP (по ссылке ниже) и распакуйте его в c:\freepascal\binutils\\
228227
229228` `[`ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/bootstrap/i386-win32-ppc386.zip`](ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/bootstrap/i386-win32-ppc386.zip)
230229
231230После установки [TortoiseSVN](http://tortoisesvn.tigris.org/) скачайте исходные файлы из SVN используя URL-адрес для каждого каталога:
232231
233232` Dir: c:\freepascal\binutils\i386-win32\`\
234233` URL: `[`http://svn.freepascal.org/svn/fpcbuild/branches/fixes_3_0/install/binw32`](http://svn.freepascal.org/svn/fpcbuild/branches/fixes_3_0/install/binw32)
235234
236235или для fpc из trunk:
237236
238237` Dir: c:\freepascal\binutils\i386-win32\`\
239238` URL: `[`http://svn.freepascal.org/svn/fpcbuild/trunk/install/binw32`](http://svn.freepascal.org/svn/fpcbuild/trunk/install/binw32)
240239
241240` Dir: c:\freepascal\fpc\3.0.4`\
242241` URL: `[`http://svn.freepascal.org/svn/fpc/branches/fixes_3_0/`](http://svn.freepascal.org/svn/fpc/branches/fixes_3_0/)
243242
244243или для fpc из trunk:
245244
246245` Dir: c:\freepascal\fpc\trunk`\
247246` URL: `[`http://svn.freepascal.org/svn/fpc/trunk/`](http://svn.freepascal.org/svn/fpc/trunk/)
248247
249248` Dir: c:\freepascal\laz`\
250249` URL: `[`http://svn.freepascal.org/svn/lazarus/trunk`](http://svn.freepascal.org/svn/lazarus/trunk)
251250
252251##### Шаг \#2: Создать BAT-файл для компиляции FPC
253252
254253После того, как всё скачалось, нам необходимо создать BAT-файл для компиляции исходных файлов FPC. Создайте новый файл c:\freepascal\makefpc.bat и скопируйте в него следующий сценарий:
255254
256255```dos
257256@echo on
258257set myroot=c:\freepascal
259258set myFPC=%myroot%\fpc\3.0.4
260259set mybinutils=%myroot%\binutils
261260set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
262261cd %myFPC%
263262rd /s /q %myfpc%\examples
264263svn cleanup . --remove-unversioned --remove-ignored
265264make distclean all install INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
266265cd /d %myFPC%\bin\i386-win32
267266fpcmkcfg -d basepath=%myFPC% -o .\fpc.cfg
268267copy fpc.exe %mybinutils%\i386-win32
269268```
270269
271270или для fpc из trunk:
272271
273272```dos
274273@echo on
275274set myroot=c:\freepascal
276275set myFPC=%myroot%\fpc\trunk
277276set mybinutils=%myroot%\binutils
278277set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
279278cd %myFPC%
280279rd /s /q %myfpc%\examples
281280svn cleanup . --remove-unversioned --remove-ignored
282281make distclean all install INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
283282cd /d %myFPC%\bin\i386-win32
284283del fpc.cfg
285284fpcmkcfg -d basepath=%myFPC% -o .\fpc.cfg
286285copy fpc.exe %mybinutils%\i386-win32
287286```
288287
289288Для компиляции кросс-платформенных программ в режиме x86_64 добавьте следующие строки после первой команды make:
290289
291290```dos
292291make all OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
293292make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
294293```
295294
296295При использовании данных сценариев скомпилированные файлы компилятора и необходимые директории для корректной его работы будут созданы непосредственно в корневой директории, куда были загружены исходные файлы. В некоторых случаях это не удобно, например, если необходимо *перенести* всю директорию с компилятором на другой компьютер или просто сделать несколько директорий разных версий (или ревизий) компилятора и при необходимости пользоваться каждой из них путем выбора нужного пути в свойствах проекта. Для этого необходимо модифицировать сценарий. Ниже представлен пример сценария для создания полностью автономной директории с компилятором и необходимыми файлами (для универсальности добавлены инструкции, позволяющие собрать компилятор версий **x86** и **x64**):
297296
298297```dos
299298@echo on
300299set myroot=c:\freepascal
301300
302301set instdir=%myroot%\fpc\3.0.5
303302
304303set myFPC=%myroot%\fpc\3.0.4
305304set mybinutils=%myroot%\binutils
306305set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
307306cd %myFPC%
308307rd /s /q %myfpc%\examples
309308svn cleanup . --remove-unversioned --remove-ignored
310309make distclean all install INSTALL_PREFIX=%instdir% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
311310make all OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%instdir% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
312311make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%instdir% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
313312cd /d %instdir%\bin\i386-win32
314313fpcmkcfg -d basepath=%instdir% -o .\fpc.cfg
315314copy fpc.exe %mybinutils%\i386-win32
316315
317316xcopy %myFPC%\rtl %instdir%\source\rtl /H /Y /C /R /S /I
318317xcopy %myFPC%\packages %instdir%\source\packages /H /Y /C /R /S /I
319318```
320319
321320В данном случае дополнительная переменная **instdir** задает новую директорию для компилятора. Последние 2 команды предназначены для копирования содержимого директорий **rtl** и **packages** в новую директорию компилятора.
322321
323322Совет: при переносе в другое место полученной директории для корректной работы компилятора необходимо отредактировать файл **fpc.cfg**.
324323
325324##### Шаг \#3: Собрать и установить FPC
326325
327326С помощью командной строки (cmd.exe) перейдите в директорию c:\freepascal и выполните сценарий, который мы только что написали:
328327
329328```dos
330329cd /d c:\freepascal
331330makefpc.bat
332331```
333332
334333##### Шаг \#4: Создать BAT-файл для компиляции Lazarus
335334
336335Если Lazarus компилируется впервые, создайте новый файл c:\freepascal\makelaz.bat и скопируйте в него следующий сценарий:
337336
338337```dos
339338set myroot=c:\freepascal
340339set myFPC=%myroot%\fpc\3.0.4
341340set mybinutils=%myroot%\binutils
342341set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
343342cd %myroot%\laz
344343make clean all OPT="-glw2 -Xg"
345344```
346345
347346или для fpc из trunk:
348347
349348```dos
350349set myroot=c:\freepascal
351350set myFPC=%myroot%\fpc\trunk
352351set mybinutils=%myroot%\binutils
353352set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
354353cd %myroot%\laz
355354make clean all OPT="-glw2 -Xg"
356355```
357356
358357Подсказка: данный BAT-файл необходимо использовать только для первой компиляции. В дальнейшем вы можете собирать Lazarus используя команду меню Tools \> Build Lazarus.
359358
360359##### Шаг \#5: Собрать Lazarus
361360
362361С помощью командной строки перейдите в директорию c:\freepascal и выполните сценарий: makelaz.bat
363362
364363Готово!
365364
366365### Установка Free Pascal в FreeBSD/auto
367366
368367Последняя коллекция портов для FreeBSD имеет версию 3.0.4 и находится в ports/lang/fpc. Но они разбросаны по более чем 96 пакетам (!) и исходный код может быть получен из /usr/ports/distfiles/freepascal.
369368
370369Данная команда может быть выполнена с правами администратора (из-под root'а).
371370
372371``` bash
373372[]# cd /usr/ports/lang/fpc && make install && make clean
374373```
375374
376375Другая возможность заключается в использовании portinstall.
377376
378377``` bash
379378[]# portinstall fpc
380379```
381380
382381Как только fpc установлен, вы можете проверить его работоспособность просто выполнив команду
383382
384383``` bash
385384[]$ fpc
386385```
387386
388387### Установка Free Pascal из исходных файлов в Linux/BSD
389388
390389Для эффективности вам нужно
391390
392391Если у вас есть файл со всеми исходниками FPC или обоих (FPC и Lazarus):
393392
3943931. напр., для fpc (последний снапшот на момент правки статьи) предпочтителен экспорт с [ftp](ftp://ftp.freepascal.org/fpc/snapshot/v33/) (без SVN/dirs).
3953942. снапшот исходника Lazarus.
396395
397396- начальный компилятор, последняя версия релиза (fpc 3.0.4 на момент правки статьи) является единственной гарантированной версией. Вы можете скачать загрузочный компилятор или использовать систему управления пакетами/программного обеспечения вашего дистрибутива, чтобы установить его
398397
399398Процесс сборки FPC:
400399
401400- Получить необходимые файлы (начиная с компилятора), исходный файл FPC или исходный svn-каталог
402401- При использовании исходных файлов FPC: extract/de-tgz в рабочий каталог
403402- Сборка: войдите в work/fpc/ и запустите
404403
405404``` bash
406405# можно использовать:
407406export MAKE=`which make` ; echo $MAKE
408407$MAKE all OPT='-gl' PP=/path/to/startingcompiler-name-ppc386
409408# $MAKE применяется в linux и gmake в BSD
410409# /path/to/ может быть пропущен, когда ppc386 прописан в путях поиска
411410```
412411
413412- Установка fpc. Снова \[заходим\] в work/fpc, запускаем
414413
415414``` bash
416415$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX
417416#заменяем PP=compiler/ppc386 на соответствующий компилятор, если это не Intel x86
418417#THEPREFIX= обычно это /usr/local или просто /usr (но, например, на NetBSD для портов это /usr/pkg)
419418```
420419
421420- Создаем симлинк:
422421
423422``` bash
424423ln -s $THEPREFIX/lib/fpc/3.0.0/ppc386 $THEPREFIX/bin/ppc386
425424```
426425
427426- Устанавливаем исходники:
428427
429428``` bash
430429$MAKE install sourceinstall PREFIX=$THEPREFIX
431430```
432431
433432- Создаем симлинк к исходникам по умолчанию для Lazarus:
434433
435434``` bash
436435ln -sf $THEPREFIX/share/src/3.0.0/fpc /usr/share/fpcsrc
437436```
438437
439438- Настраиваем файл конфигурации fpc.cfg:
440439
441440``` bash
442441$THEPREFIX/lib/fpc/3.0.0/samplecfg $THEPREFIX/lib/fpc/3.0.0 $ETCDIR
443442```
444443
445444- При желании можете проверить, выдает ли ppc386 -i (или какой-либо другой компилятор, используемый вашей архитектурой) \[какую-либо\] информацию, иначе будет предупреждение о том, что пользователю необходимо добавить \$PREFIX/bin в его текущий путь. Попробуйте скомпилировать программу с -viwn и посмотрите, не выдаст ли это ошибку.
446445
447446Примечание:
448447
449448- Если вам нужны списки пакетов fpcmake, вам нужно сгенерировать или предоставить их самостоятельно (\[с помощью\] порта или в дополнительном архиве) в любом случае, выполнить фиктивную установку в /tmp/pack и определить файлы, установленные с
450449 ``` bash
451450 find . >ll
452451 ```
453452
454453- \$THEPREFIX и \$ETCDIR должен \[иметь возможность\] быть настраиваемым пользователем. В противном случае локальная установка невозможна.
455454
456455- BSDHIER=1 для всех команд make действуют соглашения об иерархии BSD.
457456
458457### Установка Free Pascal в macOS
459458
460459См [[Installing Lazarus on macOS|Установка Lazarus на macOS]]
461460
462461## Установка Lazarus
463462
464463### Установка Lazarus в Linux
465464
466465#### Ubuntu / Debian
467466
468467Рекомендуется использовать установщик обновлений [[fpcup|fpcUP]] для начинающих пользователей Lazarus, который устанавливает FPC и Lazarus за один раз в единую структуру подкаталогов (~/development).
469468
470469------------------------------------------------------------------------
471470
472471(Прим.перев.: а еще лучше использовать форк этой утилиты [[fpcupdeluxe]] от [LongDirtyAnimAlf](https://github.com/LongDirtyAnimAlf), последний релиз которой всегда можно скачать [здесь](https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases))
473472
474473------------------------------------------------------------------------
475474
476475Чтобы получить текущую рабочую установку Lazarus, загрузите файлы .deb для Free Pascal и Lazarus из репозитория SourceForge. Вот как: [[Lazarus release version for Ubuntu|Получение Lazarus из нашего репозитория Ubuntu]].
477476
478477Обратите внимание, что установка из исходных кодов Ubuntu по умолчанию не приведет к установке Free Pascal Source Libraries - используйте метод выше.
479478
480479> **Note:** по крайней мере в Linux Ubuntu команда для запуска Lazarus из консоли - [[startlazarus]]. Иначе, если вы установили его из пакета Debian, у вас должен быть пункт меню Lazarus в разделе Application/Programming(«Приложение/Программирование»). (Проблема: существует неоднозначность с программой, также называемой "lazarus" из пакета "tct", доступного для Ubuntu).
481480
482481##### Простой способ сборки из deb-пакетов
483482
484483Самый простой способ получить текущую рабочую установку Lazarus - это загрузить свои собственные пакеты .deb, следуя инструкциям отсюда: [[How to setup a FPC and Lazarus Ubuntu repository|Как настроить хранилище FPC и Lazarus Ubuntu]]
485484
486485##### Установка с использованием rpms
487486
488487Следующим самым простым способом установки является установка RPM-пакетов для Free Pascal и Lazarus из репозитория SourceForge.
489488
490489Вам необходимо загрузить выбранные версии следующих компонентов:
491490
492491- компилятор (например, fpc-3.0.4-1.i686.rpm)
493492- исходный код библиотеки pascal (например, fpc-src-3.0.4-1.i686.rpm)
494493- Lazarus (например, lazarus-1.8.4-0.i686.rpm).
495494
496495Удалите старые пакеты:
497496
498497``` bash
499498rpm -ev lazarus
500499rpm -ev fpc
501500rpm -ev fpc-src
502501```
503502
504503Установите новые пакеты:
505504
506505``` bash
507506rpm -ivh fpc-*
508507rpm -ivh lazarus-*
509508```
510509
511510##### Установка на Raspbian Wheezy
512511
513512Raspbian - это специальная версия Debian для компьютера Raspberry Pi размером с кредитную карту. См. [[Lazarus on Raspberry Pi]] для получения детальной информации.
514513
515514#### Установка на Mandriva
516515
517516##### Lazarus 0.9.30 на Mandriva 2010.
518517
519518Установите как указано ниже, однако при компиляции программы вы можете получить два сообщения об ошибках, сообщающих, что вам не хватает pixbuf 2.0 и lgtk-x11-2.0. Чтобы исправить это, установите libdgk_pixbuf2.0_0-devel и libgtk + 2.0_0-devel из установщика программного обеспечения.
520519
521520#### Установка на Slackware
522521
523522##### Установка Lazarus на Slackware 13.0
524523
525524Нет реальной разницы от версий slackware 12.2 или 12.0, поэтому описанная ниже процедура должна работать точно так же.
526525
527526##### Установка Lazarus 0.9.30 для пользователей Slackware 12.0
528527
529528Это работало в Slackware-12.0 на компьютере Pentium-3:
530529
531530- Free Pascal Compiler (FPC) устанавливается в режиме SUPERUSER
532531- Lazarus устанавливается в режиме USER
533532- Компилятор FPC будет перекомпилирован
534533- Исходный код IDE Lazarus загружается с сервера SVN.
535534
536535-- Загружаем "fpc-2.4.2.i386-linux.tar" в папку пользователя и устанавливаем его. Переходим в эту папку и вводим:
537536
538537``` bash
539538bash-3.1$ tar -xvf fpc-2.4.2.i386-linux.tar
540539bash-3.1$ su
541540bash-3.1$ password:xxxxxx
542541bash-3.1# sh install.sh
543542...
544543(используем ответы по умолчанию для следующих 6 вопросов: нажимаем "Enter" 6 раз)
545544...
546545bash-3.1# exit
547546bash-3.2$ fpc
548547free pascal compiler version 2.4.2 [] for i386
549548Copyright (c) 2010 ...
550549...
551550...
552551```
553552
554553Вы установили компилятор. Возможно, вы захотите перекомпилировать его или нет, но в любом случае вам нужно будет загрузить исходный код в соответствии с требованиями IDE lazarus.
555554
556555-- загружаем "fpc-2.4.2.source.tar.gz" во временную папку. Если вы не хотите перекомпилировать исходный код, просто пропустите этот раздел. Если вы хотите запустить свою собственную скомпилированную версию FPC, просто введите:
557556
558557``` bash
559558bash-3.1$ tar -xvzf fpc-2.4.2.source.tar.gz
560559bash-3.1$ cd fpc-2.4.2
561560bash-3.1$ make clean all
562561bash-3.1$ su
563562bash-3.1$ password: xxxxxxxx
564563bash-3.1# make install
565564bash-3.1# exit
566565bash-3.1$ fpc
567566free pascal compiler version 2.4.2 [...] for i386
568567Copyright (c) 2010 ...
569568...
570569...
571570```
572571
573572Теперь у вас есть собственная скомпилированная версия.
574573
575574-- Редактор Lazarus IDE должен видеть исходный код FPC. Даже если вы не хотите перекомпилировать FPC, вам нужен его исходный код. Однако для экономии места я сохраняю только чистую (не скомпилированную) копию исходного кода. Я снова начинаю с файла "fpc-2.4.2.source.tar.gz" и копирую его в папку /usr/local/src/FPC:
576575
577576``` bash
578577bash-3.1$ su
579578bash-3.1$ password: xxxxxxxx
580579bash-3.1# cp fpc-2.4.2.source.tar.gz /usr/local/src/
581580bash-3.1# cd /usr/local/src/
582581bash-3.1# tar -xvzf fpc-2.4.2.source.tar.gz
583582bash-3.1# rm fpc-2.4.2.source.tar.gz
584583bash-3.1# exit
585584```
586585
587586Номер версии включен в название папки "fpc-2.4.2". Таким образом, я могу сохранить многие версии исходного кода компилятора и в конечном итоге переключаться между ними.
588587
589588-- The lazarus IDE is kept in my USER "~/lazarus" folder and always compiled in USER mode. I usually download the "lazarus-0.9.30-0.tar.gz" file, but here we can also get the latest development version from the SVN server:
590589
591590``` bash
592591bash-3.1$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus
593592```
594593
595594This is for the first time you load it. Next time you will only need to type:
596595
597596``` bash
598597bash-3.1$ svn update
599598```
600599
601600If you do not have SVN installed on your computer, here is how to get it quickly:
602601
603602--Download the two files: "subversion-1.4.6.tar.gz" and "subversion-deps-1.4.5.tar.gz" (or later versions). Type:
604603
605604``` bash
606605bash-3.1$ tar -xvzf subversion-1.4.6.tar.gz
607606bash-3.1$ tar -xvzf subversion-deps-1.4.6.tar.gz
608607bash-3.1$ cd subversion-1.4.6
609608bash-3.1$ ./configure
610609bash-3.1$ make
611610bash-3.1$ su
612611bash-3.1$ password:xxxxxx
613612bash-3.1# make install
614613bash-3.1$ exit
615614```
616615
617616-- At this point you have the folder "~/lazarus" containing the source code. You should compile it very simply:
618617
619618`  bash-3.1$ make clean all`
620619
621620After a few minutes, the compiler stops:
622621
623622``` bash
624623...
625624...
626625Linking ../Lazbuild
627626987 linescompiled ...
628627make [2] leaving ...
629628make [1] leaving ...
630629bash-3.1$
631630```
632631
633632-- Just type:
634633
635634``` bash
636635bash-3.1$ ./lazarus
637636```
638637
639638WOW! You get a message: "Free Pascal sources not found". Just follow the instructions and indicate your Free Pascal Compiler source directory in the panel: "Environment-\>Options-\>Files". As explained earlier, on my computer this should point to "/usr/local/src/fpc-2.4.2". Note that when you change this folder, you should click on "Environment / Rescan_FPC_source_directory".
640639
641640Voila!
642641
643642#### Установка на openSUSE
644643
645644##### Установка Lazarus 0.9.30 для пользователей openSUSE 11.1
646645
647646Free Pascal Compiler requires:\
648647\- Gnu binutils (gnu as, gnu ld, gnu make) These utils can be installed by:
649648
650649``` bash
651650zypper in -t pattern devel_basis
652651```
653652
654653Lazarus also requires these components: 1) glib2 devel 2) gtk2 devel
655654
656655**Important**: The lazarus rpm requires the gtk 2 version, not the version 1.2.
657656
658657These libraries can be installed by:
659658
660659``` bash
661660zypper -n install gtk2 glib2
662661```
663662
664663Download these binary files (RPM)
665664
666665:* fpc-2.4.2-0.i686.rpm (yes i686 and not i386)
667666
668667:* fpc-src-2.4.2-0.i686.rpm
669668
670669:* lazarus-0.9.30-0.i686.rpm
671670
672671install them opening a terminal session (mouse's right button -\> Menu: Open in terminal)
673672
674673``` bash
675674rpm -Uvh fpc-2.4.2-0.i686.rpm
676675rpm -Uvh fpc-src-2.4.2-0.i686.rpm
677676rpm -Uvh lazarus-0.9.30-0.i686.rpm
678677```
679678
680679#### Установка Lazarus 1.0.8 на Fedora Core 18
681680
682681After a fresh install of Fedora Core 18 **yum** is installed, but fails with an error messages.
683682
684683- Open **Software**, check for new software and update all packages.
685684- Reboot.
686685- Install packages **gtk2-devel**, **fpc** and **subversion**. Fedora Core 18 already has fpc 2.6.2.
687686- Open a Terminal and do
688687
689688`svn co svn+ssh://svn.freepascal.org/FPC/svn/lazarus/tags/lazarus_1_0_8 lazarus`\
690689`cd lazarus`\
691690`make bigide`\
692691`./lazarus`
693692
694693#### Установка Lazarus на Scientific Linux
695694
696695Scientific Linux is an RPM-based distribution focussing on science and research. See [[Scientific Linux]] for details.
697696
698697#### Установка из исходных файлов
699698
700699If 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.
701700
702701Here is an example of installing 0.9.28 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.
703702
704703> **Note:** In this example, fpc is installed in /opt. So when prompted **'Install prefix**', enter '/opt/fpc'.
705704
706705``` bash
707706#!/bin/sh
708707
709708#installing required packages
710709sudo apt-get install build-essential
711710sudo apt-get install libgtk2.0-dev
712711sudo apt-get install libgdk-pixbuf-dev
713712
714713#installing Free Pascal source
715714cd /opt
716715sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-src-2.4.2.source.tgz
717716sudo tar -xvf fpc-src-2.4.2.source.tgz
718717sudo mv fpc fpcsrc
719718
720719#installing Free Pascal
721720sudo mkdir fpc
722721cd fpc
723722sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-2.4.2.i686-linux.tar
724723sudo tar -xvf fpc-2.4.2.i686-linux.tar
725724echo "Enter '/opt/fpc' when prompted 'Install prefix'"
726725sudo sh install.sh
727726
728727#adding fpc path to the PATH
729728echo "#FPC PATH" >> ~/.bash_profile
730729echo "if [ -d /opt/fpc/bin ] ; then" >> ~/.bash_profile
731730echo PATH=/opt/fpc/bin:"${PATH}" >> ~/.bash_profile
732731echo "fi" >> ~/.bash_profile
733732
734733#installing Lazarus
735734cd ../
736735sudo wget http://nchc.dl.sourceforge.net/lazarus/lazarus-0.9.30-0.tar.gz
737736# sudo wget https://downloads.sourceforge.net/project/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%201.8.0RC5/lazarus-1.8.0-RC5.tar.gz
738737sudo tar -zxvf lazarus-0.9.30-0.tar.gz
739738PATH=/opt/fpc/bin:"${PATH}"
740739sudo chmod -R 777 lazarus
741740cd lazarus
742741make clean all
743742./lazarus
744743```
745744
746745> **Note:** You have to manually set fpc-src path in the Environmental Options.
747746
748747##### Загрузка исходных файлов Lazarus
749748
750749Both the Lazarus and FPC source code reside in SVN/subversion repositories. 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, but you don't need to be root.
751750
752751Please note these instructions are for subversion.
753752
754753Lazarus does not need any special permissions, neither during installation nor at runtime.
755754
756-<font color="red">If you decide to use TortoiseSVN, remember to check "command line client tools" during its installation if you want Lazarus to show the SVN revision number in the About dialog.</font>
755+If you decide to use TortoiseSVN, remember to check "command line client tools" during its installation if you want Lazarus to show the SVN revision number in the About dialog.
757756
758757Now getting the sources
759758
760759``` bash
761760 svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus
762761```
763762
764763(replace the last lazarus with any other dir where you want to place your sources)
765764
766765On subsequent occasions, to update simply type
767766
768767``` bash
769768 svn update lazarus
770769```
771770
772771For more information on Subversion, see: <http://subversion.tigris.org/>
773772
774773##### Компиляция и запуск
775774
776775Whether you checkout from cvs or svn, the next step is:
777776
778777compile lazarus
779778
780779``` bash
781780 cd lazarus
782781 make (gmake on BSD)
783782```
784783
785784If fpc is installed correctly, the compilation should work without problems. If not, see FAQ.
786785
787786Start lazarus
788787
789788``` bash
790789 ./lazarus
791790```
792791
793792The 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 Free Pascal compiler and its sources are installed by searching in the most common directories.
794793
795794Check the paths
796795Use the IDE menu to go to
797796
798797
799798Environment -\> Environment Options -\> Files
800799
801800The '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'.
802801
803802See here for the documentation about this dialog: [[IDE Window: Environment Options|IDE Options]].
804803
805804Hint
806805
807806To update lazarus you can use
808807
809808``` bash
810809 svn update lazarus
811810```
812811
813812then for either update pathway:
814813
815814``` bash
816815 make clean all (gmake on BSD)
817816```
818817
819818This will rebuild lazarus and create an IDE without lazarus packages. To link your installed packages do **after** the above:
820819
821820``` bash
822821 ./lazbuild --build-ide=
823822```
824823
825824You may have to append other options if for example you use a custom config directory (ie. add --pcp="C:\Documents and Settings\\\<USER\>\Local Settings\Application Data\lazarus-tests"). See [[lazbuild]].
826825
827826#### Установка Lazarus в Debian GNU/Linux
828827
829828There 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\>.
830829
831830Note 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
832831
833832``` bash
834833dpkg -r <package name>
835834```
836835
837836without .deb extension. And then install the newest versions as described.
838837
839838### Установка Lazarus в Windows
840839
841840Текущие стабильные версии исполняемых файлов Lazarus для Windows устанавливаются очень легко и могут работать 'из коробки'.
842841
843842Исключение составляют Win98 и ME, для которых необходимо указывать специальный флаг при компиляции. Смотрите Установка из исходных файлов.
844843
845844#### Установка портативной версии Lazarus на USB-диск
846845
847846It 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.
848847
849848\<\< Q: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?
850849
851850A: This is what I do. It's relatively convoluted, but it's the best solution I've found. 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:
852851
853852```dos
854853set THUMBDRIVE=%CD:~0,2%
855854```
856855
857856This 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:
858857
859858```dos
860859%SystemRoot%\system32\cmd.exe /k bin\setenv
861860```
862861
863862so 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.
864863
865864Also 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):
866865
867866```dos
868867copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
869868sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml
870869```
871870
872871So to use it, I would type at the command prompt of the USB drive:
873872
874873```dos
875874fixlaz G:
876875```
877876
878877if "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. \>\>
879878
880879The binary package is available for Linux and Windows from
881880
882881<http://sourceforge.net/project/showfiles.php?group_id=89339>
883882
884883Download the latest release (currently Lazarus-0.9.30-0-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).
885884
886885You can also use a Lazarus Snapshot. For download locations see [[Lazarus Snapshots Downloads]].
887886
888887Tip: It's perhaps a good idea to reboot your Windows after you installed Lazarus and before you try to install additional lazarus components as zeoslib fore example.
889888
890889#### Установка из исходных файлов
891890
892891If you prefer to install from sources, then follow these instructions.
893892
894893Please note these instructions are for SubVersion.
895894
896895Open a command prompt window. Start-\>Run...\>CMD or choose MS-DOS icon. You will use this window to enter the commands below
897896
898897You 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)\].
899898
900899Or you use SVN (example for text mode SVN; adapt to GUI tools such as TortoiseSVN if you want to):
901900
902901``` bash
903902mkdir c:\lazarus
904903cd /d c:\lazarus
905904svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ c:\lazarus
906905```
907906
908907You have to install at least the latests stable FPC version (e.g. FPC 2.6.4, but an FPC 3.1.1 snapshot is also possible).
909908
910909Type (replace \$(LazarusDir) with the path you have unzipped/checked out Lazarus; replace
911910
912911```dos
913912cd /d $(LazarusDir)
914913rem Of course change the first path variable to
915914rem the path of your FPC compiler
916915set path=c:\freepascal\bin\i386-win32;$(LazarusDir)
917916make
918917```
919918
920919- Win9x: use make OPT="-dWIN9XPLATFORM" (Lazarus trunk (and upcoming 1.4)) otherwise the lazarus.exe will not be able to run on this platform.
921920
922921If this works, you can type: lazarus.exe.
923922
924923You can compile examples also:
925924
926925```dos
927926cd /d $(LazarusDir)\examples
928927make
929928```
930929
931-<s>If you extracted lazarus to another drive, eg.: d:\lazarus, tt can happen that you need the gnu make 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>
930+If you extracted lazarus to another drive, eg.: d:\lazarus, tt can happen that you need the gnu make 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:\\
932931
933932#### Установка из исходных файлов с использованием стабильной версии
934933
935934An alternative version of the instructions above.
936935
9379361\> First of all install the latest stable Lazarus to obtain a good starting FPC, for example in C:\lazarus_1_4
938937
9399382\> Now use TortoiseSVN to checkout <http://svn.freepascal.org/svn/lazarus/trunk/> into c:\lazarus
940939
9419403\> Make the following C:\lazarus\build.bat file:
942941
943942Replace \$(LazarusDir) with your Lazarus did and make sure the FPC version number matches
944943
945944```dos
946945SET PATH=$(LazarusDir)\fpc\2.6.4\bin\i386-win32\
947946make bigide
948947```
949948
950949Now create a shortcut in your desktop to start Lazarus and put the following command to start Lazarus which will make sure that it separates the config files from the stable and the SVN versions:
951950
952951```dos
953952$(LazarusDir)\startlazarus.exe --pcp=$(LazarusDir)\configdir
954953```
955954
956955Always start Lazarus from this shortcut, never directly from the executable. At the first time you start Lazarus configure you FPC dir, FPC sources dir and Lazarus dir.
957956
958957#### Сборка Lazarus в Win98 и WinME
959958
960959Так как среда разработки Lazarus по умолчанию вызывает функцию "CreateToolhelp32Snapshot", которая отсутствует на платформе Win9x, IDE не запустится в Win9x "из коробки".
961960
962961Для того, чтобы сделать это запустите пересборку IDE Lazarus с ключом "-dWIN9XPLATFORM".
963962
964963### Установка Lazarus в FreeBSD
965964
966965Следующие инструкции относятся только для версии FreeBSD 9 и выше.
967966
968967#### via Ports tree
969968
970969The latest version of Lazarus available in the FreeBSD port tree, is v 1.6.4 We can use that to install Lazarus.
971970
972971``` bash
973972[]# cd /usr/ports/editors/lazarus && make install clean clean-depends
974973```
975974
976975If you start Lazarus IDE and you get a messages about missing source files, then go to **Environment - Environment Options - Files Tab: FPC source library** and enter the directory of the FPC source files. It can be obtained from /usr/ports/distfiles/freepascal
977976
978977#### via pkgng
979978
980979``` bash
981980[]# pkg install editors/lazarus
982981```
983982
984983At this point Lazarus might complain about missing source files. If you don't have them:-
985984
986985` mkdir /usr/ports/distfiles`\
987986` mkdir /usr/ports/distfiles/freepscal`\
988987` cd /usr/ports/distfiles/freepascal`\
989988` wget `[`http://distcache.freebsd.org/ports-distfiles/freepascal/fpc-3.0.2.source.tar.gz`](http://distcache.freebsd.org/ports-distfiles/freepascal/fpc-3.0.2.source.tar.gz)\
990989` tar xvfz fpc-3.0.2.source.tar.gz`
991990
992991Change the 3.0.2 to whatever version of fpc you have installed. Then go to **Environment - Environment Options - Files Tab: FPC source library** and enter
993992
994993` /usr/ports/distfiles/freepascal/fpc-3.0.2`
995994
996995If when you try to compile something you get this error
997996
998997` Error: resource compiler "fpcres" not found, switching to external mode`
999998
1000999Then you can install fpcres like this
10011000
10021001``` bash
10031002[]# pkg install lang/fpc-utils
10041003```
10051004
10061005#### via Lazarus repository
10071006
10081007This option will often be used if you want to follow Lazarus Trunk, a Fixes branch, or some other release (eg: compiling from a source tarball).
10091008
10101009- Use the SubVersion or Git repositories to checkout a copy of the source code you want, or unpack a downloaded source archive into a suitable location
10111010- The readme.txt file in Lazarus directory mentions 'make clean all'. This works if you are using Linux. Under FreeBSD 9.1 I had to replace 'make' with 'gmake'.
10121011
10131012` cd /patch/to/lazarus_source`\
10141013` gmake clean all`
10151014
10161015### Установка Lazarus в PC-BSD 1.0rc1+
10171016
10181017You can install Lazarus on PB-BSD by simply downloading the Lazarus PBI from [PBI Dir](http://www.pbidir.com/)
10191018
10201019Note 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.
10211020
10221021**\[other OpenBSD/NetBSD/DragonFlyBSD goes here\]**
10231022
10241023### Установка Lazarus в macOS
10251024
10261025See [[Installing Lazarus on macOS]].
10271026
10281027### Установка Lazarus в Haiku
10291028
10301029Lazarus requires Qt under Haiku. Qt is not installed by default under Haiku. You need to install package available from this site : <http://qt-haiku.ru/>
10311030
10321031Currently, there is no binary package to install Lazarus.
10331032
10341033You will have to compile Lazarus from sources.
10351034
10361035Detailed instructions to build Lazarus under Haiku are available here : [[Installing Lazarus on Haiku]]
10371036
10381037# Установка нескольких версий Lazarus
10391038
10401039Please see [[Multiple Lazarus]] for details on having more than one Lazarus version installed on one system. We cover issues that can arise due to multiple Lazarus installs here, because they can also happen when installing over a previous version.
10411040
10421041# Устранение проблем
10431042
10441043These hints should (hopefully) be applicable across platforms; please adjust paths etc. according to your platform. Also, problems and solutions might be mentioned in the [[Lazarus Faq]].
10451044
10461045## Isolating the component
10471046
10481047There may be multiple problems when installing Free Pascal and Lazarus. If you have problems with starting Lazarus or compiling with it, first make sure your underlying FPC installation works, e.g. by trying to compile a simple example program.
10491048
10501049## Расположение установленных компонентов
10511050
10521051On Linux/Unix/macOS, package/distribution provided installations will often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib, and probably the configuration in /etc/fpc.cfg Source (Subversion) downloads often install in /usr/local/bin (libraries in /usr/local/lib).
10531052
10541053## Отсутствие или повреждение файла fpc.cfg
10551054
10561055Файл fpc.cfg является файлом настроек FPC. В системе Windows его можно найти в директории с исполняемыми файлами компилятора fpc. On Unix/Linux/macOS, it is first searched in /etc/fpc.cfg, then Only some problems that often occur are covered. Please see the Free Pascal User's guide, e.g. chapter Compiler usage/configuration file for more details, including the search order for fpc.cfg
10571056
10581057Если его нет, FPC не скомпилирует вашу программу должным образом.
10591058
10601059### Автоматическое создание fpc.cfg
10611060
10621061Вы можете попытаться создать fpc.cfg с помощью специальной утилиты:
10631062
10641063```dos
10651064rem Измените путь к директории с исполняемыми файлами FPC
10661065cd /d C:\freepascal\fpc\2.4.5\bin\i386-win32
10671066rem Создание fpc.cfg; basepath - это "корневая" директория fpc
10681067fpcmkcfg -d basepath=C:\freepascal\fpc\2.4.5 -o .\fpc.cfg
10691068```
10701069
10711070> **Note:** earlier instructions had \bin\i386-win32 appended to the basepath. This is not needed since at least FPC 2.4.4.
10721071
10731072### Ручное создание fpc.cfg
10741073
10751074If the above doesn't work for you, you can copy/paste the code below to a new file named fpc.cfg to your fpc executable directory (or ~/.fpc.cfg or other location). Modify the paths so they match your situation.
10761075
10771076\$FPCVERSION is used to automatically determine the version of FPC being used for the compile. Using this variable allows this single fpc.cfg to be used with multiple fpc versions that have the same path structure making it easier to maintain multiple FPC installs.
10781077
10791078 #
10801079 # Config file generated by fpcmkcfg on 24/12/2010 - 18:17:42
10811080 # Example fpc.cfg for Free Pascal Compiler
10821081 #
10831082
10841083 # ----------------------
10851084 # Defines (preprocessor)
10861085 # ----------------------
10871086
10881087 #
10891088 # nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
10901089 #
10911090 # -d is the same as #DEFINE
10921091 # -u is the same as #UNDEF
10931092 #
10941093
10951094 #
10961095 # Some examples (for switches see below, and the -? helppages)
10971096 #
10981097 # Try compiling with the -dRELEASE or -dDEBUG on the commandline
10991098 #
11001099
11011100 # For a release compile with optimizes and strip debuginfo
11021101 #IFDEF RELEASE
11031102 -O2
11041103 -Xs
11051104 #WRITE Compiling Release Version
11061105 #ENDIF
11071106
11081107 # For a debug version compile with debuginfo and all codegeneration checks on
11091108 #IFDEF DEBUG
11101109 -glh
11111110 -Crtoi
11121111 #WRITE Compiling Debug Version
11131112 #ENDIF
11141113
11151114 # ----------------
11161115 # Parsing switches
11171116 # ----------------
11181117
11191118 # Pascal language mode
11201119 # -Mfpc free pascal dialect (default)
11211120 # -Mobjfpc switch some Delphi 2 extensions on
11221121 # -Mdelphi tries to be Delphi compatible
11231122 # -Mtp tries to be TP/BP 7.0 compatible
11241123 # -Mgpc tries to be gpc compatible
11251124 # -Mmacpas tries to be compatible to the macintosh pascal dialects
11261125 #
11271126 # Turn on Object Pascal extensions by default
11281127 #-Mobjfpc
11291128
11301129 # Assembler reader mode
11311130 # -Rdefault use default assembler
11321131 # -Ratt read AT&T style assembler
11331132 # -Rintel read Intel style assembler
11341133 #
11351134 # All assembler blocks are AT&T styled by default
11361135 #-Ratt
11371136
11381137 # Semantic checking
11391138 # -S2 same as -Mobjfpc
11401139 # -Sc supports operators like C (*=,+=,/= and -=)
11411140 # -Sa include assertion code.
11421141 # -Sd same as -Mdelphi
11431142 # -Se<x> compiler stops after the <x> errors (default is 1)
11441143 # -Sg allow LABEL and GOTO
11451144 # -Sh Use ansistrings
11461145 # -Si support C++ styled INLINE
11471146 # -SI<x> set interface style to <x>
11481147 # -SIcomCOM compatible interface (default)
11491148 # -SIcorbaCORBA compatible interface
11501149 # -Sm support macros like C (global)
11511150 # -So same as -Mtp
11521151 # -Sp same as -Mgpc
11531152 # -Ss constructor name must be init (destructor must be done)
11541153 #
11551154 # Allow goto, inline, C-operators, C-vars
11561155 -Sgic
11571156
11581157 # ---------------
11591158 # Code generation
11601159 # ---------------
11611160
11621161 # Uncomment the next line if you always want static/dynamic units by default
11631162 # (can be overruled with -CD, -CS at the commandline)
11641163 #-CS
11651164 #-CD
11661165
11671166 # Set the default heapsize to 8Mb
11681167 #-Ch8000000
11691168
11701169 # Set default codegeneration checks (iocheck, overflow, range, stack)
11711170 #-Ci
11721171 #-Co
11731172 #-Cr
11741173 #-Ct
11751174
11761175 # Optimizer switches for i386 compiler
11771176 # -Os generate smaller code
11781177 # -O1 level 1 optimizations (quick optimizations)
11791178 # -O2 level 2 optimizations (-O1 + slower optimizations)
11801179 # -O3 level 3 optimizations (same as -O2u)
11811180 # -Oa=N set alignment to N
11821181 # -OoX switch on optimalization X.
11831182 # -OoNOX switch off optimalization X.
11841183 # X is one of REGVAR UNCERTAIN STACKFRAME PEEPHOLE ASMCSE LOOPUNROLL
11851184 # -OpCPU set target processor.
11861185 # CPU is one of 386, PENTIUM, PENTIUM2, PENTIUM3, PENTIUM4, PENTIUMM
11871186
11881187 # -----------------------
11891188 # Set Filenames and Paths
11901189 # -----------------------
11911190
11921191 # Both slashes and backslashes are allowed in paths
11931192
11941193 # path to the messagefile, not necessary anymore but can be used to override
11951194 # the default language
11961195 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errore.msg
11971196 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errorn.msg
11981197 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errores.msg
11991198 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errord.msg
12001199 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errorr.msg
12011200
12021201 #IFDEF FPCAPACHE_1_13
12031202 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd13/
12041203 #ELSE
12051204 #IFDEF FPCAPACHE_2_0
12061205 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd20
12071206 #ELSE
12081207 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd22
12091208 #ENDIF
12101209 #ENDIF
12111210
12121211 # searchpath for units and other system dependent things
12131212 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/
12141213 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/*
12151214 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/rtl
12161215
12171216 # path to the gcclib
12181217
12191218 # searchpath for libraries
12201219 #-FlC:\freepascal\fpc\$FPCVERSION/lib
12211220 #-Fl/lib;/usr/lib
12221221
12231222 # searchpath for tools
12241223 -FDC:\freepascal\fpc\$FPCVERSION/bin/$FPCTARGET
12251224
12261225 #IFNDEF CPUI386
12271226 #IFNDEF CPUAMD64
12281227 #DEFINE NEEDCROSSBINUTILS
12291228 #ENDIF
12301229 #ENDIF
12311230
12321231 #IFNDEF Win32
12331232 #DEFINE NEEDCROSSBINUTILS
12341233 #ENDIF
12351234
12361235 # binutils prefix for cross compiling
12371236 #IFDEF FPC_CROSSCOMPILING
12381237 #IFDEF NEEDCROSSBINUTILS
12391238 -XP$FPCTARGET-
12401239 #ENDIF
12411240 #ENDIF
12421241
12431242 # -------------
12441243 # Linking
12451244 # -------------
12461245
12471246 # generate always debugging information for GDB (slows down the compiling
12481247 # process)
12491248 # -gc generate checks for pointers
12501249 # -gd use dbx
12511250 # -gg use gsym
12521251 # -gh use heap trace unit (for memory leak debugging)
12531252 # -gl use line info unit to show more info for backtraces
12541253 # -gv generates programs tracable with valgrind
12551254 # -gw generate dwarf debugging info
12561255 #
12571256 # Enable debuginfo and use the line info unit by default
12581257 #-gl
12591258
12601259 # always pass an option to the linker
12611260 #-k-s
12621261
12631262 # Always strip debuginfo from the executable
12641263 -Xs
12651264
12661265 # -------------
12671266 # Miscellaneous
12681267 # -------------
12691268
12701269 # Write always a nice FPC logo ;)
12711270 -l
12721271
12731272 # Verbosity
12741273 # e : Show errors (default) d : Show debug info
12751274 # w : Show warnings u : Show unit info
12761275 # n : Show notes t : Show tried/used files
12771276 # h : Show hints m : Show defined macros
12781277 # i : Show general info p : Show compiled procedures
12791278 # l : Show linenumbers c : Show conditionals
12801279 # a : Show everything 0 : Show nothing (except errors)
12811280 # b : Show all procedure r : Rhide/GCC compatibility mode
12821281 # declarations if an error x : Executable info (Win32 only)
12831282 # occurs
12841283 #
12851284 # Display Info, Warnings, Notes and Hints
12861285 -viwn
12871286 # If you don't want so much verbosity use
12881287 #-vw
12891288
12901289### Testing and batch file/shortcut usage
12911290
12921291You can also explicitly specify a fpc.cfg to use:\<bash\>fpc -n -@/path/to/fpc.cfg\</bash\>. Handy for testing, creating shortcuts/shell scripts, having multiple FPC installations etc.
12931292
12941293If that does not work, you can try to create fpc.cfg manually: copy over an existing fpc.cfg from a working installation and change the paths.
12951294
12961295## Mixing FPC versions
12971296
12981297If your FPC cannot find its sources/ppu files while fpc.cfg has the right paths, another cause could be that the fpc executable is a different version than the (link to) ppc\<architecture\> compiler.
12991298
13001299When compiling with fpc, fpc starts e.g ppc386 to compile for x86 targets. Please make sure fpc and ppc\<architecture\> are compiled by the same version/sourced from the same package.
13011300
13021301## Lazarus can't find sources
13031302
13041303There may be a message saying Lazarus 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 Free Pascal 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.
13051304
13061305## Пути к файлам в настройках Lazarus и проекта
13071306
13081307Учтите, что вы можете установить пути (для компилятора, модулей FPC и т.д.) в общих настройках параметров. Параметры, которые вы укажете в *Параметрах проекта*, могут переопределять параметры, используемые для каждого проекта. Если вы испытываете проблемы, связанные с путями в данном проекте, но не в других проектах, вам необходимо проверить, не ошиблись ли вы в переопределении параметров в общих настройках.
13091308
13101309# Установка старых версий
13111310
13121311Смотрите [[Installation hints for old versions]]
13131312
13141313---
13151314*From the Free Pascal wiki, page "Installing Lazarus/ru", as it stood on 2022-01-13 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).*
13161315Category: Russian (unfinished translation)

Back to history