[fpc-pascal] How to build for arm6 in RaspberryPi on arm7?

Bo Berglund bo.berglund at gmail.com
Wed Sep 9 23:47:28 CEST 2020


On Wed, 09 Sep 2020 17:34:14 +0200, Tomas Hajny via fpc-pascal
<fpc-pascal at lists.freepascal.org> 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



More information about the fpc-pascal mailing list