[Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
On Sat, 17 Aug 2019 16:43:38 +0200, Martin Frb via lazarus
<[hidden email]> wrote:

>I attached a ready to go replacement file.
>Make a copy of your original
>   components/macroscript/emsselftest.pas
>and then put the attached file into it.
>
>Tools > Option > editor macro script : "Test again"
>    (this deletes/reset editormacroscript.xml from your primary conf,
>which is the file that stores the error)
>Tools > Rebuild Lazarus IDE
>Restart
>
>The new error should be shown on IDE start.
>

Now after getting 2.0.5 working in Win7 I returned to the RPi4
uinstallation of 2.0.4 and replaced the emsselftest.pas file as
described above, then rebuilt the IDE and opened Lazarus and clicked
the "test again" button. Closed and started Lazarus and received the
message again.

The editormacroscript.xml now contains this:

<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
  <EMS>
    <Settings SelfTestError="Replace All [Exp: True / Got: False /
Info: False  / SynTxt: Test abc abcde 123
]" SelfTestFailed="1"/>
  </EMS>
</CONFIG>

Does this explain what is wrong on the RPi4 installation?


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
On 18/08/2019 11:17, Bo Berglund via lazarus wrote:
> So this Lazarus installer successfully deposits a working Lazarus
> *without* the initial message about disabling the pascal scripting.
>
> And Lazarus options seems to be exactly like the 2.0.4 I installed
> previously.
> So the message I previously saw about deactivating scripting seems to
> be an *installer* bug when in fact the installation has succeeded all
> the time...
I doubt it. Nothing was fixed that could have triggered this.
Most likely some condition changed. Maybe simple because of the code
grew a few bytes....
Something like this normally points to incorrect mem access. But running
in valgrind revealed nothing.

Of course PascalScript has different code for each target CPU and OS.
(linux vs win // but not diff version of win afaik).


> Now after getting 2.0.5 working in Win7 I returned to the RPi4
>
> The editormacroscript.xml now contains this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <CONFIG>
>    <EMS>
>      <Settings SelfTestError="Replace All [Exp: True / Got: False /
> Info: False  / SynTxt: Test abc abcde 123
> ]" SelfTestFailed="1"/>
>    </EMS>
> </CONFIG>
>
> Does this explain what is wrong on the RPi4 installation?
Unfortunately not. This will require deeper debugging. Potentially quite
a lot.

I do not have access to an RP at the moment.  I planed to set one up (or
get QEMU to work) for more than 2 years now... But didn't find the time.
So that may still be a long time before I get to it.

If you want to go on trying to see if we can find anything, then please
open
   components\macroscript\emscriptclasses.pas
around line 555
replace TEmsSynWrapper.EMS_SearchReplace
with:

function TEmsSynWrapper.EMS_SearchReplace(ASearch, AReplace: string;
   AOptions: TSynSearchOptions): integer;
begin
debugln(['*** EMS_SearchReplace ASearch ', ord(ssoReplaceAll), ' / ',
integer([ssoReplaceAll])]);
debugln(['*** EMS_SearchReplace ', Pointer(ASearch), ' / ',
Pointer(AReplace), ' / ', integer(AOptions), ' / ', Pointer(self)]);
debugln(['*** EMS_SearchReplace ASearch ', ASearch, ' / ', AReplace]);
debugln(['*** EMS_SearchReplace ASearch ', length(ASearch), ' / ',
length(AReplace)]);
debugln(['*** EMS_SearchReplace ASearch ', RawByteString(ASearch), ' /
', RawByteString(AReplace)]);
debugln(['*** EMS_SearchReplace ASearch ', StringCodePage((ASearch)), '
/ ', StringCodePage((AReplace))]);
debugln(['*** EMS_SearchReplace ASearch ',
StringCodePage(RawByteString(ASearch)), ' / ',
StringCodePage(RawByteString(AReplace))]);
debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ',
dbgs(CaretXY)]);
   Result := SearchReplace(ASearch, AReplace, AOptions);
debugln(['*** EMS_SearchReplace ASearch ', Result]);
debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ',
dbgs(CaretXY)]);
end;

Start lazarus from console, so you can get the output. Copy the output.
The output only matters, if the error occurs. So self-testing must be
re-enabled.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
On Sun, 18 Aug 2019 14:21:30 +0200, Martin Frb via lazarus
<[hidden email]> wrote:

