- Установка Lazarus под Linux
- Предисловие
- Ссылки на ресурсы
- Установка
- Запуск Lazarus
- Сборка Lazarus
- Ошибки в ходе сборки Lazarus
- Заключение
- Установка Lazarus на Ubuntu
- Содержание
- Установка ключа
- Установка ключа через графический интерфейс
- Установка ключа из командной строки
- Подключение репозитория через графический интерфейс
- Подключение репозитория из командной строки
- Getting Lazarus/ru
- Contents
- Загрузка и установка релизной версии Lazarus
- Из SourceForge
- Конкретные для платформы
- Получение SVN клиента
- TortoiseSVN клиент
- Другие клиенты
- Получение Lazarus с сервера Subversion
- Версия Lazarus для разработчиков
- Исправленная ветка последней версии Lazarus
- Обновление исходников позже
- Сценарии
- Сборка и запуск Lazarus
- Использование командной строки
- Цели Make
- Помощь по make
- Параметры Make
- Версии разработчика из репозитория Git
- Просмотр исходников репозитория с помощью веб-браузера
- Распространение Lazarus
- Installing Lazarus on Linux
- Contents
- Introduction
- Required Linux packages
- Make a Choice
- The Package Manager Model
- FPC and Lazarus from SourceForge
- Build Lazarus from Source
- Get the Lazarus Source
- Menu items and Icons
- What does the BigIDE argument to make do?
- FPCUPdeluxe
- See Also
- Other Relevent Pages
- Testing FPC installation
Установка Lazarus под Linux
Костин Иван (shtorman@mail.ru)
Предисловие
В попытках установить и настроить Lazarus можно разбить лоб и сломать клавиатуру, но теперь можно обойтись и без членовредительства. Большинство материала по установке среды основывается на советах с форумов, а так же материалов на иностранном языке, статей же описывающих алгоритм установки и «тюнинга» единицы. После недели кропотливых трудов представляю Вам статью по установке среды разработки Lazarus и настройке русского языка в ней. Установка проводилась в ОС Mandriva 2008 LAR Edition из rpm-пакетов. Статья стала результатом прочтения таких статей как:
- Установка Lazarus и Free Pascal Compiler в Linux и Windows (26.08.2004 Смирнов Сергей)http://freepascal.ru/;
- Lazarus IDE(Ivan A-R 11.10.2006 16:51)http://iar.spb.ru/.
Ссылки на ресурсы
Установка
Перед установкой самой среды разработки Lazarus, необходимо установить следующие пакеты:
- fpc-2.2.0-0.i386.rpm — компилятора FPC;
- fpc-src-2.2.0-071105.i386.rpm – исходники FPC.
После этого можно запустить установку lazarus-0.9.24-0.i386.rpm. В ходе проверки зависимостей, инсталятор попросит доустановить еще несколько пакетов:
Все они есть на инсталяционном диске Mandriva 2008 LAR Edition.
В результате установки в Меню KDE, в разделе Разработка->Среды разработки, появиться пункт Lazarus.
Запуск Lazarus
При запуске в интерфейсе программы мы вместо названий пунктов меню наблюдаем иероглифы:
Рис. 1. Первый запуск среды Lazarus после установки.
В общем виде командная строка должна выглядеть так:
Теперь окно приложения выглядит более сносно, есть русский текст, но выполнять такие манипуляции каждый раз не очень удобно.
Рис. 2. Запуск среды Lazarus после установки языковой локалии в русский текст.
При дальнейшем рассмотрении все же не отображаются русские символы в заголовках форм, и в некоторых других формах самой среды попрежнему отображаются иероглифы.
Рис. 3. Проблемы с отображением русских символов в заголовке форм
Сборка Lazarus
Для решения этих проблем необходимо пересобрать Lazarus с поддержкой необходимого интерфейса (gtk, gtk2, win32/win64, qt, carbon . ).
Для этого открываем меню Интерфейс->Настройка сборки Lazarus
Рис. 4. Окно «Настройка сборки Lazarus»
Переключившись на вкладку «Расширенные параметры сборки» можно настроить то, что мы будем cобирать, а что нет, и с использованием какого интерфейса.
Рис.5. Вкладка «Расширенные параметры сборки»
Сборка Примеров не является жизненно важной для среды разработки в целом, но занимает время. Так, что сборку примеров можно отключить, если они понадобятся их можно будет собрать позднее. Здесь мы выбираем gtk 2 и отключаем Примеры (Action = None).
После чего нажимаем «Собрать».
Ошибки в ходе сборки Lazarus
В ходе сборки может возникнуть ошибка:
/usr/bin/ld: cannot find-lgdk_pixbuf-2.0
/usr/lib/lazarus/ide/lazarus.pp(114,1) Error: Error while linking
Для решения проблемы необходимо установить пакет libgdk_pixbuf2.0_0-devel, который потребует установку следующих пакетов:
В ходе сборки может возникнуть ошибка:
/usr/bin/ld: cannot find-lgtk-x11-2.0
/usr/lib/lazarus/ide/lazarus.pp(114,1)Error: Error while linking
Для решения проблемы необходимо установить пакет libgtk+2.0_0-devel, который потребует установку следующих пакетов:
Заключение
После удачной сборки Lazarus перезапуститься. Закройте приложение и запустите его самостоятельно из Меню КДЕ, Разработка->Среды разработки, пункт меню Lazarus.
Рис.6. Окно среды Lazarus после сборки с gtk 2.
Источник
Установка Lazarus на Ubuntu
Ставить Lazarus + Fpc лучше из репозитория сообщества freepascal так как основные репозитории Ubuntu обновляются реже и могут включать в себя не все пакеты.
Содержание
Установка ключа
Для подключения дополнительного репозитория сначала необходимо установить ключ. По этому ключу репозиторий будет опознан системой. (Что бы злобные хакеры не подсунули вредоносные пакеты 😉 )
Ключ к репозиторию freepascal находятся на сервере ключей pgp.mit.edu, и имеет идентификатор 6A11800F.
Установка ключа через графический интерфейс
- Заходим на сайт http://pgp.mit.edu
- В строке поиска набираем freepascal
- Из полученного списка выбираем 1024D/6A11800F 2007-08-16 Vincent Snijders (gpg key for lazarus ubuntu repository) (жмем левую кнопку мыши на идентификаторе ключа, а не на строке с описанием владельца)
- Копируем строки начиная с -----BEGIN PGP PUBLIC KEY BLOCK----- до -----END PGP PUBLIC KEY BLOCK----- включительно и сохраняем в файле с расширением key
- «Система» > «Администрирование» > «Менеджер пакетов Synaptic»
- В меню: «Настройки» > «Репозитории»
- В открывшемся окне вкладка «Аутентификация»
- Кнопка «Импортировать файл ключа»
- Выбираем сохраненный файл и жмем «ОК» — ключ появится в списке
Установка ключа из командной строки
Здесь все проще
Подключение репозитория через графический интерфейс
- «Система» > «Администрирование» > «Менеджер пакетов Synaptic»
- В меню: «Настройки» > «Репозитории»
- В открывшемся окне вкладка «Другое ПО»
- Кнопка «Добавить»
- Строка APT:
- Сохраним с помощью кнопки «Добавить источник»
- При закрытии окна «Источники предложений» Synaptic напомнит что необходимо обновить список пакетов. Жмем «ОК» и обновляем список (большая кнопка «Обновить» в левом верхнем углу).
Подключение репозитория из командной строки
В конец файла добавим
Сохраним файл, выйдем из редактора и обновим пакеты:
Источник
Getting Lazarus/ru
Contents
Загрузка и установка релизной версии Lazarus
Из SourceForge
Бинарные выпуски для различных платформ доступны через площадку Lazarus Sourceforge.
Для тех, у кого заблокирован SF, релизы Lazarus от Sourceforge отзеркалированы на:
Конкретные для платформы
Получить Lazarus для Windows — используйте ссылку Sourceforge выше.
Получение SVN клиента
TortoiseSVN клиент
Клиент TortoiseSVN предназначен только для Windows. Вы можете скачать его с http://tortoisesvn.tigris.org/.
Прим.перев.: На момент перевода статьи загрузить TortoiseSVN можно здесь. Также можно скачать и установить руссификаторы для x32 и x64 версии программы.
Приятным бонусом к руссификатору идет и русская справка в chm-формате
Эта страница демонстрирует, как загрузить и обновить исходный код Lazarus SVN, но таким же образом его можно использовать для исходного кода FPC.
Другие клиенты
Клиент командной строки SVN доступен на официальном SVN веб-сайте для многих платформ.
В Linux рекомендуется установить subversion, используя систему управления пакетами, предлагаемую вашим дистрибутивом. Например:
Получение Lazarus с сервера Subversion
Версия Lazarus для разработчиков
Чтобы получить Lazarus в первый раз, используйте командную строку:
Тогда в текущем каталоге создастся новый каталог «lazarus».
Исправленная ветка последней версии Lazarus
Это даст вам последний релиз плюс все коммиты с исправлением ошибок с тех пор. На момент написания статьи последний [стабильный] релиз 1.8.x.
Позже просто замените последнюю числовую часть номерами последней версии.
Обновление исходников позже
Откройте терминал/командную строку, перейдите в каталог lazarus и введите:
Используйте вышеупомянутые URL с другими клиентами SVN и обновляйте команды соответственно.
Чтобы скомпилировать среду, см. Сборка и запуск Lazarus.
Сценарии
Существуют скрипты для Windows и Linux для автоматизации загрузки и сборки Lazarus: Scripts for Lazarus
Сборка и запуск Lazarus
См. Installing Lazarus — подробное руководство по установке.
Использование командной строки
Lazarus поставляется с автоматически сгенерированным Makefile (с именем «Makefile») для утилиты gnu «make«.
Предупреждение: Если у вас также установлены инструменты Embarcadero (или Borland), их «make» может конфликтовать с gnu «make». В этом случае вы можете либо удалить или переименовать конфликтующий двоичный файл Embarcadero, либо удалить его каталог из Windows PATH, либо задать путь в консоли перед вызовом make:
make позволяет легко компилировать Lazarus из командной строки. Сначала вам нужно установить и настроить fpc и fpc-пакеты.
Для компиляции перейдите в каталог Lazarus в вашем терминале и наберите
Это должно пересобрать LCL и Lazarus IDE с установленными базовыми пакетами.
Еще одна полезная команда
, которая добавляет те же пакеты, что и в версии выпуска.
Затем вы можете запустить Lazarus из той же исходной директории с помощью команды «lazarus» (в системах Unix «./lazarus»).
Если вы хотите запустить несколько версий, вы можете настроить lazarus на использование определенных каталогов конфигурации с помощью параметра —pcp, например, :
Цели Make
Помощь по make
Чтобы просмотреть список доступных целей для make, наберите make help. Примечание: «make help» существует с [версии Лазаруса] 1.0. Вот вывод команды «make help«:
Параметры Make
Существуют дополнительные параметры, которые могут использоваться [утилитой] make Lazarus’а. Смотрите полностью рабочий пример выше.
%compiler_switches передается каждому вызову fpc. Опция полезна для уточнения установок
создает LCL и ide с предопределенным NoGdkPixBufLib и отладочной информацией dwarf2.
%platform является целью widgetset. Это может быть win32,wince,gtk,gtk2,qt,carbon,cocoa,customdrawn.
Пересобирает LCL и IDE с виджетом gtk2
% compiler_path — это путь + имя файла к пользовательскому двоичному файлу компилятора, с которым вы хотите создать цель.
Версии разработчика из репозитория Git
Git mirror официального хранилища SubVersion поддерживается на GitHub. Это зеркало синхронизируется каждые 15 минут с хранилищем SubVersion. Для получения дополнительной информации по скачиванию Git и клонированию репозитория Lazarus перейдите по этой ссылке: Git Mirrors. Вы также можете использовать git напрямую с сервером SubVersion, используя ссылку git-svn. Подробности смотрите в Lazarus git-svn.
Просмотр исходников репозитория с помощью веб-браузера
Содержимое архива SVN также можно просматривать с помощью веб-браузера через интерфейс this viewcvs .
Распространение Lazarus
Есть несколько неофициальных сайтов, где вы также можете найти Lazarus и Free Pascal:
- Дистрибутив getlazarus объединяет передовые версии Lazarus с простыми в использовании установочными сценариями для нескольких платформ и дополнительными компонентами.
- FreeSparta — коммерческий дистрибутив Lazarus для Windows.
- В Austrian University of Applied Sciences вы можете заполучить Ubuntu LiveCD, размещающемуся по этому адресу, а файл md5sum находится здесь.
- CodeTyphon включает Lazarus с дополнительными пакетами и компонентами.
- LiteZarus это дистрибутив Lazarus, предназначенный для разработки проектов, не относящихся к LCL.
- Lazarus доступен на компакт-дисках и USB-накопителях в магазине Blaise Pascal Magazine.
Источник
Installing Lazarus on Linux
Contents
Introduction
This page is about installing FPC and Lazarus on a Linux system. Its intended for new and ‘regular’ users, it does not cover some very advanced methods and concentrates on current releases. Linux users should think of FPC and Lazarus as being two distinct but related processes, FPC does not change much, on the other hand, you will probably want to update your Lazarus install or perhaps install multiple Lazarus versions. Mixing the install methods, especially after V2.0 may cause problems so please read carefully.
Notes about terms used on this page —
- We refer to various downloadable files such as fpc_something — you should replace the ‘something’ with whats appropriate for your system, for example, early 2019 using a DEB based 64bit distro it might be fpc-laz_3.0.4-1_amd64.deb. Mid 2021 lazarus-something.deb is lazarus-project_2.0.12-0_amd64.deb.
- Package Manager means a range of things on different different Linux systems. While we give command line examples, thats just because its easier to write. You will get the same result if you use your favourite GUI Tool such as Synaptic, Ubuntu Software Centre or YaST2. Maybe try double clicking on a downloaded package in your file manager.
- What ever Package manager tool you use, make sure you are using one that resolves dependencies (that is, it also installs thing that are required by the main package you are installing), most GUI apps do. You should avoid using tools like dpkg or rpm and instead use apt or yum depending on your flavour of Linux.
Required Linux packages
According to forum member «MarkMLl», required Debian packages for Lazarus are:
- build-essential
- gdb
- libgpm-dev (formerly libgpmg1-dev)
- libncurses5-dev
- libncursesw5-dev
Make a Choice
You do need to decide, early on, where you will be getting your Lazarus install from. You can, at any stage change your mind but at the cost of some backtracking. We don’t recomend you get your FPC and Lazarus install kits from different places, its sometimes possible but sometimes unreliable. Broadly, your choices are —
- Use your Package Manager to install both FPC and Lazarus. This means you are locked into the version of Lazarus that your distribution maintainers offer. Due to distro and Lazarus release cycles being out of sync, at any one time, its unlikely that your distribution will have the latest release of Lazarus. And many users do find those new releases attractive. You can install only one version of Lazarus under this model. But on the other hand, using the package manager approach is very easy and probably suits casual users.
- Use the pre compiled packages (both FPC and Lazarus) made available by the FPC/Lazarus Team at SourceForge. Here you will find a wide choice of matched versions but you can only install one version at a time. The install process is still very easy ! This is possibly the best bet for new users.
- Install FPC from either your Package Manager or SourceForge and then download the Lazarus source code and compile it yourself. May take a touch longer but is almost as easy and you do end up with the ability to add extra Lazarus installs, perhaps a ‘production’ version and a version based on the next release candidate. Or an old version to work on legacy code. In addition, you can easily make your own changes to the Lazarus Component Library, maybe just debug statements, maybe additional features you can feed back to help improve Lazarus further.
- Use FPCUPdeluxe — it can install a range of versions of both FPC and Lazarus for you without requiring you to understand the underlying structure.
The Package Manager Model
If you are happy with the versions offered by your distribution this might be the way to go. Almost all Linux distributions come with some sort of Package Manager, you are probably familiar with your’s. Between then, the DEB and RPM based package systems represent much of the Linux community. And if you soon run into the limitations of this model, your package manager will help you back out again. But first, check the version available. Look up ‘lazarus’ in your GUI Package Manager or do —
Note the names as well as the versions, we need three packages, fpc-something, fpc-source-something and, finally lazarus_something. Assuming you distribution’s package has its dependencies set up correctly, all you need do is choose to install Lazarus in either your Package Manage GUI or do:
- Some distro prepared packages do not include the tools necessary to add cross compiling to its capabilities. If you may want to cross compile in the future, please consider one of the next listed models.
- Some distro package managers break Lazarus up in small ‘chunks’, by default you get the GTK2 chunks. If you plan to use Qt5 also install libqt5pas-dev and lcl-qt5. You can make Qt5 apps using the GTK2 IDE.
- If you plan to work with GTK3, you will need to install libgtk-3-dev, its not declared as a dependency of Lazarus yet because the GTK3 interface is not, yet, complete.
FPC and Lazarus from SourceForge
If your Package Manager cannot offer you the correct version of FPC then SourceForge can ! But be prepared for your package manager to complain about being bypassed, just insist you know what you are doing !
All packages can be found at https://sourceforge.net/projects/lazarus/files/ , if you want just FPC, you will find it down in the corresponding Lazarus release directory.
Navigate down, select the appropriate packages, again, fpc_something, fpc-src_something and lazarus_something, save them locally and install. WARNING, very important, this catches many users out ! Like most Linux packages, these packages have dependencies, you must install using a tool that resolves dependencies. Commands like «dpkg -i fpc_something.deb» will, most definitely leave an incomplete installation !
Further, you will probably need to manually install at least gdb, the GNU debugger. Not absolutely essential but it makes life a lot easier. If you plan to work with GTK3, or Qt5 you will need to manually install libgtk-3-dev or libqt5pas-dev.
On a DEB based System. On a older DEB based system, you almost certainly should use gdebi to install any downloaded DEB. It might already be installed, if not, install it first. You can use gdebi at the command line or double click a downloaded package in your file manager. But remember, most important, install first fpc, then fpc-src, then and only then, Lazarus. On more recent deb based systems, the apt command can resolve dependencies, you could then use this command (but note the very important ./ in front of each deb file, if you don’t specify the exact location of your downloaded deb file, it will go and get the repository based one) —
mid 2021 for example, you might type (after downloading these files) —
On an RPM Based System Installing downloaded packages at the command line as shown below. (Author is unaware of the GUI Package tool that does, in fact, resolve dependancies) —
Note : later RPM based systems use the dnf command instead of yum, same syntax.
Build Lazarus from Source
Surprisingly easy, but that is because Lazarus routinely rebuilds itself, eg when a Lazarus package is added. So, its also a useful test that all required dependencies are really present. It allows you to have multiple versions of Lazarus installed (see —pcp=xxx) and both Lazarus and LCL are in your own disk space so no write issues. However, you will need to manually add an entry in your OS Menu system and, perhaps distinctive Lazarus icons.
Note: Remember, FPC and Lazarus are two, separate products. Before thinking about building Lazarus, you must have a working and tested FPC. Mid 2020 FPC 3.2.0 was released and its probably what you want. Some distributions may not have it for awhile so, you need to install it from one of the ways documented on https://wiki.lazarus.freepascal.org/Installing_the_Free_Pascal_Compiler#Linux
Note: Dependencies — you probably want to build the GTK2 version of Lazarus, most distros will have gtk2 preinstalled but you may need to install its dev libraries. So, install gdb, libx11-dev and libgtk2.0-dev, that will bring gtk2 itself along if necessary. If building a QT5 version, you will need libqt5pas-dev. If you are going to work with GTK3, you will need to install libgtk-3-dev
Note: Systems with limited memory, such as the Raspberry Pi may need you to increase swap space to at least a Gig before building Lazarus.
The example here pulls down what is a good choice in 2020, the newly released V2.0.10. By time you read this, it is possible a better option is available so please do your research. Note this is not a script, it is a series of commands, to be copied one at a time, so you can see whats happening !
Get the Lazarus Source
There are two different ways to download the Lazarus Source (since August 2021) from gitlab, infact there are several variations of each possible too) —
As a Zip/Tar ball.
If you just want a quick snapshot of trunk, or perhaps want to test the release candidate (and that a great idea) then you may not need access to the developer capabilities that a Git install provides. So, you don’t need any git tools on your local machine and its quick and easy. While you can do it through the Gitlab web interface from https://gitlab.com/freepascal.org/lazarus/lazarus its easier to describe with command line tools, start by cd-ing to a suitable place, I use $HOME/bin/Lazarus, then —
As a git (or svn) repository.
On the other hand, if you will be contributing patches, fixes, to Lazarus, or tracking down bugs by bisecting recent releases, then a proper git install is undoubtedly the way forward. You will need git installed locally, again, go to a suitable directory and —
This is a bit slower process the first time, later you will use git tools to update it and thats a lot faster.
You can now start Lazarus with the command ./lazarus or, if you are in another directory, something like —
You can add that directory to your path, put a script in
/bin to start it or whatever, its Linux, you choose ! Here is an example script to put in your bin directory —
Possible tags to download from gitlab using SVN
- Mid 2021 fixes : lazarus_2_2_0_RC1 the release candidate for next formal release.
- trunk, or as its now known, main. This is the default from gitlab
- Current stable — lazarus_2_0_12
You can see all these options, and lot more on the gitlab site by pulling down the dropbox.
Menu items and Icons
Building from source leaves you without the nice main menu entries and pretty icons that people who installed using packages get. But even that is easy to fix. You need two things, a suitable icon and an appropriate desktop file. Here is how —
First, download a Lazarus icon to use (its just an image, does not need to be from right version of Lazarus),
Then create a desktop file, eg
/.local/share/applications/lazarus.desktop that looks a bit like this
You will almost certainly have to change some things and might want to change more —
- Name= — This is what will appear in your main menu.
- Exec= — This is the path to your executable lazarus, in my case I keep my various installs in
/bin/Lazarus, yours may be different. Its unlikely your user name is ‘myusername’ so please change it. Note that I also include a —pcp command line switch, this tells Lazarus which set of config files to use. If you have multiple installs of Lazarus, make multiple desktop files and make sure each uses a separate set of config files. Most important ! You might like to point this item to the little bash script mentioned above, its an easy way of ensuring Lazarus gets the FPC path setting.
What does the BigIDE argument to make do?
The bigide make argument adds a bunch of packages to Lazarus that many find useful and cannot do without. The packages that are added are:
|
|
|
The above list is sourced from the [Lazarus source directory]/IDE/Makefile.fpc and may be subject to change.
Note that if you have not compiled your own Lazarus IDE with the bigide argument, you can install any of these packages yourself using the Lazarus IDE Package > Install/Uninstall Packages. dialog.
FPCUPdeluxe
Another approach is fpcupdeluxe, its an application that you run on your computer to manage your FPC / Lazarus install. Its very suited to people who just want to get a working install quickly and are happy to allow fpcupdeluxe to do the thinking for them.
See Also
Other Relevent Pages
- Installing_the_Free_Pascal_Compiler
- Generic Installing_Lazarus
- Install the help system, Installing_Help_in_the_IDE
- A number of useful additions but in particular Unit/Identifier Dictionary, Cody.
- Some useful tricks associated with the IDE IDE_tricks
Testing FPC installation
See Testing the FPC Install for a very simple test that FPC is working.
If that worked, well done ! Now proceed to installing Lazarus.
Источник