Difference between revisions of "Installing Lazarus/sk"

From Lazarus wiki
Jump to navigationJump to search
Line 66: Line 66:
 
Lazarus Snapshot pre Windows nájdete aj na: http://www.ca.freepascal.org/Lazarus/
 
Lazarus Snapshot pre Windows nájdete aj na: http://www.ca.freepascal.org/Lazarus/
  
===Installing from source===
+
===Zdrojové súbory Lazarus===
 
Ak dávate prednosť inštalácii zo zdrojových kódov, postupujte podľa nasledujúcich inštrukcií
 
Ak dávate prednosť inštalácii zo zdrojových kódov, postupujte podľa nasledujúcich inštrukcií
* stiahnite zdrojové kódy Lazarus z ftp://ftp.freepascal.org/pub/pub/fpc/snapshot/lazarus/Lazarus.zip
+
* stiahnite zdrojové kódy Lazarus z ftp://ftp.freepascal.org/pub/fpc/snapshot/lazarus/lazarus.zip
 
* rozbaľte archív, napr. do c:\Lazarus.
 
* rozbaľte archív, napr. do c:\Lazarus.
 
* potrebujete mať nainštalovaný aspoň FreePascal-1.9.3, ktorým preložíte zdrojové kódy a Lazarus.exe pracuje.
 
* potrebujete mať nainštalovaný aspoň FreePascal-1.9.3, ktorým preložíte zdrojové kódy a Lazarus.exe pracuje.

Revision as of 12:58, 20 March 2005

Úvod

Pre tých, ktorí jednoducho chcú nainštalovať Lazarus a začať ho používať pre programovanie, je najjednoduchším prístupom stiahnuť a nainštalovať najnovšiu, podľa možností stabilnú, binárnu release (balíček ".exe").

Lazarus pozostáva z dvoch základných častí:

  • LCL - knižnica komponentov Lazarus (Lazarus Component Library)
  • IDE - Integrované vývojové prostredie

