Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2023-11

Cannot build fpc on Raspberry Pi4B running PiOS 64 bit (aarch64 Linux)

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund
Show quoted text 13 lines
From the Lazarus list: Just a quick follow-up here: It seems like the fpc sources have not been updated with the solution to the bug discussed here: https://gitlab.com/freepascal.org/fpc/source/-/issues/39295 This causes the build of Lazarus using fpcupdeluxe with the latest fpc 3.2.2 to fail because of a problem with __libc_csu_init during linking. Apparently it is fixed in non-released sources of fpc which we are waiting for...

The GitLab ticket was opened 2 years ago:
https://gitlab.com/freepascal.org/fpc/source/-/issues/39295

According to a post on the Lazarus forum the fix that solves the fatal error during fpc build on 64 bit aarch64 Linux (like on Raspberry Pi4B with Pi-OS 64 bit) has *not* been ported to the target aarch64 Linux, only to powerpc.

https://forum.lazarus.freepascal.org/index.php/topic,34645.msg496883.html#msg496883

So I am sitting here unable to run Lazarus/FPC on the RPi4B with the latest 64 bit Pi-OS...

Is any solution to this problem in the works?
I have tried every fpc source release from 3.2.2 up to trunk with the exact same result (here from a build try on trunk):

/bin/ld:
/home/bosse/devtools/lazarus/2.2.6/fpcsrc/rtl/units/aarch64-linux/cprt0.o: in function `_start':
(.text+0x54): undefined reference to `__libc_csu_init' /bin/ld: (.text+0x58): undefined reference to `__libc_csu_init' /bin/ld: (.text+0x5c): undefined reference to `__libc_csu_fini' /bin/ld: (.text+0x60): undefined reference to `__libc_csu_fini' make[1]: *** [Makefile:2682: packages_smart] Error 2 make: *** [Makefile:2837: build-stamp.aarch64-linux] Error 2 fpmake.pp(60) Error: Error while linking
fpmake.pp(60) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted

I believe that a lot of people will experience this since the 64 bit OS on RPi4 has been recently released as the *recommended* version on that popular platform...

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote
I have tried every fpc source release from 3.2.2 up to trunk with the exact same result (here from a build try on trunk)

Forgot to mention that I am using fpcupdeluxe when installing fpc/lazarus on my RPi4B with 64 bit Pi-OS bookworm operating system.

Bo Berglund Developer in Sweden

Reply by email

Sven Barth
to Bo Berglund: The GitLab ticket was opened 2 years ago: https://gitlab.com/freepascal.org/fpc/source/-/i…

Bo Berglund via fpc-pascal schrieb am
Do., 16. Nov. 2023, 08:19:

Show quoted text 27 lines
From the Lazarus list: >Just a quick follow-up here: >It seems like the fpc sources have not been updated with the solution to the bug >discussed here: > >https://gitlab.com/freepascal.org/fpc/source/-/issues/39295 > >This causes the build of Lazarus using fpcupdeluxe with the latest fpc 3.2.2 to >fail because of a problem with __libc_csu_init during linking. > >Apparently it is fixed in non-released sources of fpc which we are waiting >for... The GitLab ticket was opened 2 years ago: https://gitlab.com/freepascal.org/fpc/source/-/issues/39295 According to a post on the Lazarus forum the fix that solves the fatal error during fpc build on 64 bit aarch64 Linux (like on Raspberry Pi4B with Pi-OS 64 bit) has *not* been ported to the target aarch64 Linux, only to powerpc. https://forum.lazarus.freepascal.org/index.php/topic,34645.msg496883.html#msg496883

Wrong. Who said that the solution consisted only of a single commit?

Show quoted text 29 lines
So I am sitting here unable to run Lazarus/FPC on the RPi4B with the latest 64 bit Pi-OS... Is any solution to this problem in the works? I have tried every fpc source release from 3.2.2 up to trunk with the exact same result (here from a build try on trunk): /bin/ld: /home/bosse/devtools/lazarus/2.2.6/fpcsrc/rtl/units/aarch64-linux/cprt0.o: in function `_start': (.text+0x54): undefined reference to `__libc_csu_init' /bin/ld: (.text+0x58): undefined reference to `__libc_csu_init' /bin/ld: (.text+0x5c): undefined reference to `__libc_csu_fini' /bin/ld: (.text+0x60): undefined reference to `__libc_csu_fini' make[1]: *** [Makefile:2682: packages_smart] Error 2 make: *** [Makefile:2837: build-stamp.aarch64-linux] Error 2 fpmake.pp(60) Error: Error while linking fpmake.pp(60) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted I believe that a lot of people will experience this since the 64 bit OS on RPi4 has been recently released as the *recommended* version on that popular platform...

I can not reproduce. On a Raspberry OS 10 64-bit I downloaded FPC 3.2.2 for aarch64-linux from SourceForge as well as the sources of both 3.2.3 and 3.3.1 from GitLab.
I install 3.2.2, setup PATH to find the compiler and simply do the following for each 3.2.3 and 3.3.1 (in their corresponding source directories):

make all FPMAKEOPT="-T 4" -j 4
make install INSTALL_PREFIX=/path/for/fpc/<version> - j 4 cd /path/for/fpc/<version>/bin
ln -s .. /lib/fpc/<version>/ppca64 ppca64

(the -T and -j are simply for parallel compilation)

