[fpc-pascal] Cannot build fpc on Raspberry Pi4B running PiOS 64 bit (aarch64 Linux)

Sven Barth pascaldragon at googlemail.com
Fri Nov 17 11:27:53 CET 2023


Bo Berglund via fpc-pascal <fpc-pascal at lists.freepascal.org> 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).

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20231117/d3e536d4/attachment.htm>


More information about the fpc-pascal mailing list