Tieto v podstate závisia na:

  • FreePascal – prekladač FreePascal
  • FCL – knižnica komponentov FreePascal (FreePascal Component library, obsahujúca väčšinu nevizuálnych komponentov použitých v Lazarus

Systémové požiadavky Lazarus

  1. prekladač FreePascal, balíčky a zdrojové kódy (*dôležité* rovnakej verzie/dátumu)
  2. podporovaný Widget tool-kit
  3. môže byť použité pôvodné Win32 API

FAQ - Najčastejšiekladené otázky sú dostupné na http://www.lazarus.freepascal.org . Niektoré z otázok môžete nájsť v lokálnom súbore 'FAQ'.

Inštalácia prekladača FreePascal

Rozsiahla diskusia o inštalácii a budovaní prekladačov FreePascal je dostupná na http://www.stack.nl/~marcov/buildfaq.pdf - pre niektorých užívateľov môže byť trochu detailná, ale je dostatočne vyčerpávajúca.

Lazarus vyžaduje FreePascal verzie 1.9.x a vyžaduje ako preložené knižnice FreePascal (binárne súbory), tak aj zdrojové kódy rovnakej verzie. FreePascal 1.0.6 je veľmi mladý a FreePascal 1.0.10 má problémy s otváraním formulárov vytvorených pomocou FreePascal 1.9.x.

Binárne súbory FPC pre Windows

Najjednoduchším spôsobom ako získať fungujúcu inštaláciu FreePascal je stiahnuť si aktuálnu release binárnych súborov Lazarus pre Windows zo SourceForge.net – release obsahuje aktuálnu verziu prekladača FreePascal a knižnice FreePascal, ako aj Lazarus IDE. Ak však chcete inštalovať zo zdrojových súborov, čítajte ďalej!

Inštalačný zip FreePascal 1.9.3 môžete získať v časti download na FreePascal. Popis inštalácie zo zdrojových súborov je v nasledujúcej časti, ale táto inštalácia nie je vhodná pre začiatočníkov, pretože potrebujete aj počiatočný prekladač.

Zdrojové kódy FPC pre Windows

Najjednoduchší spôsob ako získať zdrojové kódy FreePascal je pomocou CVS. Zdrojové kódy môžete tiež stiahnuť ako celý balíček – pozrite http://www.freepascal.org/develop.html, kde je strom dennej snímky release 1.9.x.

Zdrojové kódy FPC pomocou CVS

Na vykonanie nasledujúcich krokov budete potrebovať klienta CVS, napr. TortoiseCVS alebo WinCVS. Presné príkazy sa môžu medzi klientami meniť; nasledujúce sú pre použitie s klientom CVS home.

Najprv si vytvorte adresár, do ktorého radi umiestnili zdrojové súbory. (napr. c:\source), potom do príkazového riadku zadajte tieto príkazy:

 C:\Source> set CVSROOT=:pserver:cvs@cvs.freepascal.org:/FPC/CVS
 C:\Source> cvs login      // eslo je 'cvs' bez apostrofov
 C:\source> cvs -z3 co fpc // týmto vytvoríte adresár fpc, ktorý neskôr použijete v IDE.

Pre stiahnutie/aktualizáciu posledných zmien jednoducho zadajte:

 C:\> cd Source\FPC
 C:\Source\FPC> cvs -z3 update -dP

Pozrite si http://www.freepascal.org/down-win32.html Zoznam zrkadiel nájdete na http://www.freepascal.org/sdown.html. Stiahnute FreePascal ako jeden veľký súbor, rozbaľte ho a spusťte install.exe.

Do systémovej premennej PATH pridajte adresár

  • Win98: Upravte autoexec.bat pridaním riadku: PATH=%PATH%;C:\pp\bin\bin\win32
  • WinXP/2k: Tento počítač (pravý klik) -> Vlastnosti -> Spresnenie (stránka) -> Premenné prostredia -> Systémové premenné -> Upravte "PATH" pridaním "C:\pp\bin\bin\win32".

Potom reštartujte Windows.

Inštalácia Lazarus

Binárne súbory Lazarus

Aktuálna release binárnych balíčkov Lazarus pre Windows sa inštaluje veľmi jednoducho. Binárny balíček je dostupný z SourceForge.net

Stiahnite poslednú release a spusťte aplikáciu. Dostanete sa do typickej inštalácie Windows, v ktorej sú prekladač FreePascal a zdrojové knižnice nainštalované do rovnakej adresárovej štruktúry ako Lazarus a môžete spustiť IDE a pracovať bez väčších problémov, za predpokladu, že máte odinštalovanú predchádzajúcu verziu Lazarus a/alebo FreePascal (často v adresári C:\pp).

Lazarus Snapshot pre Windows nájdete aj na: http://www.ca.freepascal.org/Lazarus/

Zdrojové súbory Lazarus

Ak dávate prednosť inštalácii zo zdrojových kódov, postupujte podľa nasledujúcich inštrukcií

  • stiahnite zdrojové kódy Lazarus z ftp://ftp.freepascal.org/pub/fpc/snapshot/lazarus/lazarus.zip
  • rozbaľte archív, napr. do c:\Lazarus.
  • potrebujete mať nainštalovaný aspoň FreePascal-1.9.3, ktorým preložíte zdrojové kódy a Lazarus.exe pracuje.
  • cesta k môjmu (pôv. autorora) FreePascal je c:\pp\bin\win32. V tomto adresári nájdete viacero spustiteľných súborov (make, grep, ppc386 atď.).
  • otvorte konzolu (príkazový riadok) a zadajte:

Then unzip it to c:\lazarus for example. You have to install at least fpc-1.9.3. It compiles for me, and lazarus.exe works. The path to my fpc is: c:\pp\bin\win32. In this directory you can find a lot of exe (make, grep, ppc386, and so on).

Open a command line. Start->Run...>command or choose MS-DOS icon.

Type:

cd c:\lazarus
set path=c:\pp\bin\win32;c:\lazarus  //of course change the first to
                                     //the path of yours
windres -i lazarus.rc -o lazarus.res
make

If you are lucky then you can type: lazarus.exe. The source editor, dialogs and the property editor work, but not perfectly... Look and you will see.

You can compile examples also:

cd examples
make

If you extracted lazarus to another drive, eg.: d:\lazarus. It can happen that you need the gnu utility to make it. If you have it, you can take its path to set path=...;<gmakepath> but it is simpler not to choose drive d:\

That's all.

Additional experiences and advice on installing FPC and Lazarus

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

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

The rpm versions often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib.

If you perform a make install on a source version or use a .tar.gz, the compiler is usually installed in /usr/local/bin with the libraries in /usr/local/lib.

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

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

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

Try running the compiler from the command line using one of the simple example programs or one which you wrote yourself.

Turning to Lazarus:

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

make
./lazarus 

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

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

Many of the difficulties are dealt with in the Lazarus FAQ, found either on this WiKi site, or a more complete list on the main Lazarus site

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

From the top menu select Run -> Compiler Options (or Project -> Compiler Options in more recent releases of Lazarus) and select the Paths tab on the resulting dialog. There are several boxes for entry of paths for Unit files, Include files, Other source files, Libraries etc. For each of these, it is worth pressing the ... (ellipsis) button on the right, and you will be given a blank window for inserting path information, and a lower window giving some suggestions. Select as many as you like (or ALL!) and press the ADD button to transfer the selections to the upper window. When your selection is complete, press OK and move on to the next box. If you know of other paths which need to be followed, press the Browse button associated with each box, and insert the additional paths.

When you think you have got your paths right, try to compile your application. If there are further path-related errors ('can't find unit .......') then go back and check your paths, both in /etc/fpc.cfg and in your Run -> Compiler Options dialog (or Project -> Compiler Options depending on your version).

Once you have got the environment and PATHS correct, it is worth saving the settings to a file, otherwise you will have to go through this process for each new project. In the Run -> Compiler options dialog there is a Load/Save button; select this and then save the setings to the filename of your choice: mine is ~/FreePascal/default.cfg. Then each time I start a new project, I can go to the Run -> Compiler Options dialog (or Project -> Compiler Options), select Load/Save, and load my default.cfg file to the new project. You can, of course, modify the options for each new project if you so desire.

Original contributors and changes

This page has been converted from the epikwiki version.

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