Both 3.2.3 and 3.3.1 (don't forget to set PATH correctly!) can successfully compile a hello world program that links against the C library (in my case by using the cthreads unit) while 3.2.2 can not (as expected).

Regards,
Sven

Reply by email

Bo Berglund
to Sven Barth
Sven Barth wrote 83 lines
Bo Berglund via fpc-pascal schrieb am Do., 16. Nov. 2023, 08:19: > From the Lazarus list: > > >Just a quick follow-up here: > >It seems like the fpc sources have not been updated with the solution to > the bug > >discussed here: > > > >https://gitlab.com/freepascal.org/fpc/source/-/issues/39295 > > > >This causes the build of Lazarus using fpcupdeluxe with the latest fpc > 3.2.2 to > >fail because of a problem with __libc_csu_init during linking. > > > >Apparently it is fixed in non-released sources of fpc which we are waiting > >for... > > The GitLab ticket was opened 2 years ago: > https://gitlab.com/freepascal.org/fpc/source/-/issues/39295 > > According to a post on the Lazarus forum the fix that solves the fatal > error > during fpc build on 64 bit aarch64 Linux (like on Raspberry Pi4B with > Pi-OS 64 > bit) has *not* been ported to the target aarch64 Linux, only to powerpc. > > > https://forum.lazarus.freepascal.org/index.php/topic,34645.msg496883.html#msg496883 Wrong. Who said that the solution consisted only of a single commit? > > So I am sitting here unable to run Lazarus/FPC on the RPi4B with the > latest 64 > bit Pi-OS... > > Is any solution to this problem in the works? > I have tried every fpc source release from 3.2.2 up to trunk with the > exact same > result (here from a build try on trunk): > > /bin/ld: > /home/bosse/devtools/lazarus/2.2.6/fpcsrc/rtl/units/aarch64-linux/cprt0.o: > in > function `_start': > (.text+0x54): undefined reference to `__libc_csu_init' > /bin/ld: (.text+0x58): undefined reference to `__libc_csu_init' > /bin/ld: (.text+0x5c): undefined reference to `__libc_csu_fini' > /bin/ld: (.text+0x60): undefined reference to `__libc_csu_fini' > make[1]: *** [Makefile:2682: packages_smart] Error 2 > make: *** [Makefile:2837: build-stamp.aarch64-linux] Error 2 > fpmake.pp(60) Error: Error while linking > fpmake.pp(60) Fatal: There were 1 errors compiling module, stopping > Fatal: Compilation aborted > > I believe that a lot of people will experience this since the 64 bit OS on > RPi4 > has been recently released as the *recommended* version on that popular > platform... > I can not reproduce. On a Raspberry OS 10 64-bit I downloaded FPC 3.2.2 for aarch64-linux from SourceForge as well as the sources of both 3.2.3 and 3.3.1 from GitLab. I install 3.2.2, setup PATH to find the compiler and simply do the following for each 3.2.3 and 3.3.1 (in their corresponding source directories): make all FPMAKEOPT="-T 4" -j 4 make install INSTALL_PREFIX=/path/for/fpc/<version> - j 4 cd /path/for/fpc/<version>/bin ln -s .. /lib/fpc/<version>/ppca64 ppca64 (the -T and -j are simply for parallel compilation) Both 3.2.3 and 3.3.1 (don't forget to set PATH correctly!) can successfully compile a hello world program that links against the C library (in my case by using the cthreads unit) while 3.2.2 can not (as expected).

Hi Sven,
I realized that my tests were not really isolating the problem tp fpc... I was using fpcupdeluxe for aarch64 to install the Lazarus environment. That always failed with the error I showed.

Today after realizing that I did the following on an RPi4B where I have used apt to install the fpc compiler so I could use that as the seed compiuler to build from sources.

Then I retrieved the fpc 3.2.2 sources from GitLab and extracted them into dir $home/devtools/fpc/3.2.2

Next I ran these two commands in the 3.2.2 directory: make clean FPC="/usr/bin/ppca64" This succeeeded
time make all FPC="/usr/bin/ppca64" This ran for 5m23s and then displayed:

make[3]: Leaving directory '/home/bosse/devtools/fpc/3.2.2/packages/fpmkunit' /home/bosse/devtools/fpc/3.2.2/compiler/ppca64 fpmake.pp -Fu/home/bosse/devtools/fpc/3.2.2/packages/fpmkunit/units_bs/aarch64-linux -Fu/home/bosse/devtools/fpc/3.2.2/rtl/units/aarch64-linux Free Pascal Compiler version 3.2.2 [2023/11/18] for aarch64 Copyright (c) 1993-2021 by Florian Klaempfl and others Target OS: Linux for AArch64
Compiling fpmake.pp
fpmake.pp(16,3) Note: Local variable "T" is assigned but never used Assembling fpmake
Linking fpmake
/usr/bin/ld: /home/bosse/devtools/fpc/3.2.2/rtl/units/aarch64-linux/cprt0.o: in function `_start':
(.text+0x54): undefined reference to `__libc_csu_init' /usr/bin/ld: (.text+0x58): undefined reference to `__libc_csu_init' /usr/bin/ld: (.text+0x5c): undefined reference to `__libc_csu_fini' /usr/bin/ld: (.text+0x60): undefined reference to `__libc_csu_fini' fpmake.pp(60) Error: Error while linking
fpmake.pp(60) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
make[2]: *** [Makefile:1719: fpmake] Error 1
make[2]: Leaving directory '/home/bosse/devtools/fpc/3.2.2/packages' make[1]: *** [Makefile:2682: packages_smart] Error 2 make[1]: Leaving directory '/home/bosse/devtools/fpc/3.2.2' make: *** [Makefile:2837: build-stamp.aarch64-linux] Error 2

Next I downloaded sources for fpc 3.2.3 and repeated the above only to get the same result:

Linking fpmake
/usr/bin/ld: /home/bosse/devtools/fpc/3.2.3/rtl/units/aarch64-linux/cprt0.o: in function `_start':
(.text+0x54): undefined reference to `__libc_csu_init' /usr/bin/ld: (.text+0x58): undefined reference to `__libc_csu_init' /usr/bin/ld: (.text+0x5c): undefined reference to `__libc_csu_fini' /usr/bin/ld: (.text+0x60): undefined reference to `__libc_csu_fini' fpmake.pp(60) Error: Error while linking
fpmake.pp(60) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
make[2]: *** [Makefile:1719: fpmake] Error 1
make[2]: Leaving directory '/home/bosse/devtools/fpc/3.2.3/packages' make[1]: *** [Makefile:2682: packages_smart] Error 2 make[1]: Leaving directory '/home/bosse/devtools/fpc/3.2.3' make: *** [Makefile:2837: build-stamp.aarch64-linux] Error 2

So it seems like the error I described is there also with a command line build as shown. Something in my envoronment might be off, but I don't know what. I have just installed the operating system and used apt to get a working fpc compiler so I could install the latest Lazarus, but I really usually want to have both fpc and lazarus in my user space rather as system wide tools. That is why I want to build fpc from sources. I have done this for 10 years or so...

What do you mean exactly when you say "don't forget to set PATH correctly!"

PATH is usually set by the system, right?
But I specified to use the apt installed compiler as the seed for compiling fpc, is that incorrect?

Currently it looks like this:
/home/bosse/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

Bo Berglund Developer in Sweden

Reply by email

Sven Barth
to Bo Berglund

Bo Berglund via fpc-pascal schrieb am
Sa., 18. Nov. 2023, 11:32:

Show quoted text 6 lines
Today after realizing that I did the following on an RPi4B where I have used apt to install the fpc compiler so I could use that as the seed compiuler to build from sources.

Why don't you simply follow what I DID? First of deinstall that apt fpc again. Then download 3.2.2 for aarch64-linux from SourceForge, install it and add /path/to/where/you/installed/fpc/bin to your PATH (using "export PATH=/new/path:$PATH").
Best pick in an installation path like /wherever/fpc/<version> and select "yes" when asked whether to adjust the fpc.cfg with $fpcversion, that will come in handy later.

Next download the sources for 3.2.3 and extract them somewhere different than "/wherever/fpc". Change into that directory and execute the commands as I had written in my previous mail (you should be in the same command line session where you adjusted PATH for this to work otherwise you need to set it again). The INSTALL_PREFIX should be "/wherever/fpc/3.2.3".

Next set your PATH again, but this time use the directory for 3.2.3 ("echo $PATH" plus selecting and pasting is your friend here, cause you don't want to *extend* your path, but replace it; or simply start a new console windows and append the path there now that I think about it 😅).

Now you should have a working FPC and you can compile Lazarus from source (sorry, don't know how to setup fpcupdeluxe to use an existing compiler, cause I don't use it).

In Lazarus you then also need to set the path to your compiler.

Regards,
Sven

Reply by email

Bo Berglund
to Sven Barth
Sven Barth wrote 14 lines
Bo Berglund via fpc-pascal schrieb am Sa., 18. Nov. 2023, 11:32: > Today after realizing that I did the following on an RPi4B where I have > used apt > to install the fpc compiler so I could use that as the seed compiuler to > build > from sources. > Why don't you simply follow what I DID? First of deinstall that apt fpc again. Then download 3.2.2 for aarch64-linux from SourceForge, install it and add /path/to/where/you/installed/fpc/bin to your PATH (using "export PATH=/new/path:$PATH").

Here I lost you, is SF still in use? I thought that everything moved to GitLab some time ago?
And is there something like "install" in Linux apart from apt install which is what I used?

Show quoted text 21 lines
Best pick in an installation path like /wherever/fpc/<version> and select "yes" when asked whether to adjust the fpc.cfg with $fpcversion, that will come in handy later. Next download the sources for 3.2.3 and extract them somewhere different than "/wherever/fpc". Change into that directory and execute the commands as I had written in my previous mail (you should be in the same command line session where you adjusted PATH for this to work otherwise you need to set it again). The INSTALL_PREFIX should be "/wherever/fpc/3.2.3". Next set your PATH again, but this time use the directory for 3.2.3 ("echo $PATH" plus selecting and pasting is your friend here, cause you don't want to *extend* your path, but replace it; or simply start a new console windows and append the path there now that I think about it ?). Now you should have a working FPC and you can compile Lazarus from source (sorry, don't know how to setup fpcupdeluxe to use an existing compiler, cause I don't use it). In Lazarus you then also need to set the path to your compiler.

I might have this wrong, but in that case I have been for many (10+) years...

I always put my sources in a place like $HOME/devtools/fpc/x.y.z and $HOME/devtools/lazarus/x.y.z

And I use make install pointing to a place below $HOME as well...

When installing from sources you have a hen-and-egg problem since you need a seed compiler on the pristine target system.

Usually I have been using a compiler from an earlier build on a similar system but in this case I did not have one for 64 bit Pi-OS. First time on 64 bit.

So I tried using fpcupdeluxe instead with the results shown.

But then I checked if I could get the compiler via apt and that did succeed and I could use it to build Lazarus itself.

And Lazarus works with this compiler on the target system.

Now I figured I had a seed compiler so I should be able to build a new fpc compiler from sources using the commands I had always used in the past, but this is where it went astray as shown.

I did not know that there is a library of seed compilers available on Sourceforge, I thought everything had moved over to GitLab nowadays, so where exactly can I find a binary download for PiOS 64 bit on SF? Where I have looked I only find old stuff like from 2021...

https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/ Here are tarballs that by the size seem to contain a lot of stuff apart from the compiler itself.

Bo Berglund Developer in Sweden

Reply by email

Tomas Hajny
to Bo Berglund

On November 21, 2023 8:33:55 +0100, Bo Berglund via fpc-pascal wrote:

.
.

Here I lost you, is SF still in use? I thought that everything moved to GitLab some time ago?

SF is still used for distribution of releases, see download links on FPC web pages. This has nothing to do with migration of the source code repositories to GitLab - we never used SF for hosting our source code repositories.

And is there something like "install" in Linux apart from apt install which is what I used?

Well, yes, you can obviously still provide installation packages independently from your distribution which may be delayed due to different release cycles.

.
.

I always put my sources in a place like $HOME/devtools/fpc/x.y.z and $HOME/devtools/lazarus/x.y.z

That's fine.

.
.

When installing from sources you have a hen-and-egg problem since you need a seed compiler on the pristine target system.

Yes, but we provide not only seed compilers (for some platforms), but also (more importantly) full FPC releases and also snapshots.

.
.

Show quoted text 8 lines
I did not know that there is a library of seed compilers available on Sourceforge, I thought everything had moved over to GitLab nowadays, so where exactly can I find a binary download for PiOS 64 bit on SF? Where I have looked I only find old stuff like from 2021... https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/ Here are tarballs that by the size seem to contain a lot of stuff apart from the compiler itself.

Yes, there are full official releases provided by the FPC team and used by many FPC users.

Tomas

Reply by email

Bo Berglund
to Tomas Hajny
Tomas Hajny wrote 12 lines
On November 21, 2023 8:33:55 +0100, Bo Berglund via fpc-pascal wrote: >I did not know that there is a library of seed compilers available on >Sourceforge, I thought everything had moved over to GitLab nowadays, so where >exactly can I find a binary download for PiOS 64 bit on SF? >Where I have looked I only find old stuff like from 2021... > >https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/ >Here are tarballs that by the size seem to contain a lot of stuff apart from the >compiler itself. Yes, there are full official releases provided by the FPC team and used by many FPC users.

I tried downloading one of the ones on SF and it contains a maze of other tar file with yet other tar files etc inside.

I failed to locate the actual compiler executable file anywhere, so I gave up on that....

Instead I have put tgz files on my own website for each compiler I hhave found/built to be used as seed compilers in the future.

Bo Berglund Developer in Sweden

Reply by email

Sven Barth
to Bo Berglund

Bo Berglund via fpc-pascal schrieb am
Sa., 25. Nov. 2023, 08:19:

Show quoted text 28 lines
On Tue, 21 Nov 2023 10:33:46 +0100, Tomas Hajny via fpc-pascal wrote: >On November 21, 2023 8:33:55 +0100, Bo Berglund via fpc-pascal < > wrote: >>I did not know that there is a library of seed compilers available on >>Sourceforge, I thought everything had moved over to GitLab nowadays, so where >>exactly can I find a binary download for PiOS 64 bit on SF? >>Where I have looked I only find old stuff like from 2021... >> >>https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/ >>Here are tarballs that by the size seem to contain a lot of stuff apart from the >>compiler itself. > >Yes, there are full official releases provided by the FPC team and used by many FPC users. > I tried downloading one of the ones on SF and it contains a maze of other tar file with yet other tar files etc inside. I failed to locate the actual compiler executable file anywhere, so I gave up on that....

Why do you need to make things more complicated than necessary? Extract the tar you downloaded and execute the install script located there. Anything else leaves the approach I have tested and confirmed to work for you.

For a successful compilation a *complete* release is necessary anyway (well, you can deselect the documentation and demoes during the installation :P).

Regards,
Sven

Reply by email