Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delphi 11 Only? #31

Open
peardox opened this issue Nov 8, 2022 · 23 comments
Open

Delphi 11 Only? #31

peardox opened this issue Nov 8, 2022 · 23 comments
Assignees
Labels
bug Something isn't working

Comments

@peardox
Copy link
Contributor

peardox commented Nov 8, 2022

It looks like you've used some Delphi 11 specific feature in Tools

Compiling under 10.4.1 (I was testing) or 10.4.2 fully patched (switched when 10.4.1 didn't work) this happens...

Checking project dependencies...
Building P4DTools.dproj (Release, Win32)
brcc32 command line for "P4DTools.vrc"
d:\program files (x86)\embarcadero\studio\21.0\bin\cgrc.exe -c65001 P4DTools.vrc -foP4DTools.res
dcc32 command line for "P4DTools.dpk"
d:\program files (x86)\embarcadero\studio\21.0\bin\dcc32.exe -$D0 -$L- -$Y- --no-config -B -Q -TX.bpl
-AGenerics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;
DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DRELEASE -E.\Win32\Release -I"d:\program files (x86)\embarcadero\studio\21.0\lib\Win32\release";
C:\Users\simon\Documents\Embarcadero\Studio\21.0\Imports;"d:\program files (x86)\embarcadero\studio\21.0\Imports";
C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp;"d:\program files (x86)\embarcadero\studio\21.0\include";
D:\Delphi\10.4.2\P4DSuite\Lightweight-Python-Wrappers\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\P4D-Data-Sciences\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\src\AddOn;D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonPackages4Delphi\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\python4delphi\lib\Win32\Release
-LEC:\Users\Public\Documents\Embarcadero\Studio\21.0\Bpl -LNC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NU..\lib\Win32\Release -NSWinapi;
System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;System;Xml;Data;Datasnap;Web;Soap; -O"d:\program files
(x86)\embarcadero\studio\21.0\lib\Win32\release";C:\Users\simon\Documents\Embarcadero\Studio\21.0\Imports;"d:\program files
(x86)\embarcadero\studio\21.0\Imports";C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp;"d:\program files (x86)\embarcadero\studio\21.0\include";
D:\Delphi\10.4.2\P4DSuite\Lightweight-Python-Wrappers\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\P4D-Data-Sciences\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\src\AddOn;D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonPackages4Delphi\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\python4delphi\lib\Win32\Release -R..\resources;
"d:\program files (x86)\embarcadero\studio\21.0\lib\Win32\release";C:\Users\simon\Documents\Embarcadero\Studio\21.0\Imports;"d:\program files
(x86)\embarcadero\studio\21.0\Imports";C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp;"d:\program files (x86)\embarcadero\studio\21.0\include";
D:\Delphi\10.4.2\P4DSuite\Lightweight-Python-Wrappers\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\P4D-Data-Sciences\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\src\AddOn;D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonPackages4Delphi\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\python4delphi\lib\Win32\Release -U"d:\program files
(x86)\embarcadero\studio\21.0\lib\Win32\release";C:\Users\simon\Documents\Embarcadero\Studio\21.0\Imports;"d:\program files
(x86)\embarcadero\studio\21.0\Imports";C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp;"d:\program files (x86)\embarcadero\studio\21.0\include";
D:\Delphi\10.4.2\P4DSuite\Lightweight-Python-Wrappers\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\P4D-Data-Sciences\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\src\AddOn;D:\Delphi\10.4.2\P4DSuite\PythonEnviroments\lib\Win32\Release;
D:\Delphi\10.4.2\P4DSuite\PythonPackages4Delphi\lib\Win32\Release;D:\Delphi\10.4.2\P4DSuite\python4delphi\lib\Win32\Release -JL
-NBC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp -NHC:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32
-NOC:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp P4DTools.dpk
[dcc32 Error] PyTools.Notification.Channel.pas(282): E2003 Undeclared identifier: 'GetAttribute'
[dcc32 Error] PyTools.Notification.Channel.pas(282): E2029 Expression expected but ')' found
[dcc32 Warning] PyTools.Notification.Channel.pas(282): W1023 Comparing signed and unsigned types - widened both operands
[dcc32 Error] PyTools.Notification.Channel.pas(283): E2008 Incompatible types
[dcc32 Error] PyTools.Notification.Channel.pas(284): E2003 Undeclared identifier: 'ChannelType'
[dcc32 Error] PyTools.Notification.Channel.pas(307): E2003 Undeclared identifier: 'GetAttribute'
[dcc32 Error] PyTools.Notification.Channel.pas(307): E2029 Expression expected but ')' found
[dcc32 Warning] PyTools.Notification.Channel.pas(307): W1023 Comparing signed and unsigned types - widened both operands
[dcc32 Error] PyTools.Notification.Channel.pas(308): E2008 Incompatible types
[dcc32 Error] PyTools.Notification.Channel.pas(309): E2003 Undeclared identifier: 'Identifier'
[dcc32 Error] PyTools.Notification.Channel.pas(382): E2003 Undeclared identifier: 'GetAttribute'
[dcc32 Error] PyTools.Notification.Channel.pas(382): E2029 Expression expected but ')' found
[dcc32 Warning] PyTools.Notification.Channel.pas(382): W1023 Comparing signed and unsigned types - widened both operands
[dcc32 Error] PyTools.Notification.Channel.pas(383): E2008 Incompatible types
[dcc32 Error] PyTools.Notification.Channel.pas(384): E2003 Undeclared identifier: 'EventType'
[dcc32 Fatal Error] PyTools.Notification.pas(36): F2063 Could not compile used unit 'PyTools.Notification.Channel.pas'
Failed
Elapsed time: 00:00:00.3

@peardox
Copy link
Contributor Author

peardox commented Nov 8, 2022

Found out why it's broken (D11 enhancement)

PyTools.Notification.Channel.pas

class function TNotificationChannel.GetNotificationChannelType: TNotificationChannelIdentifier;
e.g.

while Assigned(LRttiType) do begin
var LAttribute := LRttiType.GetAttribute<ChannelTypeAttribute>();
if Assigned(LAttribute) then
Exit(LAttribute.ChannelType);

TRttiType.GetAttribute is only in D11 while TRttiType.GetAttributes (plural) is in all the versions I've looked up

The TRttiType.GetAttribute version is used three times in this source file

@lmbelo
Copy link
Member

lmbelo commented Nov 15, 2022

Found out why it's broken (D11 enhancement)

PyTools.Notification.Channel.pas

class function TNotificationChannel.GetNotificationChannelType: TNotificationChannelIdentifier; e.g.

while Assigned(LRttiType) do begin
var LAttribute := LRttiType.GetAttribute();
if Assigned(LAttribute) then
Exit(LAttribute.ChannelType);

TRttiType.GetAttribute is only in D11 while TRttiType.GetAttributes (plural) is in all the versions I've looked up

The TRttiType.GetAttribute version is used three times in this source file

Nice catch. Fixing that.

@peardox
Copy link
Contributor Author

peardox commented Nov 15, 2022

Let me know when I can test it on 10.4.2 - I've got a load of VMs set up for testing

@lmbelo
Copy link
Member

lmbelo commented Nov 15, 2022

Let me know when I can test it on 10.4.2 - I've got a load of VMs set up for testing

Fixing it right away.

@lmbelo
Copy link
Member

lmbelo commented Nov 15, 2022

Try it out 89e5d54

@peardox
Copy link
Contributor Author

peardox commented Nov 15, 2022

Will do shortly (dinner)

@lmbelo lmbelo self-assigned this Nov 15, 2022
@lmbelo lmbelo added the bug Something isn't working label Nov 15, 2022
@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

Nope - TCustomAttributeClass is Alexandria only as well

It compiles OK though if you wrap the helper in an ifdef and add the type declaration

Add 3 lines and its OK. Note the ifdef ver340 is OK for this version as < 340 doesn't have libsuffix auto so won't work anyway

{$IFDEF VER340}
type
//For backward compatibility
TCustomAttributeClass = class of TCustomAttribute;

TRttiObjectHelper = class helper for TRttiObject
public
function GetAttribute(AAttrClass: TCustomAttributeClass): TCustomAttribute; overload;
function GetAttribute<T: TCustomAttribute>: T; overload; inline;
end;

{ TRttiObjectHelper }

function TRttiObjectHelper.GetAttribute(
AAttrClass: TCustomAttributeClass): TCustomAttribute;
var
LAttr: TCustomAttribute;
begin
for LAttr in GetAttributes do
if LAttr is AAttrClass then
Exit(LAttr);
Result := nil;
end;

function TRttiObjectHelper.GetAttribute: T;
begin
Result := T(GetAttribute(T));
end;
{$ENDIF}

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

Sorry, I missed the custom attribute meta class.

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

I'm just running a full check against a branch with the fix stated above.

I want to do full installations and test against 10.4 + 11.2 (it'll take a while)

Is there a demo that uses the cancel notification for Win, Mac + Linux?

I notice there's a new build of pythonengine as well (hence full test). The new FMXLinux package for python4delphi has some compontns in it - I take it those don't want installing, just building (I'll check anyway)?

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

The FMXLinux package is Linux intended only. Once you have the design-time packages installed on the IDE, you only need to build the run-time components on each platform.

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

The meta class is fixed, BTW.

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

I noticed - prefer it with an ifdef ver340 wrapping it so the code is only present in 10.4 though

Internet is being really bad today - dropping all the time. Got the new stuff now though so about to test on 11.2 and 10.4

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

The Linux version of python4delphi is broken. It has Windows as the default (it's Linux only).

PythonFmx does not have Linux as a target - it creates PythonGUIInputOutput - and has fmx and bindcomp as requirements (will compile if wrapped in a ifndef linux).

PythonFmxLinux has fmx as a requirement - again ifndef linux gets around this to make it compile

There is no redist in fmxlinux-1.65 (included with 10.4) so the only possibility is a lot of implicit binding there. 11.2 has fmxlinux-1.71 which includes the redist - no implicit if in path - used as a bpl replacement I guess

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

The Delphi IDE includes Win32 automatically.

I don't understand. How hard is to set the active platform? It only requires a single click!

Screenshot 2022-11-16 at 12 39 05

Again, including compilation directives in a .dpr file won't work out.

Am I mad or the GUI IO is included in the Linux package?

Screenshot 2022-11-16 at 12 40 23

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

  1. won't work as PythonFMX is currently set to output a .dpr rather than a .so
  2. It ifdef doesn't go in the the .dpr, it goes in the .dproj where it's fine
  3. Doesn't actually produce the output for Linux because of (2) so Linix project compilation including a GUIInputOutput will fail

If you build a simpe Linux app with a GUIInputOutput it won't run (never has without the above mods)

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

  1. OMG why are you compiling PythonFMX? You MUST compile the PythonFMXLinux for LINUX. It is Linux only! Why are you compiling the PythonFMX? It doesn't have Linux enabled. We have talked about it and all the clarification were given.

  2. IFDEF in the .dproj? That is new.

  3. Invalid.

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

Ahh - the problem is that the Linux project has a load of stuff in it it shouldn't have (like VCL etc)

Shouldn't it look more like this?

image

Noting the Win32 install includes the design-time stuff?

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

I'm now testing 11.2 + doing it your way to see if GUI works...

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

The Python package isn't GUI dependent, It shall compile to every platform :D

The VCL one is only intended for Win32 and Win64.

The FMX one is intended to every platform that has FMX GUI natively distributed.

The FMXLinux one is Linux FMX GUI only.

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

I'm now testing 11.2 + doing it your way to see if GUI works...

I bet you will get it working out.

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

10.4.2 all went fine and 11.2 is going well so looks like this issue will be closed shortly

@peardox
Copy link
Contributor Author

peardox commented Nov 16, 2022

Everything apart from Linux checks out (didn't do Max ARM though - I'd have to rent a Mac)

Linux gives me ...
[DCC Fatal Error] Unit1.pas(16): F2051 Unit PyCommon was compiled with a different version of PythonEngine.TPythonEngine

@lmbelo
Copy link
Member

lmbelo commented Nov 16, 2022

You are targeting two different compilations of the same unit. Check your environment out.

This one you will figure out by yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants