Difference between revisions of "Installing Lazarus/ja"
Line 478: | Line 478: | ||
=== Windows 環境での Lazarus のインストール === | === Windows 環境での Lazarus のインストール === | ||
− | Windows 版 Lazarus | + | Windows 版 Lazarus の現行バージョンのインストールは非常に簡単です。本体のハードディスク以外にもインストールできます。 |
+ | |||
+ | もし使用する Windows 上にソフトウェアをインストールすることが許されていないか、管理者権限がなくてインストールできないといった場合、256 MB 以上の USB ドライブに Lazarus/FPC パッケージをインストールして使用することも可能です。この場合、コンパイラや環境設定オプション、fpc.cfg ファイルなどで、パスの指定に注意する必要があります。また USB ドライブ上にテスト用のディレクトリを用意し、保持しておいた方がいいと思います。 | ||
+ | |||
+ | << 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? | ||
+ | |||
+ | A: 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: | ||
+ | set THUMBDRIVE=%CD:~0,2% | ||
+ | This 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: | ||
+ | %SystemRoot%\system32\cmd.exe /k bin\setenv | ||
+ | so 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. | ||
+ | |||
+ | Also inside the bin directory is [http://sed.sf.net sed] (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): | ||
+ | copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak | ||
+ | sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml | ||
+ | |||
+ | So to use it, I would type at the command prompt of the USB drive: | ||
+ | fixlaz G: | ||
+ | if "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. | ||
+ | >> | ||
− | |||
Linux 用、Windows 用のバイナリーパッケージは次の URL からダウンロードできます。 | Linux 用、Windows 用のバイナリーパッケージは次の URL からダウンロードできます。 | ||
Line 486: | Line 504: | ||
http://sourceforge.net/project/showfiles.php?group_id=89339 | http://sourceforge.net/project/showfiles.php?group_id=89339 | ||
− | 最新のリリースのもの(現在は Lazarus-0.9. | + | 最新のリリースのもの(現在は Lazarus-0.9.26-fpc-2.2.2-win32.exe)をダウンロードし、これを実行して下さい。 |
典型的な Windows インストールでインストールできます。以前のバージョンの Lazarus と FPC(多くの場合 c:\pp ディレクトリにあります)をアンインストールしておけば、特に致命的な問題もなく、FPC コンパイラとソースライブラリが Lazarus のディレクトリ構成と同じディレクトリの中にインストールされ、IDE が起動します。 | 典型的な Windows インストールでインストールできます。以前のバージョンの Lazarus と FPC(多くの場合 c:\pp ディレクトリにあります)をアンインストールしておけば、特に致命的な問題もなく、FPC コンパイラとソースライブラリが Lazarus のディレクトリ構成と同じディレクトリの中にインストールされ、IDE が起動します。 | ||
Line 493: | Line 511: | ||
==== ソースからのインストール ==== | ==== ソースからのインストール ==== | ||
− | + | もしソースからのインストールを行いたい場合、これらの説明を見て下さい (Thanks to Joe for the initial Step-by-step description) | |
まず、lazarus のソースを [[Lazarus Snapshots Downloads]] からダウンロードする必要があります: | まず、lazarus のソースを [[Lazarus Snapshots Downloads]] からダウンロードする必要があります: | ||
− | 次に、c:\lazarus などのディレクトリに解凍して下さい。なお、fpc-2. | + | 次に、c:\lazarus などのディレクトリに解凍して下さい。なお、fpc-2.2.2 をインストールしておく必要があります。fpc-2.3.1 のスナップショットでも構いません。 |
+ | 私はこのようにコンパイルして、lazarus.exe を実行しています。私の fpc のパスは c:\pp\bin\win32 です。このディレクトリには沢山の実行ファイル(make, grep, ppc386 など)が置かれています。 | ||
コマンドプロンプトを起動します。スタートメニュー->全てのプログラム->...->MS-DOS のアイコンのコマンドプロンプトを選択します。 | コマンドプロンプトを起動します。スタートメニュー->全てのプログラム->...->MS-DOS のアイコンのコマンドプロンプトを選択します。 |
Revision as of 11:10, 24 January 2009
│
Deutsch (de) │
English (en) │
español (es) │
suomi (fi) │
français (fr) │
magyar (hu) │
日本語 (ja) │
한국어 (ko) │
polski (pl) │
português (pt) │
русский (ru) │
slovenčina (sk) │
Tiếng Việt (vi) │
中文(中国大陆) (zh_CN) │
概要
すぐにでも Lazarus をインストールしプログラミングをはじめたい人たちのための、最も手軽な手法としては、 安定版としてリリースされている最新のバイナリーをダウンロードしてインストールすることです(Linux なら RPM パッケージ、Windows ならインストーラ、Mac OS X なら dmg パッケージなど)。Linux や Windows 環境のセクションにある“FPC バイナリ”と、Linux や Windows 環境への Lazarus のインストールのセクションの最初のパラグラフを読んでください:それ以外の箇所は読まなくても大丈夫です。 ただ、コンパイラや IDE の開発に参加しようとする方、最新のツールにアップデートしたい方は、ソースからのインストールが必要となり、残りの情報が関連してきます。
Lazarus は次の2つで構成されています。:
- LCL - Lazarus コンポーネントライブラリ
- IDE - RAD ツール(グラフィカルな開発統合環境)
下の略語は次のような意味です:
- FPC - FreePascal コンパイラ
- FCL - FreePascal コンパイラのライブラリ。Lazarus で使用するグラフィカルでないコンポーネントのほとんどが含まれています。
Lazarus システム要件
- FreePascal コンパイラ、パッケージ、ソースファイル。(*重要*: 同じバージョンで同じ日付のもの)
- ウィジェットツールキット
- Win32
- The native Win32 API can be used
- Linux/xxxBSD
- GTK+ 1.2.x : ほとんどの Linux ディストリビューションや *BSD(FreeBSDやNetBSDなど)はあらかじめ GTK+ 1.2.x ライブラリがインストールされています。またそれらは http://www.gtk.org から見つける事が出来ます。
また gdk-pixbuf についても 0.13 以降のもの(できれば 0.18 以降のもの)があった方がいいでしょう。これらは過去2年から最も新しいディストリビューションから探し出すことができます。ソースは ftp://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/ から入手することが出来ます。 - Mac OS X
- GTK+ 1.2.x : Apple のデベロッパーツール、X11、GTK1.2 が必要です。Mac OS X でのインストールの箇所を参照して下さい。
- GTK+ 2.x
- 注意 : (lazarus の)GTK インターフェースはまだコンパイルされておらず、まだテスト段階です。
最近のディストリビューションから見つける事が出来ます。ソースについては、http://www.gtk.org を参照して下さい。
The FAQ - FAQ(Frequently Asked Questions file:よくある質問) は http://www.lazarus.freepascal.org から参照できます。幾つかの質問はローカルファイルの'FAQ'から見つけることが出来ます。
以降のセクションは FreePascal の取得の方法と、Lazarus をどのように適切にインストールするかについて述べます。
Free Pascal コンパイラのインストール
この http://www.stack.nl/~marcov/buildfaq.pdf では、Free Pascal コンパイラをどのように構築し、どのようにインストールするかについて行われた膨大な議論を参照できます - これはおそらく何人かのユーザにはとても細かいことかもしれませんが、とても総合的なことです。
Lazarus は fpc (FreePascal) の 2.0.2 バージョン以降が必要ですが、さらに fpc ライブラリ(バイナリ)と同じバージョンの fpc ソースについても必要となります。
Linux 環境での Free Pascal のインストール
FPC バイナリ
FreePascal の最新版のリリースは version 2.2.2 です。これは FreePascal の Web サイト(http://www.freepascal.org/download.html, ミラーサイトを選択します) 、もしくは SourceForge (http://sourceforge.net/projects/lazarus) から入手す出来ます。
Lazarus のダウンロードセクション (http://www.lazarus.freepascal.org )では、パッケージ化された Free Pascal コンパイラ(linux用)の RPM や DEB ファイルを入手することが出来ます。もし RPM ベースのDebianディストリビューションでないのなら、 http://www.freepascal.org から tar ファイル(ソースファイル) をダウンロードしてインストールすることができます。もし、自分でコンパイルしたい方は、BSD のセクションを参照して下さい。
操作方法の説明: 注意: もし RPM を使っていないなら(もし alien を使う計画であるなら)、最善の方法は、最新の安定版の fpc (現時点では2.2.2)を入手し、ソースから Lazarus をインストールすることです。
Linux を起動し、root でログインしてください。
http://sourceforge.net/project/showfiles.php?group_id=89339 から最新のファイルを取得してください。(例)
* fpc-2.2.2-0.i386.rpm * fpc-src-2.2.2-081004.i386.rpm * lazarus-0.9.26-0.i386.rpm
次に、これらを下記のようにしてインストールします:
* rpm -Uvh fpc-2.2.2-0.i386.rpm * rpm -Uvh fpc-src-2.2.2-0.i386.rpm * rpm -Uvh lazarus-0.9.26-0.i386.rpm
Debian ユーザは alien もしくはソースからのインストールを行なう必要があります。 (注意:alien を使った場合、fpc.cfg は生成されません)
FPC ソース
バージョン2.0リリース版以降、FPC は Subversion(SVN)に移行しました。これは CVS ミラーを使用していません。FPC ソースを入手するには SVN を使用しなければなりません。
開発ツリーから 日次更新ソーススナップショットをダウンロードする(version 2.3.x)
SVN ソースリポジトリから、2.3.x 系の開発バージョンの今日の日次スナップショットをダウンロードできます: これらのスナップショットは基本的に毎日更新され、ソースリポジトリに反映されます。これらのファイルはSVNアーカイブとしてサイト内で保管されます。 v2.3.x の公開ソースのアーカイブ: fpc.zip (24 MB)
リリースツリーからの日次ソーススナップショットのダウンロード (version 2.2.x)
SVN ソースリポジトリから、2.2.x 系のリリースバージョンの今日の日次スナップショットをダウンロードできます: これらのスナップショットは基本的に毎日更新され、ソースリポジトリに反映されます。これらのファイルはSVNアーカイブとしてサイト内で保管されます。 v2.2.x の公開ソースのアーカイブfpc.zip (24 MB)
SVNのソースリポジトリへの接続 (CVS 接続のセクションから移動)
SVN ソースコードの zip ファイルの取得とは別の入手方法があります。SVN リポジトリへは、読み取り専用ですが誰でもアクセスできるようになっています。つまり、zip で圧縮されたものではなく、取得するタイミングの直前のコードを直接取得することができるということです。一度のダウンロードを行えば(SVN のコマンド checkout をすれば)、少ない帯域で取得ができるということでもあります。
Development snapshots
下に手順を述べます。 (当然、SVNをインストールしておく必要があります。一連のやり方については here を見てください)
開発に使用する領域の親ディレクトリに(cd コマンドで)移動してください。例えば次のようにします。
[]$ cd /home/username/FreePascal
全てのソースリポジトリ、全ての公開されたモジュールを取得するには、次のようにタイプします。
[]$ svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
普通はこのステップだけで済むはずです。
上述でダウンロードしたソースをアップデートする場合は次のようにします。
[]$svn update fpc
2.0.x への修正
修正を行なうには別のディレクトリを作成する必要があります。'fixes'という別のディレクトリを作成し、そこに移動します。そして修正用の URL http://svn.freepascal.org/svn/fpc/branches/fixes_2_0 を引数にして、上述のチェックアウトコマンドを実行します。
[]$ cd mysvn/fixes []$ svn checkout http://svn.freepascal.org/svn/fpc/branches/fixes_2_0 fpc
アップデートするには次のようにします:
[]$ svn update fpc
ドキュメントのソースは fpcdoc と呼ばれるリポジトリの方に置かれています。これは次のコマンドで入手できます。
[]$ svn checkout http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs
Subversion についてもっと学びたいのなら、フォーマットが異なるのですがオンラインで自由に読むことが可能な、すばらしい Subversion book を読んでください。
好奇心旺盛の方へ: 読み取り専用です。間違ってもコミットしようとしないように。
より多くの情報については、この Web サイトFreePascal をご覧下さい。
Windows 環境での Free Pascal のインストール
Windows 用 FPC バイナリ
Free Pascal を最も手軽にインストールする方法は、Sourceforge リポジトリから Lazarus のカレントバージョンの Windows バイナリインストーラをダウンロードすることです。このインストーラには、lazarus IDE だけでなくカレントバージョンの FreePascal コンパイラと FreePascal ライブラリが含まれています。 もしソースからのインストールを希望するなら、ここを読んでください!
Free Pascal のダウンロードセクション(http://www.freepascal.org/download.html, ここからミラーを選んでください)から fpc 2.2.2 の zip インストーラを入手できます。 ソースからのインストール -- 取得の方法について知りたいのなら次のセクションを見てください。初心者向きではありません。また始めるにはコンパイラが必要となります。
Windows 用 FPC ソース
<<<< 上述の Linux 用の FPC ソース を見て下さい。ここでは SVN の使い方について述べています >>>>
Fee Pascal のソースを取得するのに最も簡単な方法は、SVN を利用することです。これ以上については、次のセクションを見てください。パッケージの全てを取得することが出来ます -- 2.1.x デイリースナップショットのツリーについては http://www.freepascal.org/develop.html を見てください。
SVN を介した Windows 用の FPC ソースの取得
まず、TortoiseSVN のような SVN クライアントをインストールする必要があります。正確なコマンドは svn クライアントによって変わります。The exact commands vary between SVN clients; the ones given below are to be used under SVN home's client, which is available for download here.
まず、ソースを置く用のディレクトリを作成します。通常のユーザであればこれを実行するだけで構いません。fpc用のディレクトリ(例 c:\Source)を作成し、コマンドプロンプトで次のように実行します:
C:\Source> svn co http://svn.freepascal.org/svn/fpc/trunk fpc
ヒント: 最新の状態のものをダウンロード/アップデートしたいなら、次のようなシンプルな方法で出来ます
C:\> cd Source\FPC C:\Source\FPC> svn up
ToDo: Write me.
http://www.freepascal.org/down-win32.html を参照して下さい。http://www.freepascal.org/sdown.html ではミラーのリストを見つけることが出来ます。FPC は大きなファイルですが、これをダウンロードして、unzip で解凍し、install.exe を実行して下さい。
fpc ディレクトリにパスを通して下さい:
- Win98: autoexec.bat を編集し、PATH=%PATH%;C:\pp\bin\bin\win32 を加えて下さい
- WinXP/2k: マイコンピュータを右クリックし、プロパティー->詳細設定->環境変数を選択し、システム環境変数にある PATH の項目に、"C:\pp\bin\bin\win32" を追加して下さい
設定後、Windows を再起動します。
ToDo: Explain how to download fpc sources and build the compiler
FreeBSD 環境への Free Pascal のインストール(自動)
最新の FreeBSD ports コレクションは、ports/lang/fpc2 に 2.0.2(もうすぐ2.0.4)の安定バージョンが登録されています。殆どの場合、この port をインストールする必要があります。もし Lazarus を使用とするなら"gtk"をまずインストールする必要があるのですが。
手動でするなら root で次のように実行します:
[]# cd /usr/ports/lang/fpc2 && make install && make clean
他の手法は portinstall を使うことです。
[]# portinstall fpc2
一度 fpc をインストールすれば、シンプルなコマンドを実行することで動作チェックをすることができます。
[]$ fpc
しかしながら、FreeBSD と FPC の間には1つ問題があります。port はすべてのパッケージと FCL をインストールするのですが、(lazarus で必要となる)glib と gtk の最新の ports ツリーでは名称変更がなされているのです。これは lazarus でリンク処理をする際に、"cannot find library -lglib" というエラーメッセージが発生することを意味しています。次の2つの方法のうちどちらか1つで修正することができます。
1. fpc ソースの中の該当箇所を修正し、りコンパイルする[推奨しません]
2. 従来のライブラリ名称へのシンボリックリンクを作成する
2. の方法については、次のように行ないます。
[]$ cd /usr/local/lib && ln -s libglib-12.so libglib12.so []$ cd /usr/X11R6/lib && ln -s libgtk-12.so libgtk12.so
この変更をしてから、Lazarus でコンパイル・リンクを行なって下さい。
BSD 環境 での Free Pascal のインストール(手動)
Effectively, you need
A file with all sources, or two (fpc and lazarus)
1. e.g. for fpc ftp://ftp.freepascal.org/fpc/dist/Linux/separate/sources.tar preferably an export (no CVS/ dirs). The above file misses this.
2. Lazarus のソースのスナップショット
- _any_ starting compiler from the 2.0.2 branch) You can do a check by parsing the output of ppc386 -i if it is 2.0.2 .. 2.1.x it is ok.
- - dependant packages. (for FreeBSD that is gtk12, glib12 and gdk_pixbuf and GNU make, iconv and gettext)
FPC の構築:
1. (fetch) necessary files (FPC source, starting compiler)
2. (extract) Then de-tgz in work directory,
3. (build) enter work/fpc/ and run
$MAKE all OPT='-gl -O3p3' PP=/path/to/startingcompiler-name-ppc386 (/path/to/ can be omitted when ppc386 is in the path) ($MAKE is make on linux and gmake on BSD)
4. (install) then, again in work/fpc, run
$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX (THEPREFIX= usually is /usr/lcoal, but e.g. on NetBSD it is /usr/pkg for ports) Create a symlink: ln -s $THEPREFIX/lib/fpc/2.0.2/ppc386 $THEPREFIX/bin/ppc386 install sourceinstall PREFIX=$THEPREFIX
5. (configure) run compiler/utils/samplecfg $THEPREFIX/lib/fpc/2.0.1 $ETCDIR
6. (optional, test), see if ppc386 -i gives output, else give a warning that user need to add $PREFIX/bin to his current path. Try to compiler a program with -viwn, and see if that gives errors.
Notes:
- If you need fpcmake package lists, you need to generate or supply them yourself, (in the port, or in an extra archive) either way, do a dummy install to /tmp/pack and determine the files installed with find . >ll
- $THEPREFIX and $ETCDIR should be user configurable. Otherwise local installs aren't possible.
- BSDHIER=1 on all make commands forces BSD hierarchy conventions.
Mac OS X 環境での Free Pascal のインストール
Mac OS X の場合、他に Apple Developer tools、X11、GTK 1.2 が必要となります。
- Apple Developer-tools
- OS X のインストレーション CD(DVD) の中に含まれています。もしくは、Apple の ADC(無償だが要登録)に参加し、ダウンロードするという方法があります。http://developer.apple.com/ 参照。
- Apple X11
-
- 新しいシステムの場合: インストールダイアログの中で"カスタマイズ"を選び、"X11"にチェックを入れて下さい。
- インストール済みのMac OS Xに追加する場合:
- Mac OS X 10.3: 次のサイトからダウンロードして下さい。
- MacOSX 10.4: 付属の DVD から X11 をインストールして下さい。
- GTK 1.2
- GTKパッケージをダウンロードし正しくインストールするには、かなり時間がかかる場合があります。そのため、さまざまなパッケージマネジャがあります。そのうちの一つがfinkです。finkによってGTK 1.2をインストールするには次のようにします:
- fink をURL http://fink.sourceforge.net/download/index.php?phpLang=en からダウンロードし、ターミナル上で次のコマンドを実行して下さい。
sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines
X11 アプリケーションは /Applications/Utilities/X11 にインストールされます。ドラッグ&ドロップでドックに置いておけば、いつでもクリック1回で起動できます。
Tip: Lazarus を含めてほとんどの X11 プログラムは、ユーザが Window 上をクリックした際にフォーカスが取得できることを前提にしています。MacOSX 上では、この機能は非アクティブにされています。ターミナル上で次のコマンドを実行することで、すべての X11 アプリケーションでこれをアクティブにすることができます。
defaults write com.apple.x11 wm_click_through -bool true
- Free Pascal Compiler
- 次の URL から Free Pascal Compiler (バージョン2.0.2) をダウンロードし、インストールします:
GTK 関連のソフトウェアをコンパイルする時には、次の2行を fpc.cfg ファイルに追加してライブラリを有効にする必要があります:
-Fl/sw/lib -Fl/usr/X11R6/lib
Lazarusを利用するためには、FPCのソースも必要です:
- MacOSX 用の SVN のインストール: おすすめのパッケージがこのサイト Martin Ott から配布されています。
- ディレクトリを作成し、ソースをそこに置きます。root権限 でこれをする必要はありません。普通のユーザアカウントで構いません。
- 最初に fpc 用のディレクトリを作成します (例 /Users/username/freepascal)
- そしてターミナルを開き次のコマンドを実行します。
[]$ svn co http://svn.freepascal.org/svn/svn/trunk fpc
- これにより 'fpc' という名前のディレクトリが作成されます。これは後で IDE から使用されます。
ヒント: 最新のダウンロード/アップデートに更新するには、次のようなシンプルな方法で実施します
[]$ cd /Users/username/freepascal/fpc []$ svn up
Lazarus のインストール
Linux 環境での Lazarus のインストール
RPM を用いたインストール
Lazarus の現行のインストーラを取得することが最も簡単な方法で、それは SourceForge のリポジトリから FreePascal と Lazarus の RPM をダウンロードすることです。
指定のバージョンをダウンロードする必要があります
- コンパイラ (例: fpc-2.2.2-0.i586.rpm)
- pascal ソースライブラリ (例: fpc-src-2.2.2-0.i386.rpm)
- lazarus パッケージ (例: lazarus-0.9.26-0.i386.rpm).
次のスクリプトはミラーサイトnchcから0.9.26をダウンロードしてインストールもしくはアップデートする例です。"InstallLazarus.sh"などと名前を付けて保存し、実行パーミッションを与え、suでroot権限をとってから実行してください。新規インストールでrpm evに際し、"インストールされていません"とのメッセージが出ても問題ありません。
#!/bin/sh URL=http://nchc.dl.sourceforge.net/sourceforge/lazarus wget $URL/fpc-2.2.2-0.i386.rpm wget $URL/fpc-src-2.2.2-081004.i386.rpm wget $URL/lazarus-0.9.26-0.i386.rpm rpm -ev lazarus rpm -ev fpc rpm -ev fpc-src rpm -ivh fpc-* rpm -ivh lazarus-*
openSUSE 11.1 ユーザのためのLazarus 0.9.26 のインストール:
Free Pascal コンパイラには次のものが必要です: - Gnu バイナリ (gnu as, gnu ld, gnu make) 次のコマンドで簡単にそれらをインストールできます。
# zypper in -t pattern devel_basis
さらに、Lazarus のインストールには次のコンポーネントが必要です:
1) glib devel
2) gtk devel
3) gdk-pixbuf-devel
次のコマンドで簡単にそれらをインストールできます。
# zypper -n install gdk-pixbuf
バイナリファイルをダウンロードします(RPM)
- fpc-2.2.2-0.i386.rpm
- fpc-src-2.2.2-0.i386.rpm
ターミナルを開き、それをインストールします(マウスの右ボタン -> Menu: terminal を開く)
# rpm -Uvh fpc-2.2.2-0.i386.rpm # rpm -Uvh fpc-src-2.2.2-0.i386.rpm # rpm -Uvh lazarus-0.9.26-0.i386.rpm
ソースからのインストール
ソースからの自分自身でコンパイルしてインストールするのがお好みでしたら、以下のように行って下さい。lazarus関連のファイルはすべて一つのディレクトリに保存されるため、アンインストールはきわめて簡単で、インストールするのにrootになる必要もありません。ダウンロードページからfpcとfpcsrcとlazarusのtgzファイルをダウンロードできますし、svnから直接ダウンロードすることもできます。
以下は0.9.18をUbuntu 6.06にインストールする場合の例です。Linuxのコマンドやbashスクリプトをある程度ご存知でしたら、何をすればよいのかおわかりでしょう。スクリプトをコピーし(新しいバージョンが出ていたら番号を書き換え), テキストエディタに貼り付けて"install_lazarus.sh"などと名前を付けて保存してください。そのshファイルに実行許可を与え、コンソールで実行してください。 注意:この例ではfpcは/optにインストールされますので、'Install prefix'を聞かれたら'/opt/fpc'と入力してください。
#!/bin/sh #installing required packages sudo apt-get install build-essential sudo apt-get install libgtk2.0-dev sudo apt-get install libgdk-pixbuf-dev #installing FreePascal source cd /opt sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-src-2.0.4.source.tgz sudo tar -xvf fpc-src-2.0.4.source.tgz sudo mv fpc fpcsrc #installing FreePascal sudo mkdir fpc cd fpc sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-2.0.4.i386-linux.tar sudo tar -xvf fpc-2.0.4.i386-linux.tar sudo sh install.sh #adding fpc path to the PATH echo "#FPC PATH" >> ~/.bash_profile echo "if [ -d /opt/fpc/bin ] ; then" >> ~/.bash_profile echo PATH=/opt/fpc/bin:"${PATH}" >> ~/.bash_profile echo "fi" >> ~/.bash_profile #installing Lazarus cd ../ sudo wget http://nchc.dl.sourceforge.net/lazarus/lazarus-0.9.18-0.tar.gz sudo tar -zxvf lazarus-0.9.18-0.tar.gz PATH=/opt/fpc/bin:"${PATH}" sudo chmod -R 777 lazarus cd lazarus make clean all ./lazarus
注意:環境オプションでfpc-srcのパスを手動で指定する必要があります。 注意:UIの日本語が文字化けしています。さしあたりこちらの方法で対処してください。
Lazarus SVN のダウンロード
lazarusレポジトリはcvsからsvn(のサブバージョン)に移行しました。SVNを使用することにより、修正箇所のみをダウンロードして簡単にソースを最新版に保つことができます。相当な時間の節約になり、お薦めします。これにはインターネットへの接続が必要です。rootになる必要はありません。Lazarusはインストール時にも実行時にも特別なパーミッションは必要ありません。
移行にともない私達はlazarusソースのディレクトリ構成を変えました。最も大きな違いは全てのIDEソースが主ディレクトリ(root)から別々のサブディレクトリに移ったことです。おわかりのように、このことはMakefilesやサーチパスなどに影響を与えます。私達はここからくる諸問題に取り組んでいますので、もし何かがうまく機能しない場合はどうぞお知らせ下さい。
- では、最も大事なこと....ソースを入手しましょう
[]$ svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus
(あるいはソースを置きたい任意のディレクトリ)
アップデートしたい時には、ただ次のようにタイプしてください
[]$ svn update lazarus
サブバージョンに関するより詳細な情報: http://subversion.tigris.org/
注意: CVSにもまだアクセスできますが、アップデートが停止しています。
コンパイルと実行
cvs もしくは svn のどちらからのチェックアウトであっても、次のステップとなります:
- lazarus をコンパイルする
[]$ cd lazarus []$ make (gmake on BSD)
fpc が正しくインストールされていれば、コンパイラは問題なく動くはずです。そうでなければ FAQ を見て下さい。
- lazarus を起動する
[]$ ./lazarus
IDEが起動するはずです。ターミナルからlazarusを起動した場合、いくつかの足りない設定についての注意書きが表示されます。初回の起動においてはそれが当り前です。IDEは自動的に最もよく使われるディレクトリを探すことにより、FreePascalコンパイラとそのソースがどこにあるかを見つけます。
- パスを確認して下さい
- IDE メニューを使って次の通り進みます
- Environment -> Environment Options -> Files
'FPCソースディレクトリ'にあなたのfpcソースディレクトリを指定してください。このディレクトリはふつう/fpc/や/fpcsrc/ (例えば/usr/src/fpcsrcや/home/username/freepascal/fpc)が末尾につき、'compiler', 'docs', 'fcl', 'rtl','packages'などのディレクトリを含みます。
- ヒント
lazarus をアップデートするなら次の通りにします
[]$ svn update lazarus
それからどのアップデート経路であろうとも:
[]$ make clean all (BSDならばgmake)
これによりlazarusが再構築され、IDEがlazarusパッケージなしに作成されます。あなたがインストールしたパッケージをインストールするには上記の後に:
[]$ make idepkg
Debian GNU/Linux 環境への Lazarus のインストール
There 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>.
Note 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
dpkg -r <package name>
without .deb extension. And then install the newest versions as described.
Debian 環境への Lazarus をインストールする別の方法
Added by User:Kirkpatc.
- Debian 環境で簡単に Lazarus をインストールする方法です
(assume new Debian installation, without development libraries loaded)
SourceForge のリポジトリから fpc、fpclib、lazarus リリース版の最新をダウンロードします; http://lazarus.freepascal.org にアクセスして、"downloads" をマウスの左ボタンでクリックし、"binaries" をクリック、次に "linux"、次に "Current Lazarus RPM" をクリックします。This will bring you to
そして次のファイルをダウンロードします(より新しいものがあればそれをダウンロードして下さい)
- fpc-2.0.0-0.i586.rpm
- fpcsrc-2.0.0-0.i386.rpm
- lazarus-0.9.8-fpc_2.0.0_0.i386.rpm
cd to the directory where these files are stored, then become root (su) and type:
alien -c fpc* //this will convert both the fpc and fpcsrc files to debian format and convert the install scripts alien -c laz*
そして、作成された Debian パッケージ(.deb)を root 権限でインストールします:
dpkg -i fpc*.deb laz*.deb
or use kpackage or a similar utility to install the generated fpc, fpcsrc and lazarus .deb files.
もし alien がインストールされていないのなら次のようにします:
apt-get install alien
Please note that, on Linux distributions like Ubuntu, you'll have to add 'sudo' in front of all commands. In Ubuntu previous command would be
sudo apt-get install alien
You need to produce a configuration file, which will reside in /etc/fpc.cfg. Still as root, cd to the main fpc directory /usr/lib/fpc/2.0.0 and then type
sh ./samplecfg /usr/lib/fpc/2.0.0 /etc
Check the contents of your new configuration file (cat /etc/fpc.cfg) and make any changes you want using vi or another text editor. Also make sure that there are no old configuration files in for example your home directory (~/.fpc.cfg).
GTK と pixbuf ライブラリの開発パッケージをインストールする必要があります。
apt-get install libgtk2.0-dev apt-get install libgdk-pixbuf-dev
これでプログラミングをはじめることが出来ます!
Installing Lazarus under Mac OS X
作業的には Linux 環境でのインストールとよく似ています。しかし、予め Apple developer ツールと X11 と GTK 1.2 をインストールしておく必要があります。
snaphot servers を利用して、Lazarus のスナップショットを簡単にインストールすることができます。
3つの .dmg スナップショットファイルをインストールすれば、それで FPCコンパイラ、FPCのソース、Larazusのソースもまた全てインストールしたことになります。後は Lazarus を実行して、ご自身のアプリケーションを開発するだけです。前記のような方法で FPC や Lazarus のソースを別にインストールする必要はありません。Lazarus をリビルドする必要があったり、Lazarus 自体の開発に参加したかったりするなら、前記のような方法で Lazarus ソースを read-write パーミッションを持ったフォルダにインストールする必要があります。
Carbon ウィジェットセットインターフェースのテストや開発については、 Carbon Interfaceを参照のこと。
OS Xで Lazarus を起動するには、少なくとも二つの方法があります:
- X11を起動し、ターミナルウィンドウで次のようにタイプします:
cd /usr/local/share/lazarus ./lazarus
- また、Lazarus を X11 メニューから起動することもできます。Applications | Customize を選択し、Add Item をクリックし、Nameの下に Lazarus と、Command の下に:
open -a /usr/local/share/lazarus/lazarus
- と入力します。Doneをクリックすれば、Applications | Lazarus を選択することで Lazarus を起動することができるようになります。
Windows 環境での Lazarus のインストール
Windows 版 Lazarus の現行バージョンのインストールは非常に簡単です。本体のハードディスク以外にもインストールできます。
もし使用する Windows 上にソフトウェアをインストールすることが許されていないか、管理者権限がなくてインストールできないといった場合、256 MB 以上の USB ドライブに Lazarus/FPC パッケージをインストールして使用することも可能です。この場合、コンパイラや環境設定オプション、fpc.cfg ファイルなどで、パスの指定に注意する必要があります。また USB ドライブ上にテスト用のディレクトリを用意し、保持しておいた方がいいと思います。
<< 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?
A: 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:
set THUMBDRIVE=%CD:~0,2%
This 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:
%SystemRoot%\system32\cmd.exe /k bin\setenv
so 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.
Also inside the bin directory is sed (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):
copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml
So to use it, I would type at the command prompt of the USB drive:
fixlaz G:
if "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. >>
Linux 用、Windows 用のバイナリーパッケージは次の URL からダウンロードできます。
http://sourceforge.net/project/showfiles.php?group_id=89339
最新のリリースのもの(現在は Lazarus-0.9.26-fpc-2.2.2-win32.exe)をダウンロードし、これを実行して下さい。
典型的な Windows インストールでインストールできます。以前のバージョンの Lazarus と FPC(多くの場合 c:\pp ディレクトリにあります)をアンインストールしておけば、特に致命的な問題もなく、FPC コンパイラとソースライブラリが Lazarus のディレクトリ構成と同じディレクトリの中にインストールされ、IDE が起動します。
Windows 用のスナップショットを利用することが出来ます。Lazarus Snapshots Downloadsからダウンロードできます。
ソースからのインストール
もしソースからのインストールを行いたい場合、これらの説明を見て下さい (Thanks to Joe for the initial Step-by-step description)
まず、lazarus のソースを Lazarus Snapshots Downloads からダウンロードする必要があります:
次に、c:\lazarus などのディレクトリに解凍して下さい。なお、fpc-2.2.2 をインストールしておく必要があります。fpc-2.3.1 のスナップショットでも構いません。 私はこのようにコンパイルして、lazarus.exe を実行しています。私の fpc のパスは c:\pp\bin\win32 です。このディレクトリには沢山の実行ファイル(make, grep, ppc386 など)が置かれています。
コマンドプロンプトを起動します。スタートメニュー->全てのプログラム->...->MS-DOS のアイコンのコマンドプロンプトを選択します。
次のようにタイプして下さい:
cd c:\lazarus set path=c:\pp\bin\win32;c:\lazarus //もちろん、ここはあなたの環境に合わせて //書き換えて下さい windres -i lazarus.rc -o lazarus.res make
幸運にも無事コンパイルができたら、lazarus.exe と入力して下さい。ソースエディタ、ダイアログ、プロパティエディタが起動してきます。しかし、これで完璧ではありません。引き続き操作を行って下さい。
サンプルは次の手順でコンパイルします:
cd examples make
もし、他のドライブ(例えば D ドライブなど)に lazarus をインストールしている場合、make をする際に GNU ユーティリティーが必要になってきます。もし、既にインストールしてあるのなら、環境変数の PATH にパスを通すことで(例えば set PATH=%PATH%;<gmakepath>)、解決します。でも d:\ を選ばない方が簡単です。
これで全てです。
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.
私が SuSE Linux 上で様々な試みから経験した落とし穴についてです:
rpm バージョンは場合によっては FPC を /bin や /usr/bin に、ライブラリを /lib や /usr/lib にインストールします。 もし .tar.gz を使ってソースバージョンからインストールしたら、デフォルトでは実行ファイルを /usr/local/bin に、ライブラリを /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.
BSD 環境での Lazarus のインストール
FreeBSD 4.10+
上のテキストでも述べていますが、まず GTK+ 1.2 をインストールしておく必要があります。私はそれをしていなかったので、まず最初に root になってこれをインストールしました:
> pkg_add -r gtk
> pkg_add -r gdk-pixbuf
> cd /path-to-lazarus
> gmake
> ./startlazarus
もしソースファイルがないというメッセージがでたら、[menu bar >> Environment >> Environment Options >> Files Tab: FPC source library] に進み、FPC のソースファイルのあるディレクトリに移ってください。私は上で述べたように SVN からそれを入手しました。
Good luck, that worked for me. --Jrmarino 21:29, 4 Jan 2006 (CET)
6.0 でも同じ方法です。しかし、これには2つの潜在的な問題があります。
1. 起動後、lazarus のソースエディタでいくつかの壊れたフォントがあるように見えます。これはフォントの指定が間違っているためです。修正は簡単です。エディタオプションに進み、他の他のフォントを選択してください。(clean works for me).
2. もしパッケージとlazarus のセルフビルド機能を使用したいのなら、Linux とは異なり、自分で環境オプションでgmake (make ではなく) のパスを明示的に指定しなければなりません。
PC-BSD 1.0rc1+
PBI Dirから Lazarus PBI をダウンロードして、PB-BSD 上にインストールすることが出来ます。
注意として、/usr/port/devel/glib* にある glib* ポート、もしくは pkg_add -r glib12 glib20 を実行して glib パッケージをインストールする必要があります。 私は新しい PBI リリースでこれを修正するつもりです。
[他の OpenBSD/NetBSD/DragonFlyBSD はここから]