Recent

Author Topic: can't compile cross codebot packages  (Read 4823 times)

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
can't compile cross codebot packages
« on: May 19, 2018, 06:38:22 am »
hello,
with Lazarus 1.8.2, fpc 3.0.4 on windows 10, i can't compile the cross codebot packages codebot.lpk and codebotdsgn.lpk.  I have many errors when i try to compile the packages :
example of errors :
Quote
codebot.system.pas(68,25) Error: Message recordind not yet supported
on this line of code :
Code: Pascal  [Select][+][-]
  1.  TArray<T> = array of T;  
it seems to be a syntax error : when i put  :
Code: Pascal  [Select][+][-]
  1. generic TArray<T> = array of T;
no error on this line.
but it was written here :
Quote
What version of Free Pascal do I need to use Cross Codebot?

A: Because Cross Codebot makes heavy use generics and class/record helps, it requires Free Pascal Compiler version 3.0 or above. Although FPC 3.0 is not yet officially released you can obtain a workable copy of it using SVN sources.

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: can't compile cross codebot packages
« Reply #1 on: May 19, 2018, 07:36:47 am »
I generally encounter such errors when compiling some codes that use that generic array syntax.
Do perform a clean rebuild of the packages, the error should go away.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: can't compile cross codebot packages
« Reply #2 on: May 19, 2018, 02:41:32 pm »
I generally encounter such errors when compiling some codes that use that generic array syntax.
Do perform a clean rebuild of the packages, the error should go away.

 :(  No success with this !
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: can't compile cross codebot packages
« Reply #3 on: May 19, 2018, 03:28:07 pm »
Thanks for reporting this problem. I recently checked in some big updates, but haven't tried recompiling on Windows. I will get the latest on Windows, try to recompile, fix any problems, and check code back into the official github repository.

https://github.com/sysrpl/Cross.Codebot

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: can't compile cross codebot packages
« Reply #4 on: May 19, 2018, 05:18:23 pm »
Okay, I loaded up Windows for the first time in probably a year and checked out the sources. I corrected a few platform breaking changes I had made and checked them back into git. The actual changes took only a few minutes, but everything works now:

http://cache.getlazarus.org/videos/ftp-client-windows.mp4

Github page:

https://github.com/sysrpl/Cross.Codebot


Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: can't compile cross codebot packages
« Reply #5 on: May 19, 2018, 05:54:08 pm »
thanks sysrpl for your work but i have always the compile errors (see attachment)
Windows 10 64 bits  - Lazarus 1.8.2 32 bits  fpc 3.0.4 
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: can't compile cross codebot packages
« Reply #6 on: May 19, 2018, 06:41:30 pm »
thanks sysrpl for your work but i have always the compile errors (see attachment)
Windows 10 64 bits  - Lazarus 1.8.2 32 bits  fpc 3.0.4
Something is wrong with your environment and I can't say given the limited amount of information you've provided. Sorry.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: can't compile cross codebot packages
« Reply #7 on: May 19, 2018, 07:30:49 pm »
something is strange  :o  i have the same errors on Fedora 27 Lazarus 1.8.0   fpc 3.0.2 .
Have you some customized options in your environment ?
i download your sources  in the zip file from your github repository  (i don't use git) .
« Last Edit: May 19, 2018, 07:33:01 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: can't compile cross codebot packages
« Reply #8 on: May 19, 2018, 08:04:15 pm »
something is strange  :o  i have the same errors on Fedora 27 Lazarus 1.8.0   fpc 3.0.2 .
Have you some customized options in your environment ?
i download your sources  in the zip file from your github repository  (i don't use git) .
I think your FPC configuration is messed up. Whatever system you are using to install FPC/Lazarus is likely creating an incorrect global configuration file (fpc.cfg). From my experience I prefer to make use of fpc.cfg files in the same folder as the compiler, and Lazarus cfg files in the same folder as Lazarus. Your configurations on both Windows and  Linux are likely using global locations to store cfg settings, and they way your install or setup program worked, it's creating conflicts.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: can't compile cross codebot packages
« Reply #9 on: May 20, 2018, 01:55:06 am »
sysrpl , i have installed the lazarus 1.9 and fpc 3.1.1 with fpcupdeluxe ---> I can compile your packages :

may be there is something wrong with fpc 3.0.4 but it is the official version for the stable version of Lazarus 1.8

EDIT : I have found something very interesting :
with lazarus 1.8.2 fpc 3.0.4 when i do this in your file codebot.inc  (comment {$WARN} directives) :
Code: Pascal  [Select][+][-]
  1. //{$WARN 4055 off : Conversion between ordinals and pointers is not portable}
  2. //{$WARN 5024 off : Parameter "$1" not used}          
i have only one error in the file Codebot.System.pas :
Quote
codebot.system.pas(4360,26) Error: Incompatible types: got "TStringStream.constructor Create(const AnsiString);" expected "TStringStream"
on the line :
Code: Pascal  [Select][+][-]
  1.   Stream := TStringStream.Create;  

i can put  this to avoid this error :
Code: Pascal  [Select][+][-]
  1. Stream := TStringStream.Create('');
but is it good ?
« Last Edit: May 20, 2018, 02:20:45 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: can't compile cross codebot packages
« Reply #10 on: May 20, 2018, 10:35:20 am »
That should be fine, but just so you know there is something wrong with your configuration or setup given what your described in your previous posts. The directive {$mode delphi} should have been included in {$i codebot.inc}, causing no issues with the type declaration of "TArray<T> = array of T", but it was generating error. This should not have happened, so there is likely some other issue in need of fixing related to your configuration.

I would advise you to remove all reference to fpc and lazarus from your path, and to delete both rm $HOME/.fpc.cfg and rm -rf $HOME/.lazarus. After that this command should return nothing:

$ which fpc

Next find out where the fpc you want to use is located, and generate a fresh fpc.cfg in that folder using fpcmkcfg. Assuming you have fpc in a folder such as $HOME/fpc/bin/, place this script in $HOME/fpc/

#!/bin/bash
# save as setup.sh
# chmod +x setup.sh
# source./setup.sh

if [ -z ${OLDPATH+x} ]; then
  OLDPATH=$PATH
else
  PATH=$OLDPATH
fi

BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PPC_CONFIG_PATH=$BASE/bin
rm $PPC_CONFIG_PATH/fpc.cfg > /dev/null 2>&1
$PPC_CONFIG_PATH/fpcmkcfg -d basepath=$BASE/lib/fpc/\$FPCVERSION -o $PPC_CONFIG_PATH/fpc.cfg
export PATH=$PPC_CONFIG_PATH:$OLDPATH

Running the above script using the source command ($ source ./setup.sh) will generate a correct fpc.cfg in $HOME/fpc/bin, and also put PPC_CONFIG_PATH in your path. After the script has been sourced in your bash session, typing this in the same terminal:

$ fpc -iV

Should output the correct fpc version.In my case that is:

3.1.1

But everything should work fine with 3.0.2 as well. After than you need to reconfigure Lazarus.

#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ -z ${OLDPATH+x} ]; then
  OLDPATH=$PATH
else
  PATH=$OLDPATH
fi

BASE=$DIR/fpc
export PPC_CONFIG_PATH=$BASE/bin
rm $PPC_CONFIG_PATH/fpc.cfg > /dev/null 2>&1
$PPC_CONFIG_PATH/fpcmkcfg -d basepath=$BASE/lib/fpc/\$FPCVERSION -o $PPC_CONFIG_PATH/fpc.cfg
export PATH=$PPC_CONFIG_PATH:$OLDPATH
cd $DIR/lazarus
./lazarus --pcp=config

The last line of the above script tells lazarus to use the config folder inside the lazarus folder to store all its settings.
« Last Edit: May 20, 2018, 10:40:21 am by sysrpl »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: can't compile cross codebot packages
« Reply #11 on: May 20, 2018, 11:03:23 am »
hello,
But why when i comment  out the $WARN  directives after $mode Delphi in the file codebot.inc, it works ? My lazarus 1.8.2 configuration come from the  official Lazarus windows installer. If someone can try the codebot packages with the windows lazarus 1.8.2 ide to confirm that.
« Last Edit: May 20, 2018, 11:05:55 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: can't compile cross codebot packages
« Reply #12 on: May 20, 2018, 11:03:38 am »
i can put  this to avoid this error :
Code: Pascal  [Select][+][-]
  1. Stream := TStringStream.Create('');
but is it good ?
Yes. Depending on context.
TStringstream creates a stream on an existing string. It has no other meaning by itself.
Specialize a type, not a var.

halim

  • New Member
  • *
  • Posts: 11
Re: can't compile cross codebot packages
« Reply #13 on: May 21, 2018, 05:12:29 pm »
cross codebot installed perfect at my laptop with Newpascal 1.0.55

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: can't compile cross codebot packages
« Reply #14 on: May 22, 2018, 01:11:03 am »
hello,
i have only one error in the file Codebot.System.pas :
Quote
codebot.system.pas(4360,26) Error: Incompatible types: got "TStringStream.constructor Create(const AnsiString);" expected "TStringStream"
on the line :
Code: Pascal  [Select][+][-]
  1.   Stream := TStringStream.Create;  

i can put  this to avoid this error :
Code: Pascal  [Select][+][-]
  1. Stream := TStringStream.Create('');
I have this error because with fpc 3.0.4 i have TStringStream defined in fpcsource\rtl\objpas\classes\classesh.inc like this :
Code: Pascal  [Select][+][-]
  1. { TStringStream }
  2.  
  3.   TStringStream = class(TStream)
  4.   private
  5.     FDataString: string;
  6.     FPosition: Integer;
  7.   protected
  8.     Function GetSize : Int64; Override;
  9.     function GetPosition: Int64; Override;
  10.     procedure SetSize(NewSize: Longint); override;
  11.   public
  12.     constructor Create(const AString: string);
  13.     function Read(var Buffer; Count: Longint): Longint; override;
  14.     function ReadString(Count: Longint): string;
  15.     function Seek(Offset: Longint; Origin: Word): Longint; override;
  16.     function Write(const Buffer; Count: Longint): Longint; override;
  17.     procedure WriteString(const AString: string);
  18.     property DataString: string read FDataString;
  19.   end;
and in fpc 3.1.1 :
Code: Pascal  [Select][+][-]
  1. { TStringStream }
  2.  
  3.   TStringStream = class(TBytesStream)
  4.   private
  5.     FEncoding: TEncoding;
  6.     FOwnsEncoding : Boolean;
  7.     function GetDataString: string;
  8.     function GetUnicodeDataString: String;
  9.   protected
  10.   public
  11.     constructor Create(const ABytes: TBytes); override; overload;
  12.     constructor Create(const AString: string = ''); overload;
  13.     constructor CreateRaw(const AString: RawByteString); overload;
  14.     constructor Create(const AString: string; AEncoding: TEncoding; AOwnsEncoding: Boolean = True); overload;
  15.     constructor Create(const AString: string; ACodePage: Integer); overload;
  16.     // UnicodeString versions
  17.     constructor Create(const AString: UnicodeString); overload;
  18.     constructor Create(const AString: UnicodeString; AEncoding: TEncoding; AOwnsEncoding: Boolean = True); overload;
  19.     constructor Create(const AString: UnicodeString; ACodePage: Integer); overload;
  20.     function ReadUnicodeString(Count: Longint): UnicodeString;
  21.     procedure WriteUnicodeString(const AString: UnicodeString);
  22.     function ReadAnsiString(Count: Longint): AnsiString;
  23.     procedure WriteAnsiString(const AString: AnsiString);
  24.     function ReadString(Count: Longint): string;
  25.     procedure WriteString(const AString: string);
  26.     property DataString: string read GetDataString;
  27.     Property UnicodeDataString : String Read GetUnicodeDataString;
  28.     Property OwnsEncoding : Boolean Read FOwnsEncoding;
  29.     Property Encoding : TEncoding Read FEncoding;
  30.   end;
there is a default value to '' in the fpc 3.1.1 version

and for the other problem (generics), SymbolicFrank have written in an older post :
Quote
I strongly recommend using fpcupdeluxe to install a trunk version of fpc/Lazarus if you want to use (Delphi-style) generics.

Friendly, J.P
« Last Edit: May 22, 2018, 01:34:55 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

 

TinyPortal © 2005-2018