Skip to content

Conversation

@k8ieone
Copy link

@k8ieone k8ieone commented Nov 15, 2024

This PR adds support for building ARM64 Linux natives. All of the libraries except SDL2 are cross-compiled. SDL2 is built in an ARM Docker container emulated using QEMU user-mode emulation.

I made sure the changes won't interfere with compiling on x86. When compiling on x86 the SDL2 build is skipped.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move this somewhere else to avoid polluting the root directory?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing! I'd go for either the .github folder if GitHub doesn't mind or some other folder like .ci or something in that spirit.

Do you have a place in mind for it?

@cdeletre
Copy link

Nice work ! With your modifications I've been able to build libarc-freetypearm64.so, libarc-filedialogsarm64.so, libarcarm64.so and libsdl-arcarm64.so pack them into the jar and run it on my raspberry pi400. I'm not very used to this gradlew things and I don't know what I'm doing wrong but I had to patchelf the libsdl-arcarm64.so to add libGLEW.so as required (patchelf --add-needed libGLEW.so.2.2 backends/backend-sdl/libs/linuxarm64/libsdl-arcarm64.so). It seems that during the build -lGLEW is not used which could be the reason however I can't get it to build if I add it in backends/backend-sdl/build.gradle (line 130)

Also I'm looking at how to build a linux arm64 version that uses SDL2 + OpenGLES2 without GLEW instead of SDL2 + OpenGL + GLEW. I'm thinking of that because I contribute a lot in PortMaster, a project where we port games to linux arm device (console mostly) which don't have a display manager (we use SDL2 KMS/DRM with GLES). Any tip on this will be highly welcome :)

Again thanks @k8ieone for your work !

Comment on lines -82 to -90
add(Linux, x64){
cppFlags += " " + execCmd("sdl2-config --cflags")
cFlags = cppFlags
//NOTE: for this to statically link properly, you need to add -L/path/to/folder/with/custom/libSDL2.a
//where this folder contains a custom build of SDL2 with the -fPIC flag (added to the makefile in the cflags section after configure)
//--static-libs and ?.replace("-lSDL2", "-l:libSDL2.a")
libraries = execCmd("sdl2-config --libs") + " -Wl,-Bdynamic -lGL "
linkerFlags = "-shared -m64"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @k8ieone! I am looking into syncing your PR with upstream, and found this strange diff: you seem to have moved this gradle job lower in the file.

I just wanted to know if it is deliberate or just a mistake

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it was intentional. It looks like I reused the if(System.getProperty("os.arch") != "aarch64") condition that already existed for MacOS.

DodoLeDev added a commit to DodoLeDev/Arc4ARM that referenced this pull request Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants