Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can not build fpc for aarch64 on raspberry pi 4
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 407

PostPosted: Sun Sep 01, 2019 9:30 am    Post subject: Can not build fpc for aarch64 on raspberry pi 4 Reply with quote

Has anyone succeeded to compile fpc on aarch64 for raspberry pi 4 ?
I get the same error trying to compile fpc-3.2.0 no matter if a use fpcupdeluxe (tried both 1.6.2x and 1.6.2y) or if manually compile it on a chroot using static-user qemu on gentoo amd64 machine. Root or normal user make no difference using fpcupdeluxe.

The error is:
Code:
make packages_smart FPC=/root/fpcupdeluxe/fpcsrc/compiler/ppca64 FPCFPMAKE=/root/fpcupdeluxe/fpcsrc/compiler/ppca64 RELEASE=1 'OPT=-Sg -vw-n-h-l-d-u-t-p-c-'
make -C packages smart
make -C fpmkunit bootstrap
/root/fpcupdeluxe/fpcsrc/compiler/ppca64 src/fpmkunit.pp -Fu/root/fpcupdeluxe/fpcsrc/rtl/units/aarch64-linux -FUunits_bs/aarch64-linux -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src -Fi../fcl-process/src/unix -Fu../fcl-process/src -Fi../fcl-process/src/linux -Fi../fcl-process/src/dummy -Fu../libtar/src -Sg -vw-n-h-l-d-u-t-p-c-
/root/fpcupdeluxe/fpcsrc/compiler/ppca64 fpmake.pp -Fu/root/fpcupdeluxe/fpcsrc/packages/fpmkunit/units_bs/aarch64-linux -Fu/root/fpcupdeluxe/fpcsrc/rtl/units/aarch64-linux -Sg -vw-n-h-l-d-u-t-p-c-
/usr/bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): in function __libc_csu_init': (.text+0x4c): undefined reference to _init'
fpmake.pp(49) Error: Error while linking
fpmake.pp(49) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[1]: *** [Makefile:2681: packages_smart] Error 2
make: *** [Makefile:2836: build-stamp.aarch64-linux] Error 2

fpcupdeluxe: ERROR: FPCNativeInstaller (CleanModule: FPC): Error running make for FPC failed with exit code 512
. Details:

ERROR: Fpcupdeluxe fatal error !

Tried with 3.3.1, 3.2.0, but the same error keep appear and posted the issue on github @fpcupdeluxe, too.

Thank you!

[Moderator edit: added [code] tags to preserve output layout. -Hu]
_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Sun Sep 01, 2019 10:11 am    Post subject: Reply with quote

costel78,

Looking at the ebuild for fpc-3.0.4 it tries to download an arch specific binary to use in the build process.
Following the amd64 location, there is no arm64 prebuilt binary.

fpc is rather like rust, gcc and other things that are written in themselves.
I suspect that fpc is written in fpc.

That leaves cross compiling, which is the only way to port these things to a new architecture.
Cross compiling using the ebuild fails too. That's fairly common.
Its not clever enough to use the amd64 binary to build an arm64 binary so that arm64 can build its own.

I don't have time to poke at that right now but its probably not trivial.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 407

PostPosted: Sun Sep 01, 2019 11:43 am    Post subject: Reply with quote

NeddySeagoon,

Yes, it is not trivial. Stable branches for both freepscal and lazarus do not support aarch64.
fpc-3.2.0-beta and lazarus 2.1.0 branch are required, minimum, so I am not trying to compile them using an ebuild.
I downloaded sources, fpcbuild and already compiled snapshot - aarch64-linux/fpc-3.2.0-beta.aarch64-linux.tar.gz and tried to compiled them in aarch64 chroot on amd64 machine.
Compile failed at the 3rd stage, no mater what branch I used: trunk, fixes3.2 or 3.3.1 so I looked for alternatives and I found fpcupdeluxe.
Using fpcupdeluxe on raspberry itself or on chroot gave me the same error as above:
Code:
/usr/bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): in function __libc_csu_init': (.text+0x4c): undefined reference to _init'

On arm (32 bits) using fpcupdeluxe the error does not appear.

I am looking for an explanation of what I am doing wrong, or a patch if it is a freepascal error.

Thank you for your support!
_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
Gavinmc42
n00b
n00b


Joined: 23 Sep 2019
Posts: 21
Location: Brisbane

PostPosted: Mon Sep 23, 2019 11:15 am    Post subject: Reply with quote

I am hoping when FPC 3.2 is officially released the minimum build for Lazarus goes up to 3.2.
Then is should be easier.

At the moment the binary aarch64 3.3.1 version works and I can compile simple stuff with Geany.
As Sakaki's Gentoo64 has better OpenGL support(and seems more reliable than current Buster 32/64 )I'm looking forwards to trying that on Gentoo64 and not Buster 32.
_________________
Don't get Pi's if you are scared of learning.
Back to top
View user's profile Send private message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 407

PostPosted: Wed Sep 25, 2019 1:26 pm    Post subject: Reply with quote

Yes, I am hoping this too, but 2.0 ver does not support aarch64.
Using binary precompiled fpc-3.2 beta I am able to compile Lazarus 2.1.0 from svn. But this is not "the Gentoo way" where everything is compiled from source.
_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
Gavinmc42
n00b
n00b


Joined: 23 Sep 2019
Posts: 21
Location: Brisbane

PostPosted: Wed Sep 25, 2019 10:14 pm    Post subject: Reply with quote

I was having a lot of fun on Buster using fpc and doing OpenGL coding.
Laz/fpc build from source is the normal way, it;s just the build tool needs to work on Arm64.
Not sure how ebuild/Laz/fpc works, don't know enough about Gentoo yet.
Anyway there is some new stuff in Mesa 19.3 that will be nice to try.

Guess we have to wait.
_________________
Don't get Pi's if you are scared of learning.
Back to top
View user's profile Send private message
Gavinmc42
n00b
n00b


Joined: 23 Sep 2019
Posts: 21
Location: Brisbane

PostPosted: Thu Sep 26, 2019 12:28 am    Post subject: Reply with quote

Or learn how to use 32bit chroot.
Sakaki has got it to work that way. o
Since my Pi baremetal fpc stuff is only 32bit at the moment perhaps chroot is next for me to learn in Gentoo.
_________________
Don't get Pi's if you are scared of learning.
Back to top
View user's profile Send private message
Gavinmc42
n00b
n00b


Joined: 23 Sep 2019
Posts: 21
Location: Brisbane

PostPosted: Thu Sep 26, 2019 3:13 am    Post subject: Reply with quote

Link to Sakaki's 32bit chroot wiki and an example of installing a 32bit app that just happens to be Lazarus :D
https://github.com/sakaki-/gentoo-on-rpi-64bit/wiki/Running-32-bit-Raspbian-Packages-on-your-64-bit-Gentoo-System

I probably should try this now, 32bit chroots could be handy.
Wonder how it will go with the new Buster?
_________________
Don't get Pi's if you are scared of learning.
Back to top
View user's profile Send private message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 407

PostPosted: Thu Sep 26, 2019 11:03 am    Post subject: Reply with quote

First, thank you for your support.

Right now, 32 bits chroot is a bit unpractical, for my needs. I built my own arm32 and arm64 gentoo, both using precompiled fpc and ebuild compiled lazarus. Lazarus is needed only for compile, for client just binary app is all they want. I am not using OpenGL to much, BGRABitmap and related are ok on raspberry, just a little slower than on x86.
The goal was to reduce costs using raspberry, so I had to adapt/recompile some older app to work on raspberry/Gentoo OS. Not using Lazarus to much, anymore, doing web development lately. The main issue with freepascal was that you have to keep a list of installed files as the things will evolve and, at some point in the future, an ebuild will be available and manually installed files will have to be removed. They provide an installer, but not an uninstaller :)
_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
Gavinmc42
n00b
n00b


Joined: 23 Sep 2019
Posts: 21
Location: Brisbane

PostPosted: Thu Sep 26, 2019 1:00 pm    Post subject: Reply with quote

Yep love those fpc binaries.
Clients wants a change I can fix and compile in minutes and even emailed one fixed OS to Russia from Oz.
That has to be a record long distance mod for me.

I have not done much fpc on Gentoo yet, a few years only IDE on Windows, running on Pi's.
Never had any luck with BGRABitmap, I keep breaking my Lazarus IDEs.

FPVectorial is getting more interesting.

WebGL on Pi4 works especially in Sakaki's Gentoo64.
I so want to learn things like three.js
Looking at fc/js tools now.
Can I embedded a JS interpreter in my apps/OS? Besen's lib?

While fpc/laz installs are big they are portable, even run from USB stick.
Some OS's install them in /usr/... trying to fix those drives me crazy.
fpcupdeluxe tends to install in user directories, a bit easier to figure out.

A Portable USB install that runs on every x86/arm/arch box would be nice.
_________________
Don't get Pi's if you are scared of learning.
Back to top
View user's profile Send private message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 407

PostPosted: Mon Sep 30, 2019 7:17 am    Post subject: Reply with quote

Regarding JS interpreter there are a native pas2js and it was quite good when used it.
Yep, portability and static linking are great and made me to choose Lazarus over Java.
_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
n1ese
Tux's lil' helper
Tux's lil' helper


Joined: 29 Sep 2019
Posts: 82

PostPosted: Mon Nov 25, 2019 4:11 pm    Post subject: Reply with quote

Anyone making any progress on building FPC on aarch64 on a Pi 4?

I have an application I'd like to build that requires it. There are 32-bit binaries of the application for the Pi 3 but it is not the current version that has bug fixes I need.
Back to top
View user's profile Send private message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 407

PostPosted: Mon Nov 25, 2019 7:35 pm    Post subject: Reply with quote

You can build it manually, you can use precompiled binaries for 3.2.0 (installed on /usr/local), or can use fpcupdeluxe.
I was unable to compile Lazarus on aarch64 - linker error during build.
_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
dieselnutjob
n00b
n00b


Joined: 06 Oct 2020
Posts: 2

PostPosted: Tue Oct 06, 2020 10:11 pm    Post subject: Reply with quote

I managed it with Manjaro on a Pinebook pro.
The instructions are in a post in this thread
https://forums.gentoo.org/viewtopic-t-1111322.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum