ウィキのコピーミラー

これは pascal.chat のウィキのミラーです。編集、履歴、ログインはそちらで行います。

Indy with Lazarus/ja

한국어 · Deutsch · English · Español · Français · 日本語

日本語訳に当たって(20160512)

Windows8.1、64bit版の環境において、Lazarus1.6(FPC3.0.0)からIndyを用いる方法を探すためにこのページの英語版にたどり着いたが、ほとんどの記事が古く、最終段のみが役立ったため、これを訳した。

Windowsへのインストールの仕方 - Indy 10.2.03

このページには、「/* How to install [3] Windows, Indy 10.5.8.0 and above */」などの情報があるが、ほとんどのユーザーにとっては、そこに記載されている方法ではうまく行かないだろう。または、バージョン間の違いや矛盾する説明によって混乱させられるだろう。

例えば、Indyのwebサイトでは、最新版を snapshots のページからダウンロードするように指示してある。

それに対して、この wiki では、ディレクトリに入って行って、多くのファイルをコピーするように指示していたりする。

これらのファイルはわたしの環境ではうまく動かなかったし、結局、Lazarusのインストール環境をぐちゃぐちゃにすることになってしまった。

  1. まず、右のURLからindy10.2.03をダウンロードする。 here. (訳注:IndyのWebサイトの構成がおかしいため、普通の方法ではたどり着けない(少なくとも私は))。他のサイトから取ってきたファイルはアーカイブ内に問題があった。
  2. 1.でダウンロードしたファイルを解凍すると、2つのフォルダ "fpc" と "lazarus" ができるはずだ。
    1. "fpc" フォルダの名前を「indylaz」に変え、右側に示す構成となるように、コピーする。(訳注:右側の「LAZARUS_DIR」はLazarusのインストールフォルダを示す。): LAZARUS_DIR\fpc\3.0.0\source\packages\indylaz
    2. "lazarus" フォルダの名前を「indylaz」に変え、右側に示す構成となるように、コピーする。: LAZARUS_DIR\components\indylaz
    3. どちらのフォルダにも、サブディレクトリが含まれないことを確認する。例: LAZARUS_DIR\components\indylaz\lazarus\ となっている場合、最下位のlazarusフォルダの中身を、その上位のindylazに移動させて、最下位のlazarusフォルダは削除する。
  3. Lazarus を起動して、上側メニューの "パッケージ(P)" から "パッケージファイル(.lpk)を開く..." を選択し、LAZARUS_DIR\components\indylaz ディレクトリ内の "indylaz.lpk" を開く。
  4. パッケージがロードされたら、、"options" ボタンを押す。
  5. "コンパイラオプション" を選び、"Other unit files (-Fu)" の隣の、".." ボタンをクリックする。 "fpc" を選択し、2-2で作成した "lazarus" フォルダを選んでOKを押す。相対パスは Lazarus がソートしてくれるので、変更しないこと。
  6. OK を押すと、Lazarus IDE のコンパイルが始まる。うまく行ったら、これまで役に立たない説明をして君に面倒な手間をかけさせていたやつに怒りをぶつけてやるんだね。

Windows 64bit版 における注意点

Windows 64bit版 では、上に記載した内容だけではうまくコンパイルできない。 これは、 IdAntiFreeze.pas を以下の様に修正することで治る。(20160512時点において、Windows8.1、64bitで確認):

pascal
type
  TIdAntiFreeze = class(TIdAntiFreezeBase)
  public
    procedure Process; override;
  end;

を以下の様に直す。

pascal
type
  TIdAntiFreeze = class(TIdAntiFreezeBase)
  public
    {$IFDEF WIN32}
    procedure Process; override;
    {$ENDIF}
  end;

Indy for Lazarus

A new attempt at converting Indy is being undertaken by the Indy core team. FPC developer Marco van de Voort is working with Indy core to get Indy fully working with FPC/Lazarus. Specially Indy's JP Mugaas did a lot of good work in getting Indy10 to work with FPC. The native unixrtl backend is mostly his work too.

Currently Indy10 is nearly fully working, and end-user usability has been improved a lot. Only special topics like OpenSSL and compression might need additional knowledge. 64-bit support hasn't entirely been validated either.

Hint: I'm not very interested in support the Kylix side of Indy. (anything that uses unit libc). I ported it only as step up to native Unix RTL using Indy apps.

Requirements

Currently, FPC 2.0.4 is very close to being able to use indy in all its facets, except for the server bug on FreeBSD/Mac OS X (which requires 2.1.1)

Since Indy10 now works for all major targets, we focus on this version. While conversion to Indy9 might be simpler for people, keep in mind that it only works on win32. (and theoretically could be ported to Linux/x86).

Therefore we recommend people to work with 10 as much as possible.

(For indy9, you might need to remove the overriding of tmemorystream.setsize method (Marcov: ???) to get telnet components working, but Indy9 hasn't been tested in a while)

The port is fairly stable, and JP Mugaas has done a great deal to improve the quality of the release, a set of makefiles inclusive

Downloads / Links

Current snapshots (for die hards only) are at

What works, what not

Indy9:

Indy10:

All: secure versions not tested yet.

Short term plans

Problems

Bugs

Ubuntu 10.04 + Lazarus 0.9.28 + Indy 10(Server Component) -> launch & do nothing (just crash)

Solution (bruce0829@yahoo.com.tw collect and organize data): (1).Lazarus Main menu -> Project -> Compiler Options -> Other Page , add the "-dUseCThreads" parameter. (2).force the IdTCPServer to work in Id_IPV4 mode.

pascal
procedure TForm1.FormActivate(Sender: TObject);
var
  Binding: TIdSocketHandle;
begin 
  //uses idGlobal
  //explicitly adding a Binding object prevents TIdTCPServer
  //from creating its own default IPv4 and IPv6 Binding objects
  //on the same listening IP/Port pair...
  Binding := IdTCPServer1.Bindings.Add;
  Binding.IPVersion := Id_IPv4; //optional: forces the Binding to work in Id_IPV4 mode.
  Binding.IP := '127.0.0.1';
  Binding.Port := 6501; //customization 
  IdTCPServer1.Active := True;  
end;

(3)use TIdSync to Control your GUI in IdTCPServer's OnExecute() even.

How to install

Matthijs: So it is not perfect yet, but you want to try it. Here is how you install it in Lazarus.

Then rebuild Lazarus and you will see a 15 tab's with Indy components.

How to install on debian/ubuntu

How to install [2]

If you couldn't install Indy for Lazarus with tips above, you can try this...

From Yahoo! Brazil, Lazarus Group (User Everaldo)

Version installed on Lazarus 0.9.24 using component indy-10.2.0.1.

On LINUX the path is: /usr/lib/lazarus/components/indy-10.2.0.1/

How to install [3] Windows and Debian linux, Indy 10.5.8.0 and above

In order to write & compile Indy10 applications, you need to put the path to the Indy directory in the "Other Unit files" textbox of every project that you write. You'll find "Other Unit files" under Project Options -> Compiler Options -> Paths.

How to install (confirmed) on Windows - Indy 10.2.03

/* How to install [3] Windows, Indy 10.5.8.0 and above */ For a lot of users, I'm sure that the information given above won't work, or will be somewhat confusing given the differences between versions and inconsistent explanations.

The website points you to download the latest version from the snapshots page.

This wiki tells you to copy a lot of files over into directories.

For me, neither worked, and ended up making a mess of my Lazarus installations.

  1. Firstly, the page I would retrieve this from is here. Other sites I tried had problems with some files inside the archive.
  2. When you open up the archive above, you will see there are folders: "fpc" and "lazarus".
    1. You can copy the contents of "fpc" into: LAZARUS_DIR\fpc\2.6.0\source\packages\indylaz if you want to have things neat and tidy.
    2. The "lazarus" folder, you copy into LAZARUS_DIR\components\indylaz
    3. With both of these, make sure that there isn't a sub-directory inside the folders given. i.e. LAZARUS_DIR\components\indylaz\lazarus\
  3. Go into Lazarus and go to "Package" -> "Open package file" and point it to the "indylaz.lpk" inside the LAZARUS_DIR\components\indylaz directory.
  4. Once the package loads inside your project, click on the "options" button, which resembles an image of a parcel with a cog next to it.
  5. Click the "Compiler Options" on the left-hand side and Click on the ".." button next to "Other unit files (-Fu) (delimiter is semicolon)".

Select the "fpc" then "lazarus" folders you created above and click OK. Lazarus will sort out the relative path for you. Don't change it.

  1. Click OK and compile and then direct angry bile towards the individual who has steered you wrong with the previous, unhelpful, instructions.

Issue on Windows 64bits

On Windows 64bits, the compilation of the archive mentioned above will not work. This can be fixed by editing IdAntiFreeze.pas, replacing :

pascal
type
  TIdAntiFreeze = class(TIdAntiFreezeBase)
  public
    procedure Process; override;
  end;

by

pascal
type
  TIdAntiFreeze = class(TIdAntiFreezeBase)
  public
    {$IFDEF WIN32}
    procedure Process; override;
    {$ENDIF}
  end;

External links


From the Free Pascal wiki, page "Indy with Lazarus/ja", as it stood on 2020-02-17 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.

第2版、最終更新:WikiArchive 。