Sign in Join
Wiki copytemporary

Indy with Lazarus/ja: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## 日本語訳に当たって(20160512)
22
33Windows8.1、64bit版の環境において、Lazarus1.6(FPC3.0.0)からIndyを用いる方法を探すためにこのページの英語版にたどり着いたが、ほとんどの記事が古く、最終段のみが役立ったため、これを訳した。
44
55### Windowsへのインストールの仕方 - Indy 10.2.03
66
77このページには、「/* How to install \[3\] Windows, Indy 10.5.8.0 and above */」などの情報があるが、ほとんどのユーザーにとっては、そこに記載されている方法ではうまく行かないだろう。または、バージョン間の違いや矛盾する説明によって混乱させられるだろう。
88
99
1010例えば、Indyのwebサイトでは、最新版を snapshots のページからダウンロードするように指示してある。
1111
1212それに対して、この wiki では、ディレクトリに入って行って、多くのファイルをコピーするように指示していたりする。
1313
1414これらのファイルはわたしの環境ではうまく動かなかったし、結局、Lazarusのインストール環境をぐちゃぐちゃにすることになってしまった。
1515
16161. まず、右のURLからindy10.2.03をダウンロードする。 [here](http://www.indyproject.org/Sockets/fpc/index.EN.aspx). (訳注:IndyのWebサイトの構成がおかしいため、普通の方法ではたどり着けない(少なくとも私は))。他のサイトから取ってきたファイルはアーカイブ内に問題があった。
17172. 1.でダウンロードしたファイルを解凍すると、2つのフォルダ "fpc" と "lazarus" ができるはずだ。
1818 1. "fpc" フォルダの名前を「indylaz」に変え、右側に示す構成となるように、コピーする。(訳注:右側の「LAZARUS_DIR」はLazarusのインストールフォルダを示す。): LAZARUS_DIR\fpc\3.0.0\source\packages\indylaz
1919 2. "lazarus" フォルダの名前を「indylaz」に変え、右側に示す構成となるように、コピーする。: LAZARUS_DIR\components\indylaz
2020 3. どちらのフォルダにも、サブディレクトリが含まれないことを確認する。例: LAZARUS_DIR\components\indylaz\lazarus\\ となっている場合、最下位のlazarusフォルダの中身を、その上位のindylazに移動させて、最下位のlazarusフォルダは削除する。
21213. Lazarus を起動して、上側メニューの "パッケージ(P)" から "パッケージファイル(.lpk)を開く..." を選択し、LAZARUS_DIR\components\indylaz ディレクトリ内の "indylaz.lpk" を開く。
22224. パッケージがロードされたら、、"options" ボタンを押す。
23235. "コンパイラオプション" を選び、"Other unit files (-Fu)" の隣の、".." ボタンをクリックする。
2424 "fpc" を選択し、2-2で作成した "lazarus" フォルダを選んでOKを押す。相対パスは Lazarus がソートしてくれるので、変更しないこと。
25256. OK を押すと、Lazarus IDE のコンパイルが始まる。うまく行ったら、これまで役に立たない説明をして君に面倒な手間をかけさせていたやつに怒りをぶつけてやるんだね。
2626
2727### Windows 64bit版 における注意点
2828
2929Windows 64bit版 では、上に記載した内容だけではうまくコンパイルできない。 これは、 IdAntiFreeze.pas を以下の様に修正することで治る。(20160512時点において、Windows8.1、64bitで確認):
3030
31-`type`\
32-`  TIdAntiFreeze = class(TIdAntiFreezeBase)`\
33-`  public`\
34-`    procedure Process; override;`\
35-`  end; `
31+``` pascal
32+type
33+ TIdAntiFreeze = class(TIdAntiFreezeBase)
34+ public
35+ procedure Process; override;
36+ end;
37+```
3638
3739を以下の様に直す。
3840
39-`type`\
40-`  TIdAntiFreeze = class(TIdAntiFreezeBase)`\
41-`  public`\
42-`    {$IFDEF WIN32}`\
43-`    procedure Process; override;`\
44-`    {$ENDIF}`\
45-`  end;`
41+``` pascal
42+type
43+ TIdAntiFreeze = class(TIdAntiFreezeBase)
44+ public
45+ {$IFDEF WIN32}
46+ procedure Process; override;
47+ {$ENDIF}
48+ end;
49+```
4650
4751## Indy for Lazarus
4852
4953A 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.
5054
5155Currently 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.
5256
5357Hint: 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.
5458
5559### Requirements
5660
5761Currently, 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)
5862
5963Since 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).
6064
6165Therefore we recommend people to work with 10 as much as possible.
6266
6367(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)
6468
6569The port is fairly stable, and JP Mugaas has done a great deal to improve the quality of the release, a set of makefiles inclusive
6670
6771### Downloads / Links
6872
6973Current snapshots (for die hards only) are at
7074
7175- Indy9:
7276 - [Indy9, includes demos](http://www.stack.nl/~marcov/indy/indy9.zip) and
7377- Indy10:
7478 - converted Indy10 demos : [converted Indy10 demos](http://www.stack.nl/~marcov/demo10.zip)
7579 - [Indy 10 website](http://www.indyproject.org) Recently, this archive started to include demos too.
7680
7781### What works, what not
7882
7983**Indy9**:
8084
8185- Windows should largely work. Lots of demos ported.
8286- Linux not or barely. No hope at non Linux/x86 (non-Kylix) targets.
8387
8488**Indy10**:
8589
8690- Windows and Unix: clients work and servers should work fine in principle.
8791- The main work for native Unix RTL done. Servers Clients seem to work with FreeBSD and OS X
8892
8993All: secure versions not tested yet.
9094
9195### Short term plans
9296
9397- Convert demos to demonstrate/test workings.
9498- Fix bugs and enter them back into FPC or Indy RCS.
9599
96100### Problems
97101
98102- Indy9 and Indy10 are mutually exclusive, which causes problems for deployment, even the default is a problem:
99103 - Indy9 is more used and proven in the industry.
100104 - Indy10 is more portable, and better long term. However uptake seems to be low, and there is not much movement at Indy anymore.
101105- How to deploy? Parts belong to Lazarus, parts to FPC.
102106- Lot of pkgs and demos have paths in them. How to centrally fix them so that inexperienced users can build them?
103107- Lazarus problems
104108 - Transparency problems of icons
105109 - component tabs don't scroll, if you put a lot of components in one tab, they are not selectable. **workaround implemented**: JP Mugaas separated them into Indy clients A-M and N-Z etc. Also, meanwhile Lazarus changed to two rows of components per tab.
106110- Indy demos (specially Indy10's) are not very suitable for multiplatform usage. Their setup is awfully windows specific, with spaces in paths, deep nested dirs, and useless baggage (C# code). A short working set of demos will have to be created.
107111
108112### Bugs
109113
110114- Indy10 servers didn't work before due to an exception occurring during startup, which shut everything down. You need FPC 2.2(.0) or later to fix this (pthread_kill problem). This probably also affects Mac OS X.
111115- During demo conversion, the bindings property is often wrongly converted. This can result in strange errors, specially because Indy seems to bind to the same port using both IPV4 and IPV6 at the same time.
112116
113117Ubuntu 10.04 + Lazarus 0.9.28 + Indy 10(Server Component) -\> launch & do nothing (just crash)
114118
115119Solution (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.
116120
117121``` pascal
118122procedure TForm1.FormActivate(Sender: TObject);
119123var
120124 Binding: TIdSocketHandle;
121125begin
122126 //uses idGlobal
123127 //explicitly adding a Binding object prevents TIdTCPServer
124128 //from creating its own default IPv4 and IPv6 Binding objects
125129 //on the same listening IP/Port pair...
126130 Binding := IdTCPServer1.Bindings.Add;
127131 Binding.IPVersion := Id_IPv4; //optional: forces the Binding to work in Id_IPV4 mode.
128132 Binding.IP := '127.0.0.1';
129133 Binding.Port := 6501; //customization
130134 IdTCPServer1.Active := True;
131135end;
132136```
133137
134138(3)use TIdSync to Control your GUI in IdTCPServer's OnExecute() even.
135139
136140### How to install
137141
138142Matthijs: So it is not perfect yet, but you want to try it. Here is how you install it in Lazarus.
139143
140144- Open and compile indysystemlaz.lpk
141145- Open and compile indycorelaz.lpk
142146- Open and compile indyprotocolslaz.lpk
143147- Open, compile and install dclindycorelaz.lpk
144148- Open, compile and install dclindyprotocolslaz.lpk
145149
146150Then rebuild Lazarus and you will see a 15 tab's with Indy components.
147151
148152### How to install on debian/ubuntu
149153
150154- \# cd indy-10.2.0.1/fpc
151155- \# chmod +x debian/rules
152156- \# touch README
153157- \# sudo apt-get install fakeroot
154158- \# dpkg-buildpackage -rfakeroot -uc
155159- \# cd ..
156160- \# sudo dpkg -i *.deb
157161- install package indylaz.lpk in lazarus
158162
159163### How to install \[2\]
160164
161165If you couldn't install Indy for Lazarus with tips above, you can try this...
162166
163167From [Yahoo! Brazil, Lazarus Group](http://br.groups.yahoo.com/group/lazarus-brasil/) (User Everaldo)
164168
165169Version installed on Lazarus 0.9.24 using component indy-10.2.0.1.
166170
167171- Unzip the component from file tar.gz (must be this file, the "zip file" does not work) in directory \$(LazarusDir)\components;
168172- Go to directory \$(LazarusDir)\components\indy-10.2.0.1\\ and to create inside them a directory named "saved";
169173- Copy the content of the directory \$(LazarusDir)\components\indy-10.2.0.1\lazarus\\ to directory "saved" created above;
170174- Copy the content of directory \$(LazarusDir)\components\indy-10.2.0.1\fpc\\ to directory \$(LazarusDir)\components\indy-10.2.0.1\lazarus, and rewrite all files, ok;
171175- Get the content of directory "saved" and copy inside of \$(LazarusDir)\components\indy-10.2.0.1\lazarus and you can delete "saved" directory now;
172176- Install the package laz.lpk (available in \$(LazarusDir)\components\indy-10.2.0.1\lazarus\indy) of conventional way.
173177
174178On LINUX the path is: /usr/lib/lazarus/components/indy-10.2.0.1/
175179
176180### How to install \[3\] Windows and Debian linux, Indy 10.5.8.0 and above
177181
178182- Need working Lazarus (and FPC) for this
179183- Download from <http://www.indyproject.org/Sockets/Download/DevSnapshot.EN.aspx>. Or from the alternate web site for the updated and current versions: <http://indy.fulgan.com/>
180184- unpack into a directory
181185- copy the *.pas, *.lrs and *.inc of the \Lib\System, \Lib\Core, and \Lib\Protocols subdirectories into a new directory of your choosing
182186- copy the indylaz.lpk in the \Lib directory to the directory you created above
183187- from within Lazarus do a Package -\> Open package file, open the indylaz.lpk
184188- in the Package Options dialog, add the path to the directory you created above to the "Unit" field.
185189- compile then install (will rebuild Lazarus). EDIT: Currently, due to a know bug in FPC, you must compile the Indy package TWICE before installing it.
186190
187191In 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.
188192
189193### How to install (confirmed) on Windows - Indy 10.2.03
190194
191195/* 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.
192196
193197
194198The website points you to download the latest version from the snapshots page.
195199
196200This wiki tells you to copy a lot of files over into directories.
197201
198202For me, neither worked, and ended up making a mess of my Lazarus installations.
199203
2002041. Firstly, the page I would retrieve this from is [here](http://www.indyproject.org/Sockets/fpc/index.EN.aspx). Other sites I tried had problems with some files inside the archive.
2012052. When you open up the archive above, you will see there are folders: "fpc" and "lazarus".
202206 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.
203207 2. The "lazarus" folder, you copy into LAZARUS_DIR\components\indylaz
204208 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\\
2052093. Go into Lazarus and go to "Package" -\> "Open package file" and point it to the "indylaz.lpk" inside the LAZARUS_DIR\components\indylaz directory.
2062104. 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.
2072115. Click the "Compiler Options" on the left-hand side and Click on the ".." button next to "Other unit files (-Fu) (delimiter is semicolon)".
208212
209213Select the "fpc" then "lazarus" folders you created above and click OK. Lazarus will sort out the relative path for you. Don't change it.
210214
2112151. Click OK and compile and then direct angry bile towards the individual who has steered you wrong with the previous, unhelpful, instructions.
212216
213217### Issue on Windows 64bits
214218
215219On Windows 64bits, the compilation of the archive mentioned above will not work. This can be fixed by editing IdAntiFreeze.pas, replacing :
216220
217-`type`\
218-`  TIdAntiFreeze = class(TIdAntiFreezeBase)`\
219-`  public`\
220-`    procedure Process; override;`\
221-`  end; `
221+``` pascal
222+type
223+ TIdAntiFreeze = class(TIdAntiFreezeBase)
224+ public
225+ procedure Process; override;
226+ end;
227+```
222228
223229by
224230
225-`type`\
226-`  TIdAntiFreeze = class(TIdAntiFreezeBase)`\
227-`  public`\
228-`    {$IFDEF WIN32}`\
229-`    procedure Process; override;`\
230-`    {$ENDIF}`\
231-`  end;`
231+``` pascal
232+type
233+ TIdAntiFreeze = class(TIdAntiFreezeBase)
234+ public
235+ {$IFDEF WIN32}
236+ procedure Process; override;
237+ {$ENDIF}
238+ end;
239+```
232240
233241## External links
234242
235243- [The Indy Project official website](http://www.indyproject.org)
236244
237245---
238246*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](/wiki-contact).*

Back to history