Difference between revisions of "Indy with Lazarus/fr"

From Free Pascal wiki
Jump to navigationJump to search
m (Remarque sur les indications chronologiques.)
Line 1: Line 1:
 
{{Indy with Lazarus}}
 
{{Indy with Lazarus}}
 +
 +
(NdT [[User:E-ric|E-ric]] ([[User talk:E-ric|talk]]) 13:05, 29 April 2020 (CEST): Les indications chronologiques originelles étant relatives, leur validité lors de la traduction est aussi relative)
  
 
== Indy pour Lazarus ==
 
== Indy pour Lazarus ==

Revision as of 12:05, 29 April 2020

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) 한국어 (ko)

(NdT E-ric (talk) 13:05, 29 April 2020 (CEST): Les indications chronologiques originelles étant relatives, leur validité lors de la traduction est aussi relative)

Indy pour Lazarus

Une nouvelle tenative de conversion d'Indy a été entreprise par l'équipe de base (core team) d'Indy. Marco van de Voort, développeur FPC, travaille avec le coeur d'Indy pour que FPC/Lazarus fonctionne pleinement avec Indy. En particulier, JP Mugaas d'Indy a fait pas mal de bon travail pour porter Indy10 vers FPC. La plupart du backend unixrtl est de son fait.

Actuellement, Indy10 fonctionne presque complètement et l'utilisabilité pour l'utilisateur final a été améliorée. Seuls des sujets tels que OpenSSL et la compression pourraient demander des connaissances supplémetaires. Le suport 64-bit n'est pas entièrement validé.

(Avis d'un contributeur) Conseil: Je ne suis pas très intéressé(e) par le support de la partie Kylix d'Indy. (Tout ce qui utilise l'unité libc). Je l'ai portée uniquement comme une étape vers une RTL native d'Unix utilisant les apps Indy.

Exigences

Actuellement, FPC 2.0.4 (NdT: aucun vérification faite pour les versions 3.x) est vraiment près d'être capable d'utiliser Indy dans tous ses aspects, excepté pour le bug de serveur sur FreeBSD/Mac OS X (qui nécessite 2.1.1)

Puisque Indy10 fonctionne maintenant sur toutes les cibles majeures, nous nous concentrons sur cette version. Alors que la conversion vers Indy9 semble plus simple, il faut garder à l'esprit qu'elle ne tourne que sous Win32 (et pourrait être théoriquement portée sur Linux/x86).

Ainsi nous recommendons aux gens de travailler avec Indy10 autant que possible.

(Pour Indy9, vous pourriez avoir besoin de retirer la surcharge de la méthode tmemorystream.setsize (Marcov: ???) pour que les composants Telnet fonctionnent, mais Indy9 n'a pas été testé depuis longtemps)

Le portage is honnêtement stable, et JP Mugaas a fait beaucoup pour améliorer la qualité de la version, un ensemble de makefiles compris.

Téléchargements / Liens

Instantanés (snapshots) actuels sont là:

Ce qui marche, ce qui ne marche pas

Indy9:

  • Devrait fonctionner largement sur Windows. Beaucoup de démos sont portées.
  • Pas ou peu sur Linux. Aucun espoir sur les cibles non Linuxw/x86 (non Kylix).

Indy10:

  • Windows et Unix: Les clients fonctionnent et les serveurs devraient bien marcher en principe.
  • Le principal travail pour la RTL Unix native est fait. Les serveurs et clients semblent fonctionner avec FreeBSD et OS X.

Tous: les versions sécurisées ne sont pas encore testées.

Plans à court terme

  • Convert demos to demonstrate/test workings.
  • Fix bugs and enter them back into FPC or Indy RCS.

Problèmes

  • Indy9 and Indy10 are mutually exclusive, which causes problems for deployment, even the default is a problem:
    • Indy9 is more used and proven in the industry.
    • Indy10 is more portable, and better long term. However uptake seems to be low, and there is not much movement at Indy anymore.
  • How to deploy? Parts belong to Lazarus, parts to FPC.
  • Lot of pkgs and demos have paths in them. How to centrally fix them so that inexperienced users can build them?
  • Lazarus problems
    • Transparency problems of icons
    • 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.
  • 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.

Bugs

  • 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.
  • 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.

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.

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.

Comment installer

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

  • Open and compile indysystemlaz.lpk
  • Open and compile indycorelaz.lpk
  • Open and compile indyprotocolslaz.lpk
  • Open, compile and install dclindycorelaz.lpk
  • Open, compile and install dclindyprotocolslaz.lpk

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

Comment installer sur Debian/Ubuntu

  • # cd indy-10.2.0.1/fpc
  • # chmod +x debian/rules
  • # touch README
  • # sudo apt-get install fakeroot
  • # dpkg-buildpackage -rfakeroot -uc
  • # cd ..
  • # sudo dpkg -i *.deb
  • install package indylaz.lpk in lazarus

Comment installer [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.

  • Unzip the component from file tar.gz (must be this file, the "zip file" does not work) in directory $(LazarusDir)\components;
  • Go to directory $(LazarusDir)\components\indy-10.2.0.1\ and to create inside them a directory named "saved";
  • Copy the content of the directory $(LazarusDir)\components\indy-10.2.0.1\lazarus\ to directory "saved" created above;
  • 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;
  • 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;
  • Install the package laz.lpk (available in $(LazarusDir)\components\indy-10.2.0.1\lazarus\indy) of conventional way.

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

Comment installer [3] Windows et Debian Linux, Indy 10.5.8.0 et versions postérieures

  • Need working Lazarus (and FPC) for this
  • 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/
  • unpack into a directory
  • copy the *.pas, *.lrs and *.inc of the \Lib\System, \Lib\Core, and \Lib\Protocols subdirectories into a new directory of your choosing
  • copy the indylaz.lpk in the \Lib directory to the directory you created above
  • from within Lazarus do a Package -> Open package file, open the indylaz.lpk
  • in the Package Options dialog, add the path to the directory you created above to the "Unit" field.
  • 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.

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.

Comment installer (confirmé) sur 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.

Problème sur Windows 64 bits

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

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

Problème de fuite de mémoire

If you have memory leaks in your Indy application, that is because you use IdStack or IdThread units, or components that depend on them. It is intended by design, and in Delphi it is solved by registering such leaks with memory manager. Such feature is not yet available with FreePascal, but fortunately you can fix it pretty easy. In file IdCompilerDefines.inc you should replace this line:

 {.$DEFINE FREE_ON_FINAL}

with this:

 {$DEFINE FREE_ON_FINAL}

and recompile Lazarus and Indy. Leaks are gone, but you should read this define related warnings in IdStack.pas and IdThread.pas units in order to avoid potential GPF. Here is the forum discussion where this fix was mentioned by one of the Indy developers.

Liens externes