miercuri, 31 octombrie 2012

Indy 10, Lazarus 1 (OpenSUSE 12.1)

After hours of attempts to install Indy 10 for Linux on Lazarus 1.0, here's the solution:
1) Download Indy 10.2.0.3 from here
2) Extract from tar.gz file (copy file to Documents>right click>Extract here [...]       autodetect subfolder) This will create a directory Indy-10.2.0.3
3) Open Lazarus>Package>Open package file. 
4) Select Indy-10.2.0.3/lazarus/indylaz.lpk
5) Select Options
6) Go to Compiler options>Paths
7) On the first line (Other unit files ...) add:  ../fpc On Windows it also required to add lib\i386-win32
8) Now select Use>Install. If it's not working, try Compile then Use>Install.

I tried to create a TCP server and more problems appeared. Here we go:

- In order to compile the project I had to add the path to Indy units in Project>Project Options>Compile Options>Paths>Other units file... If  ../fpc does not solve your problem (like in step 7 from above), you must specify the path to the fpc directory from your package

- I received some error about using threads. The solution was to add a new line into project1.lpr, so it should look like this:

uses
  {$DEFINE UseCThreads}
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, Unit1, lnetvisual 

- The TCP server must be forced to use IPv4, othervise it will say that the port or addres is blocked or in use. Before activating the component I added:
   server1.Bindings.Add.IPVersion := Id_IPv4;
  Now you can do:
   server1.Active:=true;
Of course, now it said that Id_IPv4 is not defined. The solution is to add in the implementation area:
   uses idglobal;

[UPDATE]
Newer versions of Indy are available. See my latest posts for installation of Indy 10.6 

Niciun comentariu:

Trimiteți un comentariu