>If you want to go on trying to see if we can find anything, then please
>open
>   components\macroscript\emscriptclasses.pas
>around line 555
>replace TEmsSynWrapper.EMS_SearchReplace
>with:
>
>function TEmsSynWrapper.EMS_SearchReplace(ASearch, AReplace: string;
>   AOptions: TSynSearchOptions): integer;
>begin
>debugln(['*** EMS_SearchReplace ASearch ', ord(ssoReplaceAll), ' / ',
>integer([ssoReplaceAll])]);
>debugln(['*** EMS_SearchReplace ', Pointer(ASearch), ' / ',
>Pointer(AReplace), ' / ', integer(AOptions), ' / ', Pointer(self)]);
>debugln(['*** EMS_SearchReplace ASearch ', ASearch, ' / ', AReplace]);
>debugln(['*** EMS_SearchReplace ASearch ', length(ASearch), ' / ',
>length(AReplace)]);
>debugln(['*** EMS_SearchReplace ASearch ', RawByteString(ASearch), ' /
>', RawByteString(AReplace)]);
>debugln(['*** EMS_SearchReplace ASearch ', StringCodePage((ASearch)), '
>/ ', StringCodePage((AReplace))]);
>debugln(['*** EMS_SearchReplace ASearch ',
>StringCodePage(RawByteString(ASearch)), ' / ',
>StringCodePage(RawByteString(AReplace))]);
>debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ',
>dbgs(CaretXY)]);
>   Result := SearchReplace(ASearch, AReplace, AOptions);
>debugln(['*** EMS_SearchReplace ASearch ', Result]);
>debugln(['*** EMS_SearchReplace ASearch ', self.Text, ' / ',
>dbgs(CaretXY)]);
>end;
>
>Start lazarus from console, so you can get the output. Copy the output.
>The output only matters, if the error occurs. So self-testing must be
>re-enabled.

I have done this on my RPi4 with Lazarus 2.0.4.
The result after enabling the test and starting again from the console
is this sequence (line breaks added by news reader):

pi@rpi4-test:~ $ /home/pi/dev/lazarus/2.0.4/startlazarus
--pcp=/home/pi/.lazarus_2.0.4
Adding "--pcp=/home/pi/.lazarus_2.0.4" as a parameter
 is a file
SetPrimaryConfigPath NewValue="/home/pi/.lazarus_2.0.4" ->
"/home/pi/.lazarus_2.0.4"
TLazarusManager.Run starting /home/pi/dev/lazarus/2.0.4/lazarus ...
SetPrimaryConfigPath NewValue="/home/pi/.lazarus_2.0.4" ->
"/home/pi/.lazarus_2.0.4"
Hint: (lazarus) [TMainIDE.ParseCmdLineOptions]
PrimaryConfigPath="/home/pi/.lazarus_2.0.4"
Hint: (lazarus) [TMainIDE.ParseCmdLineOptions]
SecondaryConfigPath="/etc/lazarus"
Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=arm-linux-gtk2
New=arm-linux-gtk2 Changed: OS/CPU=True LCL=False
Parameter type not implemented!

---Here the error message is shown and it waits for the Start IDE
button to be clicked. -----

[WARNING] SetImageList called without handle for
lbMacroView(TListView)
[WARNING] SetImageList called without handle for
lbMacroView(TListView)
[WARNING] SetImageList called without handle for
lbMacroView(TListView)

--- Here is where the IDE has started and can be used ---
--- Now close the Lazarus IDE ---

LAZARUS END - cleaning up ...
Hint: (lazarus) [TMainIDE.Destroy] B  -> inherited Destroy... TMainIDE
Hint: (lazarus) [TMainIDE.Destroy] END

--- Lazarus IDE closed ---

I just copied the command line found in the GUI menu and ran it inside
the terminal, except I removed the trailing %f since I had no file to
pass in.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
On 18/08/2019 21:19, Bo Berglund via lazarus wrote:
>
> Parameter type not implemented!
>
So on arm that explains the error.
It does not implement passing a set as param (must be set, since string
worked in other tests).

I have to see, if there are any options.
Otherwise I will disable it for arm (since it does not currently work
for anyone, it would not be a regression)

As for what happened on windows, no idea.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
On Sun, 18 Aug 2019 22:51:31 +0200, Martin Frb via lazarus
<[hidden email]> wrote:

>On 18/08/2019 21:19, Bo Berglund via lazarus wrote:
>>
>> Parameter type not implemented!
>>
>So on arm that explains the error.
>It does not implement passing a set as param (must be set, since string
>worked in other tests).

Does this mean that FPC on Arm is not generating the expected code
like it does on Windows? So the cross-platform operation is somewhat
broken?

>I have to see, if there are any options.
>Otherwise I will disable it for arm (since it does not currently work
>for anyone, it would not be a regression)
>
>As for what happened on windows, no idea.

I know that on RPi Arm I had to figure out what build essentials to
install every time I needed to put FPC + Lazarus on a new system.
I had to retrieve sources via svn and build on the system so I had to
figure out all that was needed to succeed.
I put all of this into an installation script I use every time
nowadays (I have been doing this for 6-7 years now). It assumes
nothing but a pristine out-of-the-box Raspbian installation which
needs some more packages in order to work with s/w development. So the
script installs that for me.

And it has worked every time except once when the RPi went from arm6
to arm7 and a flag had to be added into the fpc build commands in the
script.

I think I have seen the same first start error for a long time on the
RPi. It is quite possible that I don't have the complete set of
required packages listed for installation in my script and this is
what breaks it. But that is provided that it is not an fpc deviation
for arm of course.

On Windows I have yet to build a dev system myself, I always use the
"official" installers there.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
On 18/08/2019 23:58, Bo Berglund via lazarus wrote:

> On Sun, 18 Aug 2019 22:51:31 +0200, Martin Frb via lazarus
> <[hidden email]> wrote:
>
>> On 18/08/2019 21:19, Bo Berglund via lazarus wrote:
>>> Parameter type not implemented!
>>>
>> So on arm that explains the error.
>> It does not implement passing a set as param (must be set, since string
>> worked in other tests).
> Does this mean that FPC on Arm is not generating the expected code
> like it does on Windows? So the cross-platform operation is somewhat
> broken?
No, it means PascalScript is not fully implemented

>> I have to see, if there are any options.
>> Otherwise I will disable it for arm (since it does not currently work
>> for anyone, it would not be a regression)
>>
>> As for what happened on windows, no idea.
> I think I have seen the same first start error for a long time on the
> RPi. It is quite possible that I don't have the complete set of
> required packages listed for installation in my script and this is
> what breaks it. But that is provided that it is not an fpc deviation
> for arm of course.
>
> On Windows I have yet to build a dev system myself, I always use the
> "official" installers there.
It is not a missing package.
All the code is compiled into the IDE.

PascalScript is a 3rd party package. It includes some asm code that
differs for each platform (cpu and general type of OS).

The OS type only matters because the calling convention differs. That is
fpc (following the rules for each platform) uses different registers to
store function param.
But there is no diff between win7 (64bit) and win10 (64bit). So if it
works on w10 for me, I have no idea why it fails for you (win 7).

Arm/linux (raspi) has different code in PS. And apparently that is
incomplete. But that only affects RPI.

Also on either system. After the error happens once, that is stored in
the config. Unless you remove your config each time that you install,
you should never see the error again.
To verify that, you can (after the error) check the XML file. That xml
file should stay there forever.

As I said, I will decide (soon / hopefully sometime before the next
release) what to do on arm. Maybe disable it for arm. Then there wont be
an error.
Maybe I find a work around. Then I would have to ask you to test (since
I cant currently).




--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
On Mon, 19 Aug 2019 00:46:18 +0200, Martin Frb via lazarus
<[hidden email]> wrote:

>Also on either system. After the error happens once, that is stored in
>the config. Unless you remove your config each time that you install,
>you should never see the error again.
>To verify that, you can (after the error) check the XML file. That xml
>file should stay there forever.

I always make a separate config dir for each installation so a new
install starts out with an empty config. I use the --pcp= flag in the
start command on Linux to specify this dir.
On Windows the installer fixes this during install when I check the
"separate installation" flag.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0.2 EditorMacroScript error on first startup RPi4B

Free Pascal - Lazarus mailing list
Can you please retest with
Revision: 61896
Date: 17 September 2019 22:21:38
EditorMacroScript: Use "internal" (none-native) calling for object methods

Making sure you remove your editormacroscript.xml file, or re-request
the self-test from the options page, please.


On 19/08/2019 07:08, Bo Berglund via lazarus wrote:

> On Mon, 19 Aug 2019 00:46:18 +0200, Martin Frb via lazarus
> <[hidden email]> wrote:
>
>> Also on either system. After the error happens once, that is stored in
>> the config. Unless you remove your config each time that you install,
>> you should never see the error again.
>> To verify that, you can (after the error) check the XML file. That xml
>> file should stay there forever.
> I always make a separate config dir for each installation so a new
> install starts out with an empty config. I use the --pcp= flag in the
> start command on Linux to specify this dir.
> On Windows the installer fixes this during install when I check the
> "separate installation" flag.
>
>

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
12