Sign in Join
Wiki copytemporary

Installing Lazarus/ru: what changed

Revision 2 to 3. 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
7171Запустите Linux и войдите в систему под **root**'ом.
7272
7373Загрузите актуальные версии файлов с <https://sourceforge.net/projects/lazarus/files/>. Например:
7474
7575:* fpc-3.0.4-1.i686.rpm
7676
7777:* fpc-src-3.0.4-1.i686.rpm
7878
7979:* lazarus-2.0.6-1.i686.rpm и установите их с помощью команды:
8080
8181:* rpm -Uvh *.rpm
8282
8383Пользователям системы Debian рекомендуется использовать deb-пакеты, но можно использовать и другие (внимание: они не создают fpc.cfg), например установить tar-архивы.
8484
8585#### Исходные файлы FPC
8686
8787Исходные файлы FPC хранятся в репозитории Subversion (SVN), в котором отслеживаются все изменения. Если у вас уже есть исходные файлы, пожалуйста, посмотрите инструкции по их установке в разделе #Installing Free Pascal from source under Linux/BSD.
8888
8989##### Загрузка ежедневных исходных файлов из ветки разработки
9090
9191Вы можете загрузить ежедневно обновляемые исходные файлы в форме упакованных ночных сборок из репозитория SVN: они обновляются ежедневно и отображают состояние исходных файлов. Они не протестированы, могут не работать или даже привести к нарушению работы вашей системы. Файлы сохранены на сайте, который содержит архив SVN. Версия FPC может варьироваться. Расположены по адресу: [1](http://www.hu.freepascal.org/lazarus/)
9292
9393##### Обновление исходных файлов с помощью SVN
9494
9595В качестве альтернативы ежедневным zip-файлам исходников SVN, репозиторий SVN сделан доступным для всех с доступом только для чтения. Это означает, что вы можете получить прямой доступ к коду, и у вас будут действительно доступные исходники на последний момент. Это также метод, который требует меньшей полосы пропускания после первой загрузки (извлечение в SVN lingo).
9696
9797##### Получение исходных файлов
9898
9999Как это можно сделать? Для начала вам необходим установленный клиент для SVN. Используйте менеджер установки и установите утилиту, например, TortoiseSVN для Windows или смотрите подробней на сайте [2](http://subversion.tigris.org/).
100100
101101Использование командной строки SVN: измените текущую директорию (cd) на родительскую директорию, которая используется для работы, например, чтобы получить полные исходные файлы из репозитория в поддиректорию fpc домашней директории и напишите
102102
103103``` bash
104104cd ~
105105svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
106106```
107107
108108Для обновления исходных файлов, загруженных с помощью команды, указанной выше
109109
110110``` bash
111111cd ~
112112svn update fpc
113113```
114114
115115##### Получение отдельных веток
116116
117117Если текущая версия транка находится в состоянии быстрого изменения и не подходит для большого использования, если вы не хотите работать с самим компилятором, вы можете остаться на версии, которая обновлена с исправлениями. Чтобы сделать это, вы должны найти стабильную ветку, которую вы хотите отслеживать, вместо девелоперской **trunk** версии по умолчанию. Пример ниже показывает, как вы можете отслеживать версию fixes_2_6; конечно замените \[номер версии\] по мере необходимости в зависимости от того, какие ветки вы хотите отслеживать.
118118
119119Этот пример хранит исправления в другой папке в вашем домашнем каталоге - не имеет смысла помещать две версии исходного кода в один каталог ...
120120
121121``` bash
122122cd ~
123123svn checkout http://svn.freepascal.org/svn/fpc/branches/fixes_2_6 fpc_fixes_2_6
124124```
125125
126126Обычное обновление:
127127
128128``` bash
129129cd ~
130130svn update fpc_fixes_2_6
131131```
132132
133133##### Документация
134134
135135Исходные файлы документации расположены в отдельном репозитории с именем fpcdocs, поэтому для их получения необходима следующая команда
136136
137137``` bash
138138cd ~
139139svn checkout http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs
140140```
141141
142142Если вы хотите больше узнать о subversion, прочитайте эту отличную [книгу по Subversion](http://svnbook.red-bean.com/), которая также бесплатно доступна в разных форматах.
143143
144144Более подробную информацию смотрите на [сайте Free Pascal](http://www.freepascal.org/develop.var).
145145
146146### Установка Free Pascal в Windows
147147
148148#### Исполняемые файлы FPC для Windows
149149
150150Самым простым способом получения установочных файлов Free Pascal является загрузка текущей стабильной версии исполняемых файлов Lazarus для Windows из репозитория SourceForge [3](http://sourceforge.net/projects/lazarus/files/) - эти файлы содержат текущие стабильные версии компилятора и необходимых библиотек Free Pascal, а также среду разработки Lazarus.
151151
152152Если вы хотите установить из исходных файлов читайте дальше!
153153
154154Вы можете загрузить zip-архив с fpc в разделе загрузок Free Pascal (перейдите по ссылке <http://www.freepascal.org/download.var> и далее выберите зеркало). Установка из исходных файлов -- смотрите следующий раздел, чтобы узнать как это сделать -- не для новичков, так как для этого вам необходим изначально установленный компилятор.
155155
156156#### Исходные файлы FPC для Windows
157157
158158\<\<\<\< Смотрите выше в разделе Исходные файлы FPC для Linux, где описано использование SVN \>\>\>\>
159159
160160Наиболее простым способом получить исходные файлы Free Pascal является использование SVN; смотрите следующий раздел для более подробной информации. Также вы можете загрузить установочный пакет целиком -- смотрите на сайте <http://www.freepascal.org/develop.var> ежедневные сборки ветки 3.0.x.
161161
162162Исходные файлы FPC для Windows с помощью SVN
163163
164164Вам необходим установленный SVN-клиент, например [TortoiseSVN](http://tortoisesvn.tigris.org/), для выполнения дальнейших шагов. Точные команды отличаются для разных SVN-клиентов; приведенные ниже команды должны использоваться для SVN-клиента, который можно скачать здесь.
165165
166166Для начала создайте директорию, в которую вы хотите поместить исходные файлы. С этим может справиться любой пользователь. Создайте директорию для fpc (например C:\Source), после чего чего выполните следующую команду в командной строке:
167167
168168``` bash
169169C:\Source> svn co http://svn.freepascal.org/svn/fpc/trunk fpc
170170```
171171
172172Совет: для загрузки/обновления файлов с последними изменениями вы просто можете выполнить
173173
174174```dos
175175C:\> cd Source\FPC
176176C:\Source\FPC> svn up
177177```
178178
179179Смотрите: <http://www.freepascal.org/down/i386/win32.var> . Загрузите FPC одним большим файлом, распакуйте его и запустите install.exe.
180180
181181Добавьте путь к директории fpc в переменную среды:
182182
183183- Win98: отредактируйте autoexec.bat и добавьте строку: PATH=%PATH%;C:\pp\bin\bin\win32
184184- WinXP/2k: Мой компьютер (правая кнопка мыши по ярлыку) -\> Свойства -\> Дополнительно (вкладка) -\> Переменные среды -\> Системные переменные -\> Изменить "PATH", добавить здесь "C:\pp\bin\bin\win32".
185185
186186После этого перезагрузите windows.
187187
188188После установки исполняемых файлов FPC вы можете собирать исходные файлы FPC из subversion.
189189
190190Советы:
191191
192192- Для Windows 7 (и выше) требуются повышенные права пользователя для работы в командной строке. Щелкните правой кнопкой мыши по ярлыку "Командная строка" в меню Пуск и выберите "Запустить от имени Администратора".
193193- 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 (смотрите выше, как прописать путь и изменить версию исполняемых файлов на только что скомпилированные).
194194
195195Инструкции:
196196
197197- В командной строке перейдите к расположенным исходным файлам FPC, например напишите "cd c:\Developer\FPC"
198198- Для сборки FPC напишите "make all"
199199- Для перезаписи существующих файлов FPC напишите "make install PREFIX=YOUR-PREFIX"
200200- Для установки исходных файлов напишите "make install sourceinstall PREFIX=YOUR-PREFIX"
201201
202202#### Компиляция/установка FPC и Lazarus из исходных файлов с помощью SVN (Win32)
203203
20420414 Dec 2017 версия FPC **3.0.4** или **trunk** - версия Lazarus **1.9.x**
205205
206206##### Шаг \#1: Создать каталоги и скачать исходные файлы
207207
208208Создайте следующие каталоги:
209209
210-` c:\freepascal\`\
211-` c:\freepascal\binutils\`\
212-` c:\freepascal\binutils\i386-win32\`\
213-` c:\freepascal\fpc\`\
214-` c:\freepascal\fpc\3.0.4\`\
215-` c:\freepascal\laz\`
210+```text
211+ c:\freepascal\
212+ c:\freepascal\binutils\
213+ c:\freepascal\binutils\i386-win32\
214+ c:\freepascal\fpc\
215+ c:\freepascal\fpc\3.0.4\
216+ c:\freepascal\laz\
217+```
216218
217219или для fpc из trunk:
218220
219-` c:\freepascal\`\
220-` c:\freepascal\binutils\`\
221-` c:\freepascal\binutils\i386-win32\`\
222-` c:\freepascal\fpc\`\
223-` c:\freepascal\fpc\trunk\`\
224-` c:\freepascal\laz\`
221+```text
222+ c:\freepascal\
223+ c:\freepascal\binutils\
224+ c:\freepascal\binutils\i386-win32\
225+ c:\freepascal\fpc\
226+ c:\freepascal\fpc\trunk\
227+ c:\freepascal\laz\
228+```
225229
226230Вам понадобится последняя *стабильная* версия компилятора для сборки новой версии компилятора. Скачайте файл ppc386 (сам компилятор) с FTP (по ссылке ниже) и распакуйте его в c:\freepascal\binutils\\
227231
228-` `[`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)
232+```text
233+ ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/bootstrap/i386-win32-ppc386.zip
234+```
229235
230236После установки [TortoiseSVN](http://tortoisesvn.tigris.org/) скачайте исходные файлы из SVN используя URL-адрес для каждого каталога:
231237
232-` Dir: c:\freepascal\binutils\i386-win32\`\
233-` 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)
238+```text
239+ Dir: c:\freepascal\binutils\i386-win32\
240+ URL: http://svn.freepascal.org/svn/fpcbuild/branches/fixes_3_0/install/binw32
241+```
234242
235243или для fpc из trunk:
236244
237-` Dir: c:\freepascal\binutils\i386-win32\`\
238-` URL: `[`http://svn.freepascal.org/svn/fpcbuild/trunk/install/binw32`](http://svn.freepascal.org/svn/fpcbuild/trunk/install/binw32)
245+```text
246+ Dir: c:\freepascal\binutils\i386-win32\
247+ URL: http://svn.freepascal.org/svn/fpcbuild/trunk/install/binw32
248+```
239249
240-` Dir: c:\freepascal\fpc\3.0.4`\
241-` URL: `[`http://svn.freepascal.org/svn/fpc/branches/fixes_3_0/`](http://svn.freepascal.org/svn/fpc/branches/fixes_3_0/)
250+```text
251+ Dir: c:\freepascal\fpc\3.0.4
252+ URL: http://svn.freepascal.org/svn/fpc/branches/fixes_3_0/
253+```
242254
243255или для fpc из trunk:
244256
245-` Dir: c:\freepascal\fpc\trunk`\
246-` URL: `[`http://svn.freepascal.org/svn/fpc/trunk/`](http://svn.freepascal.org/svn/fpc/trunk/)
257+```text
258+ Dir: c:\freepascal\fpc\trunk
259+ URL: http://svn.freepascal.org/svn/fpc/trunk/
260+```
247261
248-` Dir: c:\freepascal\laz`\
249-` URL: `[`http://svn.freepascal.org/svn/lazarus/trunk`](http://svn.freepascal.org/svn/lazarus/trunk)
262+```text
263+ Dir: c:\freepascal\laz
264+ URL: http://svn.freepascal.org/svn/lazarus/trunk
265+```
250266
251267##### Шаг \#2: Создать BAT-файл для компиляции FPC
252268
253269После того, как всё скачалось, нам необходимо создать BAT-файл для компиляции исходных файлов FPC. Создайте новый файл c:\freepascal\makefpc.bat и скопируйте в него следующий сценарий:
254270
255271```dos
256272@echo on
257273set myroot=c:\freepascal
258274set myFPC=%myroot%\fpc\3.0.4
259275set mybinutils=%myroot%\binutils
260276set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
261277cd %myFPC%
262278rd /s /q %myfpc%\examples
263279svn cleanup . --remove-unversioned --remove-ignored
264280make distclean all install INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
265281cd /d %myFPC%\bin\i386-win32
266282fpcmkcfg -d basepath=%myFPC% -o .\fpc.cfg
267283copy fpc.exe %mybinutils%\i386-win32
268284```
269285
270286или для fpc из trunk:
271287
272288```dos
273289@echo on
274290set myroot=c:\freepascal
275291set myFPC=%myroot%\fpc\trunk
276292set mybinutils=%myroot%\binutils
277293set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
278294cd %myFPC%
279295rd /s /q %myfpc%\examples
280296svn cleanup . --remove-unversioned --remove-ignored
281297make distclean all install INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
282298cd /d %myFPC%\bin\i386-win32
283299del fpc.cfg
284300fpcmkcfg -d basepath=%myFPC% -o .\fpc.cfg
285301copy fpc.exe %mybinutils%\i386-win32
286302```
287303
288304Для компиляции кросс-платформенных программ в режиме x86_64 добавьте следующие строки после первой команды make:
289305
290306```dos
291307make all OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
292308make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
293309```
294310
295311При использовании данных сценариев скомпилированные файлы компилятора и необходимые директории для корректной его работы будут созданы непосредственно в корневой директории, куда были загружены исходные файлы. В некоторых случаях это не удобно, например, если необходимо *перенести* всю директорию с компилятором на другой компьютер или просто сделать несколько директорий разных версий (или ревизий) компилятора и при необходимости пользоваться каждой из них путем выбора нужного пути в свойствах проекта. Для этого необходимо модифицировать сценарий. Ниже представлен пример сценария для создания полностью автономной директории с компилятором и необходимыми файлами (для универсальности добавлены инструкции, позволяющие собрать компилятор версий **x86** и **x64**):
296312
297313```dos
298314@echo on
299315set myroot=c:\freepascal
300316
301317set instdir=%myroot%\fpc\3.0.5
302318
303319set myFPC=%myroot%\fpc\3.0.4
304320set mybinutils=%myroot%\binutils
305321set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
306322cd %myFPC%
307323rd /s /q %myfpc%\examples
308324svn cleanup . --remove-unversioned --remove-ignored
309325make distclean all install INSTALL_PREFIX=%instdir% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
310326make all OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%instdir% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
311327make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%instdir% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
312328cd /d %instdir%\bin\i386-win32
313329fpcmkcfg -d basepath=%instdir% -o .\fpc.cfg
314330copy fpc.exe %mybinutils%\i386-win32
315331
316332xcopy %myFPC%\rtl %instdir%\source\rtl /H /Y /C /R /S /I
317333xcopy %myFPC%\packages %instdir%\source\packages /H /Y /C /R /S /I
318334```
319335
320336В данном случае дополнительная переменная **instdir** задает новую директорию для компилятора. Последние 2 команды предназначены для копирования содержимого директорий **rtl** и **packages** в новую директорию компилятора.
321337
322338Совет: при переносе в другое место полученной директории для корректной работы компилятора необходимо отредактировать файл **fpc.cfg**.
323339
324340##### Шаг \#3: Собрать и установить FPC
325341
326342С помощью командной строки (cmd.exe) перейдите в директорию c:\freepascal и выполните сценарий, который мы только что написали:
327343
328344```dos
329345cd /d c:\freepascal
330346makefpc.bat
331347```
332348
333349##### Шаг \#4: Создать BAT-файл для компиляции Lazarus
334350
335351Если Lazarus компилируется впервые, создайте новый файл c:\freepascal\makelaz.bat и скопируйте в него следующий сценарий:
336352
337353```dos
338354set myroot=c:\freepascal
339355set myFPC=%myroot%\fpc\3.0.4
340356set mybinutils=%myroot%\binutils
341357set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
342358cd %myroot%\laz
343359make clean all OPT="-glw2 -Xg"
344360```
345361
346362или для fpc из trunk:
347363
348364```dos
349365set myroot=c:\freepascal
350366set myFPC=%myroot%\fpc\trunk
351367set mybinutils=%myroot%\binutils
352368set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
353369cd %myroot%\laz
354370make clean all OPT="-glw2 -Xg"
355371```
356372
357373Подсказка: данный BAT-файл необходимо использовать только для первой компиляции. В дальнейшем вы можете собирать Lazarus используя команду меню Tools \> Build Lazarus.
358374
359375##### Шаг \#5: Собрать Lazarus
360376
361377С помощью командной строки перейдите в директорию c:\freepascal и выполните сценарий: makelaz.bat
362378
363379Готово!
364380
365381### Установка Free Pascal в FreeBSD/auto
366382
367383Последняя коллекция портов для FreeBSD имеет версию 3.0.4 и находится в ports/lang/fpc. Но они разбросаны по более чем 96 пакетам (!) и исходный код может быть получен из /usr/ports/distfiles/freepascal.
368384
369385Данная команда может быть выполнена с правами администратора (из-под root'а).
370386
371387``` bash
372388[]# cd /usr/ports/lang/fpc && make install && make clean
373389```
374390
375391Другая возможность заключается в использовании portinstall.
376392
377393``` bash
378394[]# portinstall fpc
379395```
380396
381397Как только fpc установлен, вы можете проверить его работоспособность просто выполнив команду
382398
383399``` bash
384400[]$ fpc
385401```
386402
387403### Установка Free Pascal из исходных файлов в Linux/BSD
388404
389405Для эффективности вам нужно
390406
391407Если у вас есть файл со всеми исходниками FPC или обоих (FPC и Lazarus):
392408
3934091. напр., для fpc (последний снапшот на момент правки статьи) предпочтителен экспорт с [ftp](ftp://ftp.freepascal.org/fpc/snapshot/v33/) (без SVN/dirs).
3944102. снапшот исходника Lazarus.
395411
396412- начальный компилятор, последняя версия релиза (fpc 3.0.4 на момент правки статьи) является единственной гарантированной версией. Вы можете скачать загрузочный компилятор или использовать систему управления пакетами/программного обеспечения вашего дистрибутива, чтобы установить его
397413
398414Процесс сборки FPC:
399415
400416- Получить необходимые файлы (начиная с компилятора), исходный файл FPC или исходный svn-каталог
401417- При использовании исходных файлов FPC: extract/de-tgz в рабочий каталог
402418- Сборка: войдите в work/fpc/ и запустите
403419
404420``` bash
405421# можно использовать:
406422export MAKE=`which make` ; echo $MAKE
407423$MAKE all OPT='-gl' PP=/path/to/startingcompiler-name-ppc386
408424# $MAKE применяется в linux и gmake в BSD
409425# /path/to/ может быть пропущен, когда ppc386 прописан в путях поиска
410426```
411427
412428- Установка fpc. Снова \[заходим\] в work/fpc, запускаем
413429
414430``` bash
415431$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX
416432#заменяем PP=compiler/ppc386 на соответствующий компилятор, если это не Intel x86
417433#THEPREFIX= обычно это /usr/local или просто /usr (но, например, на NetBSD для портов это /usr/pkg)
418434```
419435
420436- Создаем симлинк:
421437
422438``` bash
423439ln -s $THEPREFIX/lib/fpc/3.0.0/ppc386 $THEPREFIX/bin/ppc386
424440```
425441
426442- Устанавливаем исходники:
427443
428444``` bash
429445$MAKE install sourceinstall PREFIX=$THEPREFIX
430446```
431447
432448- Создаем симлинк к исходникам по умолчанию для Lazarus:
433449
434450``` bash
435451ln -sf $THEPREFIX/share/src/3.0.0/fpc /usr/share/fpcsrc
436452```
437453
438454- Настраиваем файл конфигурации fpc.cfg:
439455
440456``` bash
441457$THEPREFIX/lib/fpc/3.0.0/samplecfg $THEPREFIX/lib/fpc/3.0.0 $ETCDIR
442458```
443459
444460- При желании можете проверить, выдает ли ppc386 -i (или какой-либо другой компилятор, используемый вашей архитектурой) \[какую-либо\] информацию, иначе будет предупреждение о том, что пользователю необходимо добавить \$PREFIX/bin в его текущий путь. Попробуйте скомпилировать программу с -viwn и посмотрите, не выдаст ли это ошибку.
445461
446462Примечание:
447463
448464- Если вам нужны списки пакетов fpcmake, вам нужно сгенерировать или предоставить их самостоятельно (\[с помощью\] порта или в дополнительном архиве) в любом случае, выполнить фиктивную установку в /tmp/pack и определить файлы, установленные с
449465 ``` bash
450466 find . >ll
451467 ```
452468
453469- \$THEPREFIX и \$ETCDIR должен \[иметь возможность\] быть настраиваемым пользователем. В противном случае локальная установка невозможна.
454470
455471- BSDHIER=1 для всех команд make действуют соглашения об иерархии BSD.
456472
457473### Установка Free Pascal в macOS
458474
459475См [[Installing Lazarus on macOS|Установка Lazarus на macOS]]
460476
461477## Установка Lazarus
462478
463479### Установка Lazarus в Linux
464480
465481#### Ubuntu / Debian
466482
467483Рекомендуется использовать установщик обновлений [[fpcup|fpcUP]] для начинающих пользователей Lazarus, который устанавливает FPC и Lazarus за один раз в единую структуру подкаталогов (~/development).
468484
469485------------------------------------------------------------------------
470486
471487(Прим.перев.: а еще лучше использовать форк этой утилиты [[fpcupdeluxe]] от [LongDirtyAnimAlf](https://github.com/LongDirtyAnimAlf), последний релиз которой всегда можно скачать [здесь](https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases))
472488
473489------------------------------------------------------------------------
474490
475491Чтобы получить текущую рабочую установку Lazarus, загрузите файлы .deb для Free Pascal и Lazarus из репозитория SourceForge. Вот как: [[Lazarus release version for Ubuntu|Получение Lazarus из нашего репозитория Ubuntu]].
476492
477493Обратите внимание, что установка из исходных кодов Ubuntu по умолчанию не приведет к установке Free Pascal Source Libraries - используйте метод выше.
478494
479495> **Note:** по крайней мере в Linux Ubuntu команда для запуска Lazarus из консоли - [[startlazarus]]. Иначе, если вы установили его из пакета Debian, у вас должен быть пункт меню Lazarus в разделе Application/Programming(«Приложение/Программирование»). (Проблема: существует неоднозначность с программой, также называемой "lazarus" из пакета "tct", доступного для Ubuntu).
480496
481497##### Простой способ сборки из deb-пакетов
482498
483499Самый простой способ получить текущую рабочую установку Lazarus - это загрузить свои собственные пакеты .deb, следуя инструкциям отсюда: [[How to setup a FPC and Lazarus Ubuntu repository|Как настроить хранилище FPC и Lazarus Ubuntu]]
484500
485501##### Установка с использованием rpms
486502
487503Следующим самым простым способом установки является установка RPM-пакетов для Free Pascal и Lazarus из репозитория SourceForge.
488504
489505Вам необходимо загрузить выбранные версии следующих компонентов:
490506
491507- компилятор (например, fpc-3.0.4-1.i686.rpm)
492508- исходный код библиотеки pascal (например, fpc-src-3.0.4-1.i686.rpm)
493509- Lazarus (например, lazarus-1.8.4-0.i686.rpm).
494510
495511Удалите старые пакеты:
496512
497513``` bash
498514rpm -ev lazarus
499515rpm -ev fpc
500516rpm -ev fpc-src
501517```
502518
503519Установите новые пакеты:
504520
505521``` bash
506522rpm -ivh fpc-*
507523rpm -ivh lazarus-*
508524```
509525
510526##### Установка на Raspbian Wheezy
511527
512528Raspbian - это специальная версия Debian для компьютера Raspberry Pi размером с кредитную карту. См. [[Lazarus on Raspberry Pi]] для получения детальной информации.
513529
514530#### Установка на Mandriva
515531
516532##### Lazarus 0.9.30 на Mandriva 2010.
517533
518534Установите как указано ниже, однако при компиляции программы вы можете получить два сообщения об ошибках, сообщающих, что вам не хватает pixbuf 2.0 и lgtk-x11-2.0. Чтобы исправить это, установите libdgk_pixbuf2.0_0-devel и libgtk + 2.0_0-devel из установщика программного обеспечения.
519535
520536#### Установка на Slackware
521537
522538##### Установка Lazarus на Slackware 13.0
523539
524540Нет реальной разницы от версий slackware 12.2 или 12.0, поэтому описанная ниже процедура должна работать точно так же.
525541
526542##### Установка Lazarus 0.9.30 для пользователей Slackware 12.0
527543
528544Это работало в Slackware-12.0 на компьютере Pentium-3:
529545
530546- Free Pascal Compiler (FPC) устанавливается в режиме SUPERUSER
531547- Lazarus устанавливается в режиме USER
532548- Компилятор FPC будет перекомпилирован
533549- Исходный код IDE Lazarus загружается с сервера SVN.
534550
535551-- Загружаем "fpc-2.4.2.i386-linux.tar" в папку пользователя и устанавливаем его. Переходим в эту папку и вводим:
536552
537553``` bash
538554bash-3.1$ tar -xvf fpc-2.4.2.i386-linux.tar
539555bash-3.1$ su
540556bash-3.1$ password:xxxxxx
541557bash-3.1# sh install.sh
542558...
543559(используем ответы по умолчанию для следующих 6 вопросов: нажимаем "Enter" 6 раз)
544560...
545561bash-3.1# exit
546562bash-3.2$ fpc
547563free pascal compiler version 2.4.2 [] for i386
548564Copyright (c) 2010 ...
549565...
550566...
551567```
552568
553569Вы установили компилятор. Возможно, вы захотите перекомпилировать его или нет, но в любом случае вам нужно будет загрузить исходный код в соответствии с требованиями IDE lazarus.
554570
555571-- загружаем "fpc-2.4.2.source.tar.gz" во временную папку. Если вы не хотите перекомпилировать исходный код, просто пропустите этот раздел. Если вы хотите запустить свою собственную скомпилированную версию FPC, просто введите:
556572
557573``` bash
558574bash-3.1$ tar -xvzf fpc-2.4.2.source.tar.gz
559575bash-3.1$ cd fpc-2.4.2
560576bash-3.1$ make clean all
561577bash-3.1$ su
562578bash-3.1$ password: xxxxxxxx
563579bash-3.1# make install
564580bash-3.1# exit
565581bash-3.1$ fpc
566582free pascal compiler version 2.4.2 [...] for i386
567583Copyright (c) 2010 ...
568584...
569585...
570586```
571587
572588Теперь у вас есть собственная скомпилированная версия.
573589
574590-- Редактор Lazarus IDE должен видеть исходный код FPC. Даже если вы не хотите перекомпилировать FPC, вам нужен его исходный код. Однако для экономии места я сохраняю только чистую (не скомпилированную) копию исходного кода. Я снова начинаю с файла "fpc-2.4.2.source.tar.gz" и копирую его в папку /usr/local/src/FPC:
575591
576592``` bash
577593bash-3.1$ su
578594bash-3.1$ password: xxxxxxxx
579595bash-3.1# cp fpc-2.4.2.source.tar.gz /usr/local/src/
580596bash-3.1# cd /usr/local/src/
581597bash-3.1# tar -xvzf fpc-2.4.2.source.tar.gz
582598bash-3.1# rm fpc-2.4.2.source.tar.gz
583599bash-3.1# exit
584600```
585601
586602Номер версии включен в название папки "fpc-2.4.2". Таким образом, я могу сохранить многие версии исходного кода компилятора и в конечном итоге переключаться между ними.
587603
588604-- 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:
589605
590606``` bash
591607bash-3.1$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus
592608```
593609
594610This is for the first time you load it. Next time you will only need to type:
595611
596612``` bash
597613bash-3.1$ svn update
598614```
599615
600616If you do not have SVN installed on your computer, here is how to get it quickly:
601617
602618--Download the two files: "subversion-1.4.6.tar.gz" and "subversion-deps-1.4.5.tar.gz" (or later versions). Type:
603619
604620``` bash
605621bash-3.1$ tar -xvzf subversion-1.4.6.tar.gz
606622bash-3.1$ tar -xvzf subversion-deps-1.4.6.tar.gz
607623bash-3.1$ cd subversion-1.4.6
608624bash-3.1$ ./configure
609625bash-3.1$ make
610626bash-3.1$ su
611627bash-3.1$ password:xxxxxx
612628bash-3.1# make install
613629bash-3.1$ exit
614630```
615631
616632-- At this point you have the folder "~/lazarus" containing the source code. You should compile it very simply:
617633
618-`  bash-3.1$ make clean all`
634+```text
635+ bash-3.1$ make clean all
636+```
619637
620638After a few minutes, the compiler stops:
621639
622640``` bash
623641...
624642...
625643Linking ../Lazbuild
626644987 linescompiled ...
627645make [2] leaving ...
628646make [1] leaving ...
629647bash-3.1$
630648```
631649
632650-- Just type:
633651
634652``` bash
635653bash-3.1$ ./lazarus
636654```
637655
638656WOW! 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".
639657
640658Voila!
641659
642660#### Установка на openSUSE
643661
644662##### Установка Lazarus 0.9.30 для пользователей openSUSE 11.1
645663
646664Free Pascal Compiler requires:\
647665\- Gnu binutils (gnu as, gnu ld, gnu make) These utils can be installed by:
648666
649667``` bash
650668zypper in -t pattern devel_basis
651669```
652670
653671Lazarus also requires these components: 1) glib2 devel 2) gtk2 devel
654672
655673**Important**: The lazarus rpm requires the gtk 2 version, not the version 1.2.
656674
657675These libraries can be installed by:
658676
659677``` bash
660678zypper -n install gtk2 glib2
661679```
662680
663681Download these binary files (RPM)
664682
665683:* fpc-2.4.2-0.i686.rpm (yes i686 and not i386)
666684
667685:* fpc-src-2.4.2-0.i686.rpm
668686
669687:* lazarus-0.9.30-0.i686.rpm
670688
671689install them opening a terminal session (mouse's right button -\> Menu: Open in terminal)
672690
673691``` bash
674692rpm -Uvh fpc-2.4.2-0.i686.rpm
675693rpm -Uvh fpc-src-2.4.2-0.i686.rpm
676694rpm -Uvh lazarus-0.9.30-0.i686.rpm
677695```
678696
679697#### Установка Lazarus 1.0.8 на Fedora Core 18
680698
681699After a fresh install of Fedora Core 18 **yum** is installed, but fails with an error messages.
682700
683701- Open **Software**, check for new software and update all packages.
684702- Reboot.
685703- Install packages **gtk2-devel**, **fpc** and **subversion**. Fedora Core 18 already has fpc 2.6.2.
686704- Open a Terminal and do
687705
688-`svn co svn+ssh://svn.freepascal.org/FPC/svn/lazarus/tags/lazarus_1_0_8 lazarus`\
689-`cd lazarus`\
690-`make bigide`\
691-`./lazarus`
706+```text
707+svn co svn+ssh://svn.freepascal.org/FPC/svn/lazarus/tags/lazarus_1_0_8 lazarus
708+cd lazarus
709+make bigide
710+./lazarus
711+```
692712
693713#### Установка Lazarus на Scientific Linux
694714
695715Scientific Linux is an RPM-based distribution focussing on science and research. See [[Scientific Linux]] for details.
696716
697717#### Установка из исходных файлов
698718
699719If 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.
700720
701721Here 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.
702722
703723> **Note:** In this example, fpc is installed in /opt. So when prompted **'Install prefix**', enter '/opt/fpc'.
704724
705725``` bash
706726#!/bin/sh
707727
708728#installing required packages
709729sudo apt-get install build-essential
710730sudo apt-get install libgtk2.0-dev
711731sudo apt-get install libgdk-pixbuf-dev
712732
713733#installing Free Pascal source
714734cd /opt
715735sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-src-2.4.2.source.tgz
716736sudo tar -xvf fpc-src-2.4.2.source.tgz
717737sudo mv fpc fpcsrc
718738
719739#installing Free Pascal
720740sudo mkdir fpc
721741cd fpc
722742sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-2.4.2.i686-linux.tar
723743sudo tar -xvf fpc-2.4.2.i686-linux.tar
724744echo "Enter '/opt/fpc' when prompted 'Install prefix'"
725745sudo sh install.sh
726746
727747#adding fpc path to the PATH
728748echo "#FPC PATH" >> ~/.bash_profile
729749echo "if [ -d /opt/fpc/bin ] ; then" >> ~/.bash_profile
730750echo PATH=/opt/fpc/bin:"${PATH}" >> ~/.bash_profile
731751echo "fi" >> ~/.bash_profile
732752
733753#installing Lazarus
734754cd ../
735755sudo wget http://nchc.dl.sourceforge.net/lazarus/lazarus-0.9.30-0.tar.gz
736756# sudo wget https://downloads.sourceforge.net/project/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%201.8.0RC5/lazarus-1.8.0-RC5.tar.gz
737757sudo tar -zxvf lazarus-0.9.30-0.tar.gz
738758PATH=/opt/fpc/bin:"${PATH}"
739759sudo chmod -R 777 lazarus
740760cd lazarus
741761make clean all
742762./lazarus
743763```
744764
745765> **Note:** You have to manually set fpc-src path in the Environmental Options.
746766
747767##### Загрузка исходных файлов Lazarus
748768
749769Both 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.
750770
751771Please note these instructions are for subversion.
752772
753773Lazarus does not need any special permissions, neither during installation nor at runtime.
754774
755775If 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.
756776
757777Now getting the sources
758778
759779``` bash
760780 svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus
761781```
762782
763783(replace the last lazarus with any other dir where you want to place your sources)
764784
765785On subsequent occasions, to update simply type
766786
767787``` bash
768788 svn update lazarus
769789```
770790
771791For more information on Subversion, see: <http://subversion.tigris.org/>
772792
773793##### Компиляция и запуск
774794
775795Whether you checkout from cvs or svn, the next step is:
776796
777797compile lazarus
778798
779799``` bash
780800 cd lazarus
781801 make (gmake on BSD)
782802```
783803
784804If fpc is installed correctly, the compilation should work without problems. If not, see FAQ.
785805
786806Start lazarus
787807
788808``` bash
789809 ./lazarus
790810```
791811
792812The 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.
793813
794814Check the paths
795815Use the IDE menu to go to
796816
797817
798818Environment -\> Environment Options -\> Files
799819
800820The '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'.
801821
802822See here for the documentation about this dialog: [[IDE Window: Environment Options|IDE Options]].
803823
804824Hint
805825
806826To update lazarus you can use
807827
808828``` bash
809829 svn update lazarus
810830```
811831
812832then for either update pathway:
813833
814834``` bash
815835 make clean all (gmake on BSD)
816836```
817837
818838This will rebuild lazarus and create an IDE without lazarus packages. To link your installed packages do **after** the above:
819839
820840``` bash
821841 ./lazbuild --build-ide=
822842```
823843
824844You 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]].
825845
826846#### Установка Lazarus в Debian GNU/Linux
827847
828848There 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\>.
829849
830850Note 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
831851
832852``` bash
833853dpkg -r <package name>
834854```
835855
836856without .deb extension. And then install the newest versions as described.
837857
838858### Установка Lazarus в Windows
839859
840860Текущие стабильные версии исполняемых файлов Lazarus для Windows устанавливаются очень легко и могут работать 'из коробки'.
841861
842862Исключение составляют Win98 и ME, для которых необходимо указывать специальный флаг при компиляции. Смотрите Установка из исходных файлов.
843863
844864#### Установка портативной версии Lazarus на USB-диск
845865
846866It 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.
847867
848868\<\< 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?
849869
850870A: 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:
851871
852872```dos
853873set THUMBDRIVE=%CD:~0,2%
854874```
855875
856876This 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:
857877
858878```dos
859879%SystemRoot%\system32\cmd.exe /k bin\setenv
860880```
861881
862882so 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.
863883
864884Also 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):
865885
866886```dos
867887copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
868888sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml
869889```
870890
871891So to use it, I would type at the command prompt of the USB drive:
872892
873893```dos
874894fixlaz G:
875895```
876896
877897if "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. \>\>
878898
879899The binary package is available for Linux and Windows from
880900
881901<http://sourceforge.net/project/showfiles.php?group_id=89339>
882902
883903Download 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).
884904
885905You can also use a Lazarus Snapshot. For download locations see [[Lazarus Snapshots Downloads]].
886906
887907Tip: 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.
888908
889909#### Установка из исходных файлов
890910
891911If you prefer to install from sources, then follow these instructions.
892912
893913Please note these instructions are for SubVersion.
894914
895915Open a command prompt window. Start-\>Run...\>CMD or choose MS-DOS icon. You will use this window to enter the commands below
896916
897917You 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)\].
898918
899919Or you use SVN (example for text mode SVN; adapt to GUI tools such as TortoiseSVN if you want to):
900920
901921``` bash
902922mkdir c:\lazarus
903923cd /d c:\lazarus
904924svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ c:\lazarus
905925```
906926
907927You 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).
908928
909929Type (replace \$(LazarusDir) with the path you have unzipped/checked out Lazarus; replace
910930
911931```dos
912932cd /d $(LazarusDir)
913933rem Of course change the first path variable to
914934rem the path of your FPC compiler
915935set path=c:\freepascal\bin\i386-win32;$(LazarusDir)
916936make
917937```
918938
919939- Win9x: use make OPT="-dWIN9XPLATFORM" (Lazarus trunk (and upcoming 1.4)) otherwise the lazarus.exe will not be able to run on this platform.
920940
921941If this works, you can type: lazarus.exe.
922942
923943You can compile examples also:
924944
925945```dos
926946cd /d $(LazarusDir)\examples
927947make
928948```
929949
930950If 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:\\
931951
932952#### Установка из исходных файлов с использованием стабильной версии
933953
934954An alternative version of the instructions above.
935955
9369561\> First of all install the latest stable Lazarus to obtain a good starting FPC, for example in C:\lazarus_1_4
937957
9389582\> Now use TortoiseSVN to checkout <http://svn.freepascal.org/svn/lazarus/trunk/> into c:\lazarus
939959
9409603\> Make the following C:\lazarus\build.bat file:
941961
942962Replace \$(LazarusDir) with your Lazarus did and make sure the FPC version number matches
943963
944964```dos
945965SET PATH=$(LazarusDir)\fpc\2.6.4\bin\i386-win32\
946966make bigide
947967```
948968
949969Now 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:
950970
951971```dos
952972$(LazarusDir)\startlazarus.exe --pcp=$(LazarusDir)\configdir
953973```
954974
955975Always 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.
956976
957977#### Сборка Lazarus в Win98 и WinME
958978
959979Так как среда разработки Lazarus по умолчанию вызывает функцию "CreateToolhelp32Snapshot", которая отсутствует на платформе Win9x, IDE не запустится в Win9x "из коробки".
960980
961981Для того, чтобы сделать это запустите пересборку IDE Lazarus с ключом "-dWIN9XPLATFORM".
962982
963983### Установка Lazarus в FreeBSD
964984
965985Следующие инструкции относятся только для версии FreeBSD 9 и выше.
966986
967987#### via Ports tree
968988
969989The latest version of Lazarus available in the FreeBSD port tree, is v 1.6.4 We can use that to install Lazarus.
970990
971991``` bash
972992[]# cd /usr/ports/editors/lazarus && make install clean clean-depends
973993```
974994
975995If 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
976996
977997#### via pkgng
978998
979999``` bash
9801000[]# pkg install editors/lazarus
9811001```
9821002
9831003At this point Lazarus might complain about missing source files. If you don't have them:-
9841004
985-` mkdir /usr/ports/distfiles`\
986-` mkdir /usr/ports/distfiles/freepscal`\
987-` cd /usr/ports/distfiles/freepascal`\
988-` 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)\
989-` tar xvfz fpc-3.0.2.source.tar.gz`
1005+```text
1006+ mkdir /usr/ports/distfiles
1007+ mkdir /usr/ports/distfiles/freepscal
1008+ cd /usr/ports/distfiles/freepascal
1009+ wget http://distcache.freebsd.org/ports-distfiles/freepascal/fpc-3.0.2.source.tar.gz
1010+ tar xvfz fpc-3.0.2.source.tar.gz
1011+```
9901012
9911013Change 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
9921014
993-` /usr/ports/distfiles/freepascal/fpc-3.0.2`
1015+```text
1016+ /usr/ports/distfiles/freepascal/fpc-3.0.2
1017+```
9941018
9951019If when you try to compile something you get this error
9961020
997-` Error: resource compiler "fpcres" not found, switching to external mode`
1021+```text
1022+ Error: resource compiler "fpcres" not found, switching to external mode
1023+```
9981024
9991025Then you can install fpcres like this
10001026
10011027``` bash
10021028[]# pkg install lang/fpc-utils
10031029```
10041030
10051031#### via Lazarus repository
10061032
10071033This 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).
10081034
10091035- 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
10101036- 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'.
10111037
1012-` cd /patch/to/lazarus_source`\
1013-` gmake clean all`
1038+```text
1039+ cd /patch/to/lazarus_source
1040+ gmake clean all
1041+```
10141042
10151043### Установка Lazarus в PC-BSD 1.0rc1+
10161044
10171045You can install Lazarus on PB-BSD by simply downloading the Lazarus PBI from [PBI Dir](http://www.pbidir.com/)
10181046
10191047Note 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.
10201048
10211049**\[other OpenBSD/NetBSD/DragonFlyBSD goes here\]**
10221050
10231051### Установка Lazarus в macOS
10241052
10251053See [[Installing Lazarus on macOS]].
10261054
10271055### Установка Lazarus в Haiku
10281056
10291057Lazarus 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/>
10301058
10311059Currently, there is no binary package to install Lazarus.
10321060
10331061You will have to compile Lazarus from sources.
10341062
10351063Detailed instructions to build Lazarus under Haiku are available here : [[Installing Lazarus on Haiku]]
10361064
10371065# Установка нескольких версий Lazarus
10381066
10391067Please 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.
10401068
10411069# Устранение проблем
10421070
10431071These 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]].
10441072
10451073## Isolating the component
10461074
10471075There 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.
10481076
10491077## Расположение установленных компонентов
10501078
10511079On 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).
10521080
10531081## Отсутствие или повреждение файла fpc.cfg
10541082
10551083Файл 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
10561084
10571085Если его нет, FPC не скомпилирует вашу программу должным образом.
10581086
10591087### Автоматическое создание fpc.cfg
10601088
10611089Вы можете попытаться создать fpc.cfg с помощью специальной утилиты:
10621090
10631091```dos
10641092rem Измените путь к директории с исполняемыми файлами FPC
10651093cd /d C:\freepascal\fpc\2.4.5\bin\i386-win32
10661094rem Создание fpc.cfg; basepath - это "корневая" директория fpc
10671095fpcmkcfg -d basepath=C:\freepascal\fpc\2.4.5 -o .\fpc.cfg
10681096```
10691097
10701098> **Note:** earlier instructions had \bin\i386-win32 appended to the basepath. This is not needed since at least FPC 2.4.4.
10711099
10721100### Ручное создание fpc.cfg
10731101
10741102If 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.
10751103
10761104\$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.
10771105
10781106 #
10791107 # Config file generated by fpcmkcfg on 24/12/2010 - 18:17:42
10801108 # Example fpc.cfg for Free Pascal Compiler
10811109 #
10821110
10831111 # ----------------------
10841112 # Defines (preprocessor)
10851113 # ----------------------
10861114
10871115 #
10881116 # nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
10891117 #
10901118 # -d is the same as #DEFINE
10911119 # -u is the same as #UNDEF
10921120 #
10931121
10941122 #
10951123 # Some examples (for switches see below, and the -? helppages)
10961124 #
10971125 # Try compiling with the -dRELEASE or -dDEBUG on the commandline
10981126 #
10991127
11001128 # For a release compile with optimizes and strip debuginfo
11011129 #IFDEF RELEASE
11021130 -O2
11031131 -Xs
11041132 #WRITE Compiling Release Version
11051133 #ENDIF
11061134
11071135 # For a debug version compile with debuginfo and all codegeneration checks on
11081136 #IFDEF DEBUG
11091137 -glh
11101138 -Crtoi
11111139 #WRITE Compiling Debug Version
11121140 #ENDIF
11131141
11141142 # ----------------
11151143 # Parsing switches
11161144 # ----------------
11171145
11181146 # Pascal language mode
11191147 # -Mfpc free pascal dialect (default)
11201148 # -Mobjfpc switch some Delphi 2 extensions on
11211149 # -Mdelphi tries to be Delphi compatible
11221150 # -Mtp tries to be TP/BP 7.0 compatible
11231151 # -Mgpc tries to be gpc compatible
11241152 # -Mmacpas tries to be compatible to the macintosh pascal dialects
11251153 #
11261154 # Turn on Object Pascal extensions by default
11271155 #-Mobjfpc
11281156
11291157 # Assembler reader mode
11301158 # -Rdefault use default assembler
11311159 # -Ratt read AT&T style assembler
11321160 # -Rintel read Intel style assembler
11331161 #
11341162 # All assembler blocks are AT&T styled by default
11351163 #-Ratt
11361164
11371165 # Semantic checking
11381166 # -S2 same as -Mobjfpc
11391167 # -Sc supports operators like C (*=,+=,/= and -=)
11401168 # -Sa include assertion code.
11411169 # -Sd same as -Mdelphi
11421170 # -Se<x> compiler stops after the <x> errors (default is 1)
11431171 # -Sg allow LABEL and GOTO
11441172 # -Sh Use ansistrings
11451173 # -Si support C++ styled INLINE
11461174 # -SI<x> set interface style to <x>
11471175 # -SIcomCOM compatible interface (default)
11481176 # -SIcorbaCORBA compatible interface
11491177 # -Sm support macros like C (global)
11501178 # -So same as -Mtp
11511179 # -Sp same as -Mgpc
11521180 # -Ss constructor name must be init (destructor must be done)
11531181 #
11541182 # Allow goto, inline, C-operators, C-vars
11551183 -Sgic
11561184
11571185 # ---------------
11581186 # Code generation
11591187 # ---------------
11601188
11611189 # Uncomment the next line if you always want static/dynamic units by default
11621190 # (can be overruled with -CD, -CS at the commandline)
11631191 #-CS
11641192 #-CD
11651193
11661194 # Set the default heapsize to 8Mb
11671195 #-Ch8000000
11681196
11691197 # Set default codegeneration checks (iocheck, overflow, range, stack)
11701198 #-Ci
11711199 #-Co
11721200 #-Cr
11731201 #-Ct
11741202
11751203 # Optimizer switches for i386 compiler
11761204 # -Os generate smaller code
11771205 # -O1 level 1 optimizations (quick optimizations)
11781206 # -O2 level 2 optimizations (-O1 + slower optimizations)
11791207 # -O3 level 3 optimizations (same as -O2u)
11801208 # -Oa=N set alignment to N
11811209 # -OoX switch on optimalization X.
11821210 # -OoNOX switch off optimalization X.
11831211 # X is one of REGVAR UNCERTAIN STACKFRAME PEEPHOLE ASMCSE LOOPUNROLL
11841212 # -OpCPU set target processor.
11851213 # CPU is one of 386, PENTIUM, PENTIUM2, PENTIUM3, PENTIUM4, PENTIUMM
11861214
11871215 # -----------------------
11881216 # Set Filenames and Paths
11891217 # -----------------------
11901218
11911219 # Both slashes and backslashes are allowed in paths
11921220
11931221 # path to the messagefile, not necessary anymore but can be used to override
11941222 # the default language
11951223 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errore.msg
11961224 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errorn.msg
11971225 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errores.msg
11981226 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errord.msg
11991227 #-FrC:\freepascal\fpc\$FPCVERSION/msg/errorr.msg
12001228
12011229 #IFDEF FPCAPACHE_1_13
12021230 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd13/
12031231 #ELSE
12041232 #IFDEF FPCAPACHE_2_0
12051233 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd20
12061234 #ELSE
12071235 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd22
12081236 #ENDIF
12091237 #ENDIF
12101238
12111239 # searchpath for units and other system dependent things
12121240 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/
12131241 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/*
12141242 -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/rtl
12151243
12161244 # path to the gcclib
12171245
12181246 # searchpath for libraries
12191247 #-FlC:\freepascal\fpc\$FPCVERSION/lib
12201248 #-Fl/lib;/usr/lib
12211249
12221250 # searchpath for tools
12231251 -FDC:\freepascal\fpc\$FPCVERSION/bin/$FPCTARGET
12241252
12251253 #IFNDEF CPUI386
12261254 #IFNDEF CPUAMD64
12271255 #DEFINE NEEDCROSSBINUTILS
12281256 #ENDIF
12291257 #ENDIF
12301258
12311259 #IFNDEF Win32
12321260 #DEFINE NEEDCROSSBINUTILS
12331261 #ENDIF
12341262
12351263 # binutils prefix for cross compiling
12361264 #IFDEF FPC_CROSSCOMPILING
12371265 #IFDEF NEEDCROSSBINUTILS
12381266 -XP$FPCTARGET-
12391267 #ENDIF
12401268 #ENDIF
12411269
12421270 # -------------
12431271 # Linking
12441272 # -------------
12451273
12461274 # generate always debugging information for GDB (slows down the compiling
12471275 # process)
12481276 # -gc generate checks for pointers
12491277 # -gd use dbx
12501278 # -gg use gsym
12511279 # -gh use heap trace unit (for memory leak debugging)
12521280 # -gl use line info unit to show more info for backtraces
12531281 # -gv generates programs tracable with valgrind
12541282 # -gw generate dwarf debugging info
12551283 #
12561284 # Enable debuginfo and use the line info unit by default
12571285 #-gl
12581286
12591287 # always pass an option to the linker
12601288 #-k-s
12611289
12621290 # Always strip debuginfo from the executable
12631291 -Xs
12641292
12651293 # -------------
12661294 # Miscellaneous
12671295 # -------------
12681296
12691297 # Write always a nice FPC logo ;)
12701298 -l
12711299
12721300 # Verbosity
12731301 # e : Show errors (default) d : Show debug info
12741302 # w : Show warnings u : Show unit info
12751303 # n : Show notes t : Show tried/used files
12761304 # h : Show hints m : Show defined macros
12771305 # i : Show general info p : Show compiled procedures
12781306 # l : Show linenumbers c : Show conditionals
12791307 # a : Show everything 0 : Show nothing (except errors)
12801308 # b : Show all procedure r : Rhide/GCC compatibility mode
12811309 # declarations if an error x : Executable info (Win32 only)
12821310 # occurs
12831311 #
12841312 # Display Info, Warnings, Notes and Hints
12851313 -viwn
12861314 # If you don't want so much verbosity use
12871315 #-vw
12881316
12891317### Testing and batch file/shortcut usage
12901318
12911319You 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.
12921320
12931321If 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.
12941322
12951323## Mixing FPC versions
12961324
12971325If 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.
12981326
12991327When 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.
13001328
13011329## Lazarus can't find sources
13021330
13031331There 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.
13041332
13051333## Пути к файлам в настройках Lazarus и проекта
13061334
13071335Учтите, что вы можете установить пути (для компилятора, модулей FPC и т.д.) в общих настройках параметров. Параметры, которые вы укажете в *Параметрах проекта*, могут переопределять параметры, используемые для каждого проекта. Если вы испытываете проблемы, связанные с путями в данном проекте, но не в других проектах, вам необходимо проверить, не ошиблись ли вы в переопределении параметров в общих настройках.
13081336
13091337# Установка старых версий
13101338
13111339Смотрите [[Installation hints for old versions]]
13121340
13131341---
13141342*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).*
13151343Category: Russian (unfinished translation)

Back to history