Recent

Author Topic: Indy 10 problem when build application  (Read 14806 times)

Pere

  • New Member
  • *
  • Posts: 11
Indy 10 problem when build application
« on: May 04, 2010, 10:09:08 am »
I have some Lazarus 0.9.2.6 applications using Indy 10.2.0.3 and working fine (Windows and Linux). Some months ago I updated Lazarus 0.9.2.6 to Lazarus 0.9.2.8 and installed Indy 10.2.0.3 without any problem.

But on Windows XP sp3, when I try to build an (old or new) Indy application I get this error:

"Recompiling IdStreamVCL, checksum changed for IdGlobal
IdStreamVCL.pas(9,9)Fatal: Can't find unit IdStreamVCL used by IdStream"

How can I solve it?

Sorry for my bad English.

fredycc

  • Sr. Member
  • ****
  • Posts: 264
Re: Indy 10 problem when build application
« Reply #1 on: May 04, 2010, 01:42:58 pm »
Try to delete IdStremVCL.o & IdStreamVCL.ppu & compile again the package, rebuild lazarus & after that try to build you application again.

Pere

  • New Member
  • *
  • Posts: 11
Re: Indy 10 problem when build application
« Reply #2 on: May 07, 2010, 06:48:57 am »
Fredycc,

I tried it but not worked. I had to uninstall and then reinstall Indy 10.2.0.3.

Now seems it's working, but I lost some trust about Indy on Lazarus.

Thanks.

penkerlove

  • Newbie
  • Posts: 1
Re: Indy 10 problem when build application
« Reply #3 on: June 17, 2010, 03:00:25 am »
You should modify IDStreamVCL.pas like this:

{
  $Project$
  $Workfile$
  $Revision$
  $DateUTC$
  $Id$

  This file is part of the Indy (Internet Direct) project, and is offered
  under the dual-licensing agreement described on the Indy website.
  (http://www.indyproject.org/)

  Copyright:
   (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}
{
  $Log$
}

unit IdStreamVCL;

interface

{$I IdCompilerDefines.inc}

uses
  Classes;

type
  TIdBytes = array of Byte;

  TIdStreamHelperVCL = class
  public
    class function ReadBytes(
          const AStream: TStream;
          var VBytes: TIdBytes;
          const ACount: Integer = -1;
          const AOffset: Integer = 0) : Integer; {$IFDEF DOTNET} static; {$ENDIF}
    class function Write(
          const AStream: TStream;
          const ABytes: TIdBytes;
          const ACount: Integer = -1;
          const AOffset: Integer = 0) : Integer; {$IFDEF DOTNET} static; {$ENDIF}
    class function Seek(
          const AStream: TStream;
          const AOffset: Int64;
          const AOrigin: TSeekOrigin) : Int64; {$IFDEF DOTNET} static; {$ENDIF}
  end;

  function IndyLength(const ABuffer: TIdBytes; const ALength: Integer = -1; const AIndex: Integer = 0): Integer;
  function IndyMax(const AValueOne, AValueTwo: Integer): Integer;
  function IndyMin(const AValueOne, AValueTwo: Integer): Integer;

implementation

function IndyMin(const AValueOne, AValueTwo: Integer): Integer;
{$IFDEF USEINLINE}inline;{$ENDIF}
begin
  if AValueOne > AValueTwo then begin
    Result := AValueTwo;
  end else begin
    Result := AValueOne;
  end;
end;

function IndyMax(const AValueOne, AValueTwo: Integer): Integer;
{$IFDEF USEINLINE}inline;{$ENDIF}
begin
  if AValueOne < AValueTwo then begin
    Result := AValueTwo;
  end else begin
    Result := AValueOne;
  end;
end;

function IndyLength(const ABuffer: TIdBytes; const ALength: Integer = -1; const AIndex: Integer = 0): Integer;
{$IFDEF USEINLINE}inline;{$ENDIF}
var
  LAvailable: Integer;
begin
  Assert(AIndex >= 0);
  LAvailable := IndyMax(Length(ABuffer)-AIndex, 0);
  if ALength < 0 then begin
    Result := LAvailable;
  end else begin
    Result := IndyMin(LAvailable, ALength);
  end;
end;

// RLebeau: must use a 'var' and not an 'out' for the VBytes parameter,
// or else any preallocated buffer the caller passes in will get wiped out!

class function TIdStreamHelperVCL.ReadBytes(const AStream: TStream; var VBytes: TIdBytes;
  const ACount, AOffset: Integer): Integer;
var
  LActual: Integer;
begin
  Assert(AStream<>nil);
  Result := 0;

  if VBytes = nil then begin
    SetLength(VBytes, 0);
  end;
  //check that offset<length(buffer)? offset+count?
  //is there a need for this to be called with an offset into a nil buffer?

  LActual := ACount;
  if LActual < 0 then begin
    LActual := AStream.Size - AStream.Position;
  end;

  //this prevents eg reading 0 bytes at Offset=10 from allocating memory
  if LActual = 0 then begin
    Exit;
  end;

  if Length(VBytes) < (AOffset+LActual) then begin
    SetLength(VBytes, AOffset+LActual);
  end;

  Assert(VBytes<>nil);
  Result := AStream.Read(VBytes[AOffset], LActual);
end;

class function TIdStreamHelperVCL.Write(const AStream: TStream; const ABytes: TIdBytes;
  const ACount: Integer; const AOffset: Integer): Integer;
var
  LActual: Integer;
begin
  Result := 0;
  Assert(AStream<>nil);
  //should we raise assert instead of this nil check?
  if ABytes <> nil then begin
    LActual := IndyLength(ABytes, ACount, AOffset);
    // TODO: loop the writing, or use WriteBuffer(), to mimic .NET where
    // System.IO.Stream.Write() writes all provided bytes in a single operation
    if LActual > 0 then begin
      Result := AStream.Write(ABytes[AOffset], LActual);
    end;
  end;
end;

class function TIdStreamHelperVCL.Seek(const AStream: TStream; const AOffset: Int64;
  const AOrigin: TSeekOrigin): Int64;
{$IFNDEF SIZE64STREAM}
const
  cOrigins: array[TSeekOrigin] of Word = (soFromBeginning, soFromCurrent, soFromEnd);
{$ENDIF}
begin
  {$IFDEF SIZE64STREAM}
  Result := AStream.Seek(AOffset, AOrigin);
  {$ELSE}
  Result := AStream.Seek(AOffset and $FFFFFFFF, cOrigins[AOrigin]);
  {$ENDIF}
end;

end.

then Install the indy lazarus package.
I have some Lazarus 0.9.2.6 applications using Indy 10.2.0.3 and working fine (Windows and Linux). Some months ago I updated Lazarus 0.9.2.6 to Lazarus 0.9.2.8 and installed Indy 10.2.0.3 without any problem.

But on Windows XP sp3, when I try to build an (old or new) Indy application I get this error:

"Recompiling IdStreamVCL, checksum changed for IdGlobal
IdStreamVCL.pas(9,9)Fatal: Can't find unit IdStreamVCL used by IdStream"

How can I solve it?

Sorry for my bad English.

vfclists

  • Hero Member
  • *****
  • Posts: 1165
    • HowTos Considered Harmful?
Re: Indy 10 problem when build application
« Reply #4 on: June 18, 2010, 01:58:12 am »
Wouldn't a diff output be much better?
It is hard for the OP to know what needs changing and its significance. FWIW he is not the only person to have had problems compiling Indy for Lazarus.

Better still put the diff on your blog and explain it.

You should modify IDStreamVCL.pas like this:

{
  $Project$
  $Workfile$
  $Revision$
  $DateUTC$
  $Id$

  This file is part of the Indy (Internet Direct) project, and is offered
  under the dual-licensing agreement described on the Indy website.
  (http://www.indyproject.org/)

  Copyright:
   (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}
{
  $Log$
}

unit IdStreamVCL;

interface

{$I IdCompilerDefines.inc}

uses
  Classes;

type
  TIdBytes = array of Byte;

//major snip

class function TIdStreamHelperVCL.Write(const AStream: TStream; const ABytes: TIdBytes;
  const ACount: Integer; const AOffset: Integer): Integer;
var
  LActual: Integer;
begin
  Result := 0;
  Assert(AStream<>nil);
  //should we raise assert instead of this nil check?
  if ABytes <> nil then begin
    LActual := IndyLength(ABytes, ACount, AOffset);
    // TODO: loop the writing, or use WriteBuffer(), to mimic .NET where
    // System.IO.Stream.Write() writes all provided bytes in a single operation
    if LActual > 0 then begin
      Result := AStream.Write(ABytes[AOffset], LActual);
    end;
  end;
end;

class function TIdStreamHelperVCL.Seek(const AStream: TStream; const AOffset: Int64;
  const AOrigin: TSeekOrigin): Int64;
{$IFNDEF SIZE64STREAM}
const
  cOrigins: array[TSeekOrigin] of Word = (soFromBeginning, soFromCurrent, soFromEnd);
{$ENDIF}
begin
  {$IFDEF SIZE64STREAM}
  Result := AStream.Seek(AOffset, AOrigin);
  {$ELSE}
  Result := AStream.Seek(AOffset and $FFFFFFFF, cOrigins[AOrigin]);
  {$ENDIF}
end;

end.

then Install the indy lazarus package.
I have some Lazarus 0.9.2.6 applications using Indy 10.2.0.3 and working fine (Windows and Linux). Some months ago I updated Lazarus 0.9.2.6 to Lazarus 0.9.2.8 and installed Indy 10.2.0.3 without any problem.

But on Windows XP sp3, when I try to build an (old or new) Indy application I get this error:

"Recompiling IdStreamVCL, checksum changed for IdGlobal
IdStreamVCL.pas(9,9)Fatal: Can't find unit IdStreamVCL used by IdStream"

How can I solve it?

Sorry for my bad English.
Lazarus 3.0/FPC 3.2.2

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Indy 10 problem when build application
« Reply #5 on: July 03, 2010, 10:22:32 am »
Quote
But on Windows XP sp3, when I try to build an (old or new) Indy application I get this error:

"Recompiling IdStreamVCL, checksum changed for IdGlobal
IdStreamVCL.pas(9,9)Fatal: Can't find unit IdStreamVCL used by IdStream"

How can I solve it?

Have you tried explicitly stating the path to Indy in your project's compiler options? See the screenshot for details.

I've had to do this for all my Indy projects otherwise they won't get compiled.

I use Lazarus 0.9.29 svn 24727.
« Last Edit: July 03, 2010, 10:24:12 am by JD »
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

vfclists

  • Hero Member
  • *****
  • Posts: 1165
    • HowTos Considered Harmful?
Re: Indy 10 problem when build application
« Reply #6 on: July 04, 2010, 07:22:27 pm »

Lucky for you I was testing an upgrade to 0.9.29 and 0.9.28.3 and I realized that you have to add the path of IdStreamVCL.pas to the

Quote
Other Sources (.pp/.pas files, used only by IDE not by the compiler)
text box.

in the Compiler Options for Package Indylaz 10.2.0.3 dialog.

This is
Quote
..\fpc\

I suppose IdStreamVCL.pas is required by the component streaming code.

I think it may be necessary also to add ..\fpc\IdStreamVCL.pas to the project. That is how my project is setup and I haven't tested it properly.

I guess we all need some more knowledge about how the IDE component handling code works with the IDE and with FPC compiler itself.
Lazarus 3.0/FPC 3.2.2

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12718
  • FPC developer.
Re: Indy 10 problem when build application
« Reply #7 on: July 05, 2010, 11:59:10 am »

Did you use the exact code tree you used in the old one? If not, check if there are multiple .INC files with the same name, and delete them (so there is only one instance of both) This is a known problem that indy seems unlikely to remedy.

FPC recompiles changed .INC files, Delphi not.  If some other dir uses idglobal but has an own copy of one of the .INCs, this kind of behaivour might happen. Easy to fix though.

 

TinyPortal © 2005-2018