Re: [fpc-pascal] How to build for arm6 in RaspberryPi on arm7?
On Wed, 09 Sep 2020 17:34:14 +0200, Tomas Hajny via fpc-pascal wrote: >> Question: >> Can I make a parallel installation of FPC and Lazarus on my RPi4 which >> is using the Armv6 settings during the make and thus get a system that >> will produce compatible programs? >> >> Or do I have to scrap the existing installation altogether and then >> reinstall using Armv6 setrtings? > >You don't need a different installation (although that might be an >option as well), but you do need a different build of the RTL and >packages. The concept of sub-architectures is supposed to help with >this, but I don't know how far is the support in fp(c)make and the >compiler. It may be done manually without any special support e.g. by >renaming the directory with original RTL and packages, building the RTL >and packages again with the required parameters and possibly renaming >that one as well. Once you're finished with that, you may want to either >modify your fp.cfg so that the paths to units, etc., are IFDEFed there, >or you may remove all (sub)architecture dependent settings from the >default configuration file, place these settings to two other >configuration files containing settings for particular >(sub)architectures and always specify the '@' option with the right >configuration file when invoking the compiler. > OK, I conducted an experiment tonight, it took a while: 1) Grabbed a new SDcard and wrote PiOS Lite on it. 2) Configured the SDcard in another RPi4 where I can access all of the new SD and put my favourite .bashrc and init scripts etc on it. 3) Then I put my installation script for Fpc/Lazarus on it and edited it so it would install 3.0.4 and 2.0.8 and specified the Armv6 target when it ran. 4) The full installation including installing subversion and all dependencies before retrieving the fpc and lazarus sources via svn and building both and crteating the menu desktop entry took 18 minutes. 5) Inside Lazarus I then used OnLinePackageManager to install the extra packages I need all the time. 6) Finally I retrieved the sources for my test project too and opened it and built it successfully. And this version works in both RPi4 and RPiZeroW! :-) BOTTOM LINE: For development targeting any RPi version install fpc and lazarus using the ARMv6 flags to make in both cases. What are the ramifications of not using a higher ARMvx number? Will the application perform worse and if so in what way? I am not working on projects that need high perfoprmance in terms of speed anyway. I just want as snappy a dev IDE (==Lazarus) as possible... Back to my original dev RPi4: - Fpc and Lazarus were built using make in the source dirs and using the ARMv7 flag. Now I would like to change it to be like the one described above. So can I just enter the 3.0.4 source dir and execute a make clean followed by the make commands used when building for ARMv6? What about make install in FPC? Will it overwrite whatever stuff it wrote into ~/lib/fpc/3.0.4 and ~/share/...? Is this the proper way to change the installation from v7 to v6? -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On 2020-09-09 17:59, Mattias Gaertner via fpc-pascal wrote: On Wed, 09 Sep 2020 17:44:11 +0200 Tomas Hajny via fpc-pascal wrote: . . The implicit conversion is explicitly expected by the user in this case if I understand it correctly (source in CP1250), right? If you mean the "non implicit conversion" requires explicit conversion by the user, then yes. No, I mean that the original poster explicitly mentioned that he expected the implicit conversion to be performed as necessary when he specified that his source code was in CP1250. Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On 09/09/2020 17:37, Mattias Gaertner via fpc-pascal wrote: > On Wed, 09 Sep 2020 17:25:09 +0200 > Tomas Hajny via fpc-pascal wrote: > >> On 2020-09-09 13:51, LacaK via fpc-pascal wrote: >> [...] >> A simple question - is TLabel.Caption declared as Utf8String (I don't >> use Lazarus)? _Then_ it should work without any issues and/or special >> attention from users. > > Declaring as UTF8String would insert implicit conversion code for all > String (CP_ACP), so basically everywhere. If the dynamic code page of the assigned string was already CP_UTF8 (or CP_ACP with DefaultSystemCodePage = CP_UTF8), no actual conversion will happen though. Is the overhead of that extra bit of code really noticeable? And is it worth the confusion and inconvenience? Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On Wed, 09 Sep 2020 17:44:11 +0200 Tomas Hajny via fpc-pascal wrote: > On 2020-09-09 17:37, Mattias Gaertner via fpc-pascal wrote: > > On Wed, 09 Sep 2020 17:25:09 +0200 > > Tomas Hajny via fpc-pascal wrote: > > > >> On 2020-09-09 13:51, LacaK via fpc-pascal wrote: > >> [...] > >> A simple question - is TLabel.Caption declared as Utf8String (I > >> don't use Lazarus)? _Then_ it should work without any issues > >> and/or special attention from users. > > > > Declaring as UTF8String would insert implicit conversion code for > > all String (CP_ACP), so basically everywhere. > > Everywhere except when used with other Utf8string variables and > constants. True. > The implicit conversion is explicitly expected by the user > in this case if I understand it correctly (source in CP1250), right? If you mean the "non implicit conversion" requires explicit conversion by the user, then yes. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On 2020-09-09 17:37, Mattias Gaertner via fpc-pascal wrote: On Wed, 09 Sep 2020 17:25:09 +0200 Tomas Hajny via fpc-pascal wrote: On 2020-09-09 13:51, LacaK via fpc-pascal wrote: [...] A simple question - is TLabel.Caption declared as Utf8String (I don't use Lazarus)? _Then_ it should work without any issues and/or special attention from users. Declaring as UTF8String would insert implicit conversion code for all String (CP_ACP), so basically everywhere. Everywhere except when used with other Utf8string variables and constants. The implicit conversion is explicitly expected by the user in this case if I understand it correctly (source in CP1250), right? Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On 2020-09-09 17:30, Bart via fpc-pascal wrote: On Wed, Sep 9, 2020 at 5:25 PM Tomas Hajny via fpc-pascal wrote: A simple question - is TLabel.Caption declared as Utf8String No. No wonder that the implicit conversion doesn't work then. Adding an explicit conversion would be another possible option, although obviously tedious. Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On Wed, 09 Sep 2020 17:25:09 +0200 Tomas Hajny via fpc-pascal wrote: > On 2020-09-09 13:51, LacaK via fpc-pascal wrote: >[...] > A simple question - is TLabel.Caption declared as Utf8String (I don't > use Lazarus)? _Then_ it should work without any issues and/or special > attention from users. Declaring as UTF8String would insert implicit conversion code for all String (CP_ACP), so basically everywhere. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to build for arm6 in RaspberryPi on arm7?
On 2020-09-09 14:43, Bo Berglund via fpc-pascal wrote: On Wed, 09 Sep 2020 00:03:29 +0200, Bo Berglund via fpc-pascal wrote: No, it is on an RPi4 so it is ArmV7. In fact I have been told on the RPi forum RPi4 is Armv8 Armv6: Pi0, PiB, PiA+ Armv7: Pi2Bv1.1 Armv8: Pi2Bv1.2, Pi3, Pi4 But they could not advice how to use a newer RPi (higher numbered arm) to build an application that could run on earlier arm versions such as on the RPiZero. They referred back here. Anyway I used the Fpc/Lazarus installation I had done on the PiZero and opened the test project as checked out from svn. It could be built on the RPiZero and when I ran it (started from a terminal rather than from Lazarus) it worked as it should. So: If I install Fpc and Lazarus from sources as I always do and specify ArmV6 in the process on the RPiZero, then it will make an application that works fine there. And when I transfer it to the RPi4 (using scp) it works fine also there... Question: Can I make a parallel installation of FPC and Lazarus on my RPi4 which is using the Armv6 settings during the make and thus get a system that will produce compatible programs? Or do I have to scrap the existing installation altogether and then reinstall using Armv6 setrtings? You don't need a different installation (although that might be an option as well), but you do need a different build of the RTL and packages. The concept of sub-architectures is supposed to help with this, but I don't know how far is the support in fp(c)make and the compiler. It may be done manually without any special support e.g. by renaming the directory with original RTL and packages, building the RTL and packages again with the required parameters and possibly renaming that one as well. Once you're finished with that, you may want to either modify your fp.cfg so that the paths to units, etc., are IFDEFed there, or you may remove all (sub)architecture dependent settings from the default configuration file, place these settings to two other configuration files containing settings for particular (sub)architectures and always specify the '@' option with the right configuration file when invoking the compiler. Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On Wed, Sep 9, 2020 at 5:25 PM Tomas Hajny via fpc-pascal wrote: > A simple question - is TLabel.Caption declared as Utf8String No. -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On 2020-09-09 13:51, LacaK via fpc-pascal wrote: > This is a bit counter intuitive to me. It is explained here: https://wiki.freepascal.org/Unicode_Support_in_Lazarus IMO "c4" case (c4: String1250 = 'áéíóčž';) is not fully explained. Probably what here happens is, that declared code page of c4 = source file code page and in that case compiler does not insert conversion code. StringCodePage(c4)=1250 (also StringCodePage(c2)=1250) so dynamic code page is right, but when assigning to TLabel.Caption current dynamic code page is not taken into account A simple question - is TLabel.Caption declared as Utf8String (I don't use Lazarus)? _Then_ it should work without any issues and/or special attention from users. Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to build for arm6 in RaspberryPi on arm7?
On Wed, 09 Sep 2020 00:03:29 +0200, Bo Berglund via fpc-pascal wrote: >No, it is on an RPi4 so it is ArmV7. In fact I have been told on the RPi forum RPi4 is Armv8 Armv6: Pi0, PiB, PiA+ Armv7: Pi2Bv1.1 Armv8: Pi2Bv1.2, Pi3, Pi4 But they could not advice how to use a newer RPi (higher numbered arm) to build an application that could run on earlier arm versions such as on the RPiZero. They referred back here. Anyway I used the Fpc/Lazarus installation I had done on the PiZero and opened the test project as checked out from svn. It could be built on the RPiZero and when I ran it (started from a terminal rather than from Lazarus) it worked as it should. So: If I install Fpc and Lazarus from sources as I always do and specify ArmV6 in the process on the RPiZero, then it will make an application that works fine there. And when I transfer it to the RPi4 (using scp) it works fine also there... Question: Can I make a parallel installation of FPC and Lazarus on my RPi4 which is using the Armv6 settings during the make and thus get a system that will produce compatible programs? Or do I have to scrap the existing installation altogether and then reinstall using Armv6 setrtings? -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
> This is a bit counter intuitive to me. It is explained here: https://wiki.freepascal.org/Unicode_Support_in_Lazarus IMO "c4" case (c4: String1250 = 'áéíóčž';) is not fully explained. Probably what here happens is, that declared code page of c4 = source file code page and in that case compiler does not insert conversion code. StringCodePage(c4)=1250 (also StringCodePage(c2)=1250) so dynamic code page is right, but when assigning to TLabel.Caption current dynamic code page is not taken into account For LacaK I recommend using UTF-8 encoding as much as possible. Then everything "/just works/". yes I use this, but I have "one" specific case where I want share one file between Delphi7 and Lazarus You could have a unit or .inc file with WinCP constants for Delphi7, and then some IFDEFs. They should be explicitly converted to UTF-8 for LCL. UnicodeString constants can also be a good solution. It triggers an automatic conversion when assigned to a String variable. The conversion is usually fast enough. Yes this is what I use (WideString constants) and it is only solution which works for me in Delphi7/Lazarus Thanks L. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On Wed, Sep 9, 2020 at 11:40 AM Bart via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > This is a bit counter intuitive to me. It is explained here: https://wiki.freepascal.org/Unicode_Support_in_Lazarus For LacaK I recommend using UTF-8 encoding as much as possible. Then everything "*just works*". You could have a unit or .inc file with WinCP constants for Delphi7, and then some IFDEFs. They should be explicitly converted to UTF-8 for LCL. UnicodeString constants can also be a good solution. It triggers an automatic conversion when assigned to a String variable. The conversion is usually fast enough. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] String literals and code page of .pas source file
On Wed, Sep 9, 2020 at 8:37 AM LacaK via fpc-pascal wrote: > I am still confused how this CodePage aware stuff is expected to work and > when implicit conversios are included (as far as I understand here ONLY > declared/static codepage plays role) and when dynamic codepage is taken into > account and when not? You are not the only one. Given that I am on Lazarus, so all my source files are UTF8 encoded I got confused by this: unit1 {$codepage utf8} interface const msCopy = 'Kopiëren...'; Than in main program: Label1.Caption := msgCopy; This does not show the text correctly. I have to include {$codepage utf8} in the source code file that contains the "Label1.Caption := msgCopy;" otherwise it does not display correctly. So basically I have that in all source code that does display text (in a GUI). And if I do so, I can omit the codepage directive in unit1. This is a bit counter intuitive to me. -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal