Compiling ZGE for linux ARM / aarch64

All topics about ZGameEditor goes here.

Moderator: Moderators

User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Compiling ZGE for linux ARM

Post by Ats »

All right, thank you. I'm trying that on all my systems and tell you how it's going :D

Edit:
I also needed to add -Fu/usr/local/lib/fpc/3.3.1/units/aarch64-linux/x11/ as x is needed by sdl2.pas (line 146)

Then the compilation halts on 4 errors:
ZPlatform_SDL.inc(221,15) Error: Identifier not found "SDL_GetEnv"
ZPlatform_SDL.inc(343,51) Error: Illegal expression
ZPlatform_SDL.inc(345,24) Error: Identifier not found "MixBufferSamplesSize"
ZPlatform_SDL.inc(345,46) Error: Can't evaluate constant expression
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Compiling ZGE for linux ARM

Post by VilleK »

Strange errors. Please try again, I made some small changes.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Compiling ZGE for linux ARM

Post by Ats »

Thanks to those changes, the bin file is working fine on raspberry 3 (aarch64 linux) :D
I'm still trying to run it on the RG351 console.

Edit:
Just a note in case I forget one day, you need to install libsdl2-dev to compile ZGE.
Attachments
Player_linux_aarch64.zip
(228.48 KiB) Downloaded 171 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Compiling ZGE for linux ARM / aarch64

Post by VilleK »

That is great :)

What are the problems remaining now for RG351?
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Compiling ZGE for linux ARM / aarch64

Post by Ats »

It's working but it displays a black screen.
I've checked for the location of libsdl2 and libgl. They are present. I think I need to tell where to look at in a sh script before launching the elf.
There is no help for that on the internet so I'm looking at how AnberPorts is doing with his scripts.

example: https://raw.githubusercontent.com/krish ... sc/AM2R.sh
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Compiling ZGE for linux ARM / aarch64

Post by Ats »

So I had a bit of time to manage to run the RG351 in console mode (Quit menu > Quit Emulationstation) and see what's going on.
Here's the result when I launch the simple ZGE cube test:

librga:RGE_GET_VERSION:4.00,4.000000
ctx=0x23518eb0,ctx->rgaFd=3
Rga built version:version:+2017-09-28 10:12:42
An unhandled exception occurred at $0000007F7557F99C:
EAccessViolation: Access violation
$0000007F7557F99C
$0000000000415198
$0000000000414FD4
$00000000004098BC
$0000000000412CB0
$000000000041AAB0
$00000000004098BC
$0000000000401098
$0000007F7B0E83EC
$0000000000401038

I'm not sure what to do with that result, but now I know that sh scripts can't be written on Windows, because afterwards Linux don't understand Windows carriage return \r
I wasted a bit of time with that...


Edit:
I searched for the location of the needed libraries on ArkOS:

libSDL2-2.0.so.0
/usr/lib/aarch64-linux-gnu/libSDL2-2.0.so.0.10.0
/usr/lib/aarch64-linux-gnu/libSDL2-2.0.so.0.14.1
/usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0.10.0

libdl.so.2
/usr/lib/aarch64-linux-gnu/libdl-2.30.so
/usr/lib/arm-linux-gnueabihf/libdl-2.30.so

libX11.so.6
/usr/lib/aarch64-linux-gnu/libX11.so.6
/usr/lib/aarch64-linux-gnu/libX11.so.6.3.0
/usr/lib/arm-linux-gnueabihf/libX11.so.6
/usr/lib/arm-linux-gnueabihf/libX11.so.6.3.0

libc.so.6
/usr/lib/aarch64-linux-gnu/libc.so.6
/usr/lib/arm-linux-gnueabihf/libc.so.6


So I made a sh script to check for those before launching the elf:

#!/bin/bash
export LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu
exec ./ZGE/cube_aarch64

But it doesn't like my LD_LIBRARY_PATH...

file /dev/mali0 is not compatible version (user 10.6, kernel 11.7)
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
Could not initialize EGL
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Compiling ZGE for linux ARM / aarch64

Post by Ats »

Meanwhile, here's ZGE running fine on Raspberry pi 3:

PXL_20210421_123926152~2.jpg
PXL_20210421_123926152~2.jpg (2.13 MiB) Viewed 3445 times

I just have one question for building more examples, what would External library ModuleName for opengl32 be on linux ?
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Compiling ZGE for linux ARM / aarch64

Post by VilleK »

That looks awesome :). Every time ZGE runs on a new platform is worth celebrating.

About opengl32 on Linux, I would expect it to just be "libGL" and then it is up to the OS to make sure the executable loads system libraries from the appropriate folder (32-bit system libraries folder when running 32-bit binary on 64-bit OS).
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Compiling ZGE for linux ARM / aarch64

Post by Ats »

Just putting "libGL" isn't working.
I replaced that by the full "/usr/lib/aarch64-linux-gnu/libGL.so" which works, but it's not practical.
And I ended up with the simple "libGL.so" which works perfectly, whatever the linux target 8)

By the way, did you see my tests for new BuiltinConstants? It would be very handy. What am I doing wrong?
Post Reply