Problems compiling static bin on aarch64 Linux using CI config
Hi everyone, ive been trying to build a static linked linux build and failing at it for weeks now. Using the current CI config to build a executable that is as static linked as the official builds is not currently possible.
This is the current config in CI CXXFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas -static-libstdc++" CFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas"
export CXXFLAGS export CFLAGS
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFSO_BUILD_APPIMAGE=ON -DFSO_BUILD_WITH_VULKAN=OFF -DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=OFF -DSHADERS_ENABLE_COMPILATION=ON ..
Now, using the cmake option "-DFFMPEG_USE_PRECOMPILED=ON" ends up with trying to ld a x86 lib
[100%] Linking CXX executable ../../bin/unittests
/usr/bin/ld: ../../lib/prebuilt/ffmpeg/lib/libavcodec.so.57.107.100: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [test/src/CMakeFiles/unittests.dir/build.make:689: bin/unittests] Error 1
make[1]: *** [CMakeFiles/Makefile2:1469: test/src/CMakeFiles/unittests.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
And using "-DFSO_BUILD_INCLUDED_LIBS=ON" fails on the libpng
/usr/bin/ld: ../bin/../lib/libpng/CMakeFiles/png.dir/pngrtran.c.o: in function `png_do_read_transformations':
pngrtran.c:(.text.png_do_read_transformations+0x103c): undefined reference to `png_do_expand_palette_rgba8_neon'
/usr/bin/ld: pngrtran.c:(.text.png_do_read_transformations+0x11c4): undefined reference to `png_riffle_palette_neon'
/usr/bin/ld: pngrtran.c:(.text.png_do_read_transformations+0x2824): undefined reference to `png_do_expand_palette_rgb8_neon'
/usr/bin/ld: ../bin/../lib/libpng/CMakeFiles/png.dir/pngrutil.c.o: in function `png_read_filter_row':
pngrutil.c:(.text.png_read_filter_row+0xb0): undefined reference to `png_init_filter_functions_neon'
collect2: error: ld returned 1 exit status
make[2]: *** [freespace2/CMakeFiles/Freespace2.dir/build.make:160: bin/fs2_open_23_3_0_x64] Error 1
make[1]: *** [CMakeFiles/Makefile2:1343: freespace2/CMakeFiles/Freespace2.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
What i belive it may be a issue with the libpng version on source, maybe needs updating?
And it is very unclear to me what " -DFSO_BUILD_APPIMAGE=ON" actually does because removing those two problematic options the builds finishes successfully, but i dont see an appimage generated anywere. Just the regular build executable.
The prebuilt libs don't have arm versions for any platform yet. On macOS the holdup is a working freetype lib, on Windows it requires a much newer version of SDL2 than we use so it doesn't matter yet, and on Linux the previous libs I made aren't good to use on older distros and so need to be redone.
The png problem is known and is just a general arm build issue where neon needs to be disabled. I'm sitting on numerous arm fixes that were waiting for post-stable but I haven't had the chance to deal with them yet. But this patch is enough to get png working at least:
diff --git a/lib/libpng/CMakeLists.txt b/lib/libpng/CMakeLists.txt
index 2a445353d..94c4d4f5d 100644
--- a/lib/libpng/CMakeLists.txt
+++ b/lib/libpng/CMakeLists.txt
@@ -41,6 +41,8 @@ IF (FSO_BUILD_INCLUDED_LIBS OR NOT PNG_FOUND)
target_include_directories(png SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(png PRIVATE "_CRT_SECURE_NO_WARNINGS;$<$<CONFIG:Debug>:PNG_DEBUG=1>")
+ target_compile_definitions(png PRIVATE PNG_ARM_NEON_IMPLEMENTATION=0) # Disable NEON to fix Mac ARM builds
+ target_compile_definitions(png PRIVATE PNG_ARM_NEON_OPT=0)
IF(BUILD_SHARED_LIBS)
target_compile_definitions(png INTERFACE PNG_BUILD_DLL)
Well i dont know what else to do really, that diff allowed to compile with the included libpng (i still belive that the newerest version fixes that because the dynamic linked one from system works fine), but no visible change sin the final executable with ldd reporting this
ldd fs2_open_23_3_0_x64 linux-vdso.so.1 (0x0000ffff9c61d000) libopenal.so.1 => /lib/aarch64-linux-gnu/libopenal.so.1 (0x0000ffff9a500000) libavcodec.so.58 => /lib/aarch64-linux-gnu/libavcodec.so.58 (0x0000ffff99350000) libavformat.so.58 => /lib/aarch64-linux-gnu/libavformat.so.58 (0x0000ffff990b0000) libavutil.so.56 => /lib/aarch64-linux-gnu/libavutil.so.56 (0x0000ffff98df0000) libswscale.so.5 => /lib/aarch64-linux-gnu/libswscale.so.5 (0x0000ffff98d60000) libswresample.so.3 => /lib/aarch64-linux-gnu/libswresample.so.3 (0x0000ffff98d30000) libfreetype.so.6 => /lib/aarch64-linux-gnu/libfreetype.so.6 (0x0000ffff98c60000) libSDL2-2.0.so.0 => /lib/aarch64-linux-gnu/libSDL2-2.0.so.0 (0x0000ffff98ac0000) libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff98a20000) libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffff989f0000) libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff98840000) /lib/ld-linux-aarch64.so.1 (0x0000ffff9c5e4000) libsndio.so.7 => /lib/aarch64-linux-gnu/libsndio.so.7 (0x0000ffff98810000) libvpx.so.7 => /lib/aarch64-linux-gnu/libvpx.so.7 (0x0000ffff985e0000) libwebpmux.so.3 => /lib/aarch64-linux-gnu/libwebpmux.so.3 (0x0000ffff985c0000) libwebp.so.7 => /lib/aarch64-linux-gnu/libwebp.so.7 (0x0000ffff98560000) liblzma.so.5 => /lib/aarch64-linux-gnu/liblzma.so.5 (0x0000ffff98520000) libdav1d.so.5 => /lib/aarch64-linux-gnu/libdav1d.so.5 (0x0000ffff98420000) librsvg-2.so.2 => /lib/aarch64-linux-gnu/librsvg-2.so.2 (0x0000ffff97a80000) libgobject-2.0.so.0 => /lib/aarch64-linux-gnu/libgobject-2.0.so.0 (0x0000ffff97a00000) libglib-2.0.so.0 => /lib/aarch64-linux-gnu/libglib-2.0.so.0 (0x0000ffff978b0000) libcairo.so.2 => /lib/aarch64-linux-gnu/libcairo.so.2 (0x0000ffff97780000) libzvbi.so.0 => /lib/aarch64-linux-gnu/libzvbi.so.0 (0x0000ffff976e0000) libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffff976b0000) libsnappy.so.1 => /lib/aarch64-linux-gnu/libsnappy.so.1 (0x0000ffff97690000) libaom.so.3 => /lib/aarch64-linux-gnu/libaom.so.3 (0x0000ffff97340000) libcodec2.so.1.0 => /lib/aarch64-linux-gnu/libcodec2.so.1.0 (0x0000ffff96480000) libgsm.so.1 => /lib/aarch64-linux-gnu/libgsm.so.1 (0x0000ffff96460000) libmp3lame.so.0 => /lib/aarch64-linux-gnu/libmp3lame.so.0 (0x0000ffff963e0000) libopenjp2.so.7 => /lib/aarch64-linux-gnu/libopenjp2.so.7 (0x0000ffff96370000) libopus.so.0 => /lib/aarch64-linux-gnu/libopus.so.0 (0x0000ffff96300000) libshine.so.3 => /lib/aarch64-linux-gnu/libshine.so.3 (0x0000ffff962e0000) libspeex.so.1 => /lib/aarch64-linux-gnu/libspeex.so.1 (0x0000ffff962b0000) libtheoraenc.so.1 => /lib/aarch64-linux-gnu/libtheoraenc.so.1 (0x0000ffff96270000) libtheoradec.so.1 => /lib/aarch64-linux-gnu/libtheoradec.so.1 (0x0000ffff96240000) libtwolame.so.0 => /lib/aarch64-linux-gnu/libtwolame.so.0 (0x0000ffff96200000) libvorbis.so.0 => /lib/aarch64-linux-gnu/libvorbis.so.0 (0x0000ffff961c0000) libvorbisenc.so.2 => /lib/aarch64-linux-gnu/libvorbisenc.so.2 (0x0000ffff96100000) libx264.so.163 => /lib/aarch64-linux-gnu/libx264.so.163 (0x0000ffff95eb0000) libx265.so.199 => /lib/aarch64-linux-gnu/libx265.so.199 (0x0000ffff95bf0000) libxvidcore.so.4 => /lib/aarch64-linux-gnu/libxvidcore.so.4 (0x0000ffff95af0000) libva.so.2 => /lib/aarch64-linux-gnu/libva.so.2 (0x0000ffff95ab0000) libxml2.so.2 => /lib/aarch64-linux-gnu/libxml2.so.2 (0x0000ffff958c0000) libbz2.so.1.0 => /lib/aarch64-linux-gnu/libbz2.so.1.0 (0x0000ffff95890000) libgme.so.0 => /lib/aarch64-linux-gnu/libgme.so.0 (0x0000ffff95830000) libopenmpt.so.0 => /lib/aarch64-linux-gnu/libopenmpt.so.0 (0x0000ffff95680000) libchromaprint.so.1 => /lib/aarch64-linux-gnu/libchromaprint.so.1 (0x0000ffff95660000) libbluray.so.2 => /lib/aarch64-linux-gnu/libbluray.so.2 (0x0000ffff955f0000) libgnutls.so.30 => /lib/aarch64-linux-gnu/libgnutls.so.30 (0x0000ffff953f0000) librabbitmq.so.4 => /lib/aarch64-linux-gnu/librabbitmq.so.4 (0x0000ffff953c0000) libsrt-gnutls.so.1.4 => /lib/aarch64-linux-gnu/libsrt-gnutls.so.1.4 (0x0000ffff95300000) libssh-gcrypt.so.4 => /lib/aarch64-linux-gnu/libssh-gcrypt.so.4 (0x0000ffff95260000) libzmq.so.5 => /lib/aarch64-linux-gnu/libzmq.so.5 (0x0000ffff951c0000) libva-drm.so.2 => /lib/aarch64-linux-gnu/libva-drm.so.2 (0x0000ffff951a0000) libva-x11.so.2 => /lib/aarch64-linux-gnu/libva-x11.so.2 (0x0000ffff95180000) libvdpau.so.1 => /lib/aarch64-linux-gnu/libvdpau.so.1 (0x0000ffff95160000) libX11.so.6 => /lib/aarch64-linux-gnu/libX11.so.6 (0x0000ffff95010000) libdrm.so.2 => /lib/aarch64-linux-gnu/libdrm.so.2 (0x0000ffff94fe0000) libOpenCL.so.1 => /lib/aarch64-linux-gnu/libOpenCL.so.1 (0x0000ffff94fc0000) libsoxr.so.0 => /lib/aarch64-linux-gnu/libsoxr.so.0 (0x0000ffff94f50000) libpng16.so.16 => /lib/aarch64-linux-gnu/libpng16.so.16 (0x0000ffff94f00000) libbrotlidec.so.1 => /lib/aarch64-linux-gnu/libbrotlidec.so.1 (0x0000ffff94ee0000) libasound.so.2 => /lib/aarch64-linux-gnu/libasound.so.2 (0x0000ffff94dc0000) libpulse.so.0 => /lib/aarch64-linux-gnu/libpulse.so.0 (0x0000ffff94d60000) libXext.so.6 => /lib/aarch64-linux-gnu/libXext.so.6 (0x0000ffff94d30000) libXcursor.so.1 => /lib/aarch64-linux-gnu/libXcursor.so.1 (0x0000ffff94d10000) libXinerama.so.1 => /lib/aarch64-linux-gnu/libXinerama.so.1 (0x0000ffff94cf0000) libXi.so.6 => /lib/aarch64-linux-gnu/libXi.so.6 (0x0000ffff94cc0000) libXfixes.so.3 => /lib/aarch64-linux-gnu/libXfixes.so.3 (0x0000ffff94ca0000) libXrandr.so.2 => /lib/aarch64-linux-gnu/libXrandr.so.2 (0x0000ffff94c80000) libXss.so.1 => /lib/aarch64-linux-gnu/libXss.so.1 (0x0000ffff94c60000) libXxf86vm.so.1 => /lib/aarch64-linux-gnu/libXxf86vm.so.1 (0x0000ffff94c40000) libgbm.so.1 => /lib/aarch64-linux-gnu/libgbm.so.1 (0x0000ffff94c20000) libwayland-egl.so.1 => /lib/aarch64-linux-gnu/libwayland-egl.so.1 (0x0000ffff94c00000) libwayland-client.so.0 => /lib/aarch64-linux-gnu/libwayland-client.so.0 (0x0000ffff94be0000) libwayland-cursor.so.0 => /lib/aarch64-linux-gnu/libwayland-cursor.so.0 (0x0000ffff94bc0000) libxkbcommon.so.0 => /lib/aarch64-linux-gnu/libxkbcommon.so.0 (0x0000ffff94b60000) libdecor-0.so.0 => /lib/aarch64-linux-gnu/libdecor-0.so.0 (0x0000ffff94b40000) libbsd.so.0 => /lib/aarch64-linux-gnu/libbsd.so.0 (0x0000ffff94b10000) libcairo-gobject.so.2 => /lib/aarch64-linux-gnu/libcairo-gobject.so.2 (0x0000ffff94af0000) libgdk_pixbuf-2.0.so.0 => /lib/aarch64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x0000ffff94ab0000) libgio-2.0.so.0 => /lib/aarch64-linux-gnu/libgio-2.0.so.0 (0x0000ffff948b0000) libpangocairo-1.0.so.0 => /lib/aarch64-linux-gnu/libpangocairo-1.0.so.0 (0x0000ffff94890000) libpango-1.0.so.0 => /lib/aarch64-linux-gnu/libpango-1.0.so.0 (0x0000ffff94810000) libffi.so.8 => /lib/aarch64-linux-gnu/libffi.so.8 (0x0000ffff947f0000) libpcre.so.3 => /lib/aarch64-linux-gnu/libpcre.so.3 (0x0000ffff94770000) libpixman-1.so.0 => /lib/aarch64-linux-gnu/libpixman-1.so.0 (0x0000ffff946f0000) libfontconfig.so.1 => /lib/aarch64-linux-gnu/libfontconfig.so.1 (0x0000ffff94690000) libxcb-shm.so.0 => /lib/aarch64-linux-gnu/libxcb-shm.so.0 (0x0000ffff94670000) libxcb.so.1 => /lib/aarch64-linux-gnu/libxcb.so.1 (0x0000ffff94630000) libxcb-render.so.0 => /lib/aarch64-linux-gnu/libxcb-render.so.0 (0x0000ffff94610000) libXrender.so.1 => /lib/aarch64-linux-gnu/libXrender.so.1 (0x0000ffff945f0000) libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffff943c0000) libogg.so.0 => /lib/aarch64-linux-gnu/libogg.so.0 (0x0000ffff943a0000) libnuma.so.1 => /lib/aarch64-linux-gnu/libnuma.so.1 (0x0000ffff94370000) libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffff94350000) libicuuc.so.70 => /lib/aarch64-linux-gnu/libicuuc.so.70 (0x0000ffff94140000) libmpg123.so.0 => /lib/aarch64-linux-gnu/libmpg123.so.0 (0x0000ffff940e0000) libvorbisfile.so.3 => /lib/aarch64-linux-gnu/libvorbisfile.so.3 (0x0000ffff940c0000) libudfread.so.0 => /lib/aarch64-linux-gnu/libudfread.so.0 (0x0000ffff940a0000) libp11-kit.so.0 => /lib/aarch64-linux-gnu/libp11-kit.so.0 (0x0000ffff93f50000) libidn2.so.0 => /lib/aarch64-linux-gnu/libidn2.so.0 (0x0000ffff93f20000) libunistring.so.2 => /lib/aarch64-linux-gnu/libunistring.so.2 (0x0000ffff93d60000) libtasn1.so.6 => /lib/aarch64-linux-gnu/libtasn1.so.6 (0x0000ffff93d30000) libnettle.so.8 => /lib/aarch64-linux-gnu/libnettle.so.8 (0x0000ffff93cd0000) libhogweed.so.6 => /lib/aarch64-linux-gnu/libhogweed.so.6 (0x0000ffff93c70000) libgmp.so.10 => /lib/aarch64-linux-gnu/libgmp.so.10 (0x0000ffff93be0000) libssl.so.3 => /lib/aarch64-linux-gnu/libssl.so.3 (0x0000ffff93b30000) libcrypto.so.3 => /lib/aarch64-linux-gnu/libcrypto.so.3 (0x0000ffff93730000) libgcrypt.so.20 => /lib/aarch64-linux-gnu/libgcrypt.so.20 (0x0000ffff93640000) libgpg-error.so.0 => /lib/aarch64-linux-gnu/libgpg-error.so.0 (0x0000ffff93600000) libgssapi_krb5.so.2 => /lib/aarch64-linux-gnu/libgssapi_krb5.so.2 (0x0000ffff935a0000) libsodium.so.23 => /lib/aarch64-linux-gnu/libsodium.so.23 (0x0000ffff93550000) libpgm-5.3.so.0 => /lib/aarch64-linux-gnu/libpgm-5.3.so.0 (0x0000ffff934f0000) libnorm.so.1 => /lib/aarch64-linux-gnu/libnorm.so.1 (0x0000ffff933b0000) libgomp.so.1 => /lib/aarch64-linux-gnu/libgomp.so.1 (0x0000ffff93350000) libbrotlicommon.so.1 => /lib/aarch64-linux-gnu/libbrotlicommon.so.1 (0x0000ffff93310000) libpulsecommon-15.99.so => /usr/lib/aarch64-linux-gnu/pulseaudio/libpulsecommon-15.99.so (0x0000ffff93280000) libdbus-1.so.3 => /lib/aarch64-linux-gnu/libdbus-1.so.3 (0x0000ffff93220000) libwayland-server.so.0 => /lib/aarch64-linux-gnu/libwayland-server.so.0 (0x0000ffff931f0000) libexpat.so.1 => /lib/aarch64-linux-gnu/libexpat.so.1 (0x0000ffff931b0000) libmd.so.0 => /lib/aarch64-linux-gnu/libmd.so.0 (0x0000ffff93190000) libgmodule-2.0.so.0 => /lib/aarch64-linux-gnu/libgmodule-2.0.so.0 (0x0000ffff93170000) libjpeg.so.8 => /lib/aarch64-linux-gnu/libjpeg.so.8 (0x0000ffff93110000) libmount.so.1 => /lib/aarch64-linux-gnu/libmount.so.1 (0x0000ffff930b0000) libselinux.so.1 => /lib/aarch64-linux-gnu/libselinux.so.1 (0x0000ffff93070000) libpangoft2-1.0.so.0 => /lib/aarch64-linux-gnu/libpangoft2-1.0.so.0 (0x0000ffff93040000) libharfbuzz.so.0 => /lib/aarch64-linux-gnu/libharfbuzz.so.0 (0x0000ffff92f60000) libfribidi.so.0 => /lib/aarch64-linux-gnu/libfribidi.so.0 (0x0000ffff92f30000) libthai.so.0 => /lib/aarch64-linux-gnu/libthai.so.0 (0x0000ffff92f10000) libuuid.so.1 => /lib/aarch64-linux-gnu/libuuid.so.1 (0x0000ffff92ef0000) libXau.so.6 => /lib/aarch64-linux-gnu/libXau.so.6 (0x0000ffff92ed0000) libXdmcp.so.6 => /lib/aarch64-linux-gnu/libXdmcp.so.6 (0x0000ffff92eb0000) libicudata.so.70 => /lib/aarch64-linux-gnu/libicudata.so.70 (0x0000ffff91280000) libkrb5.so.3 => /lib/aarch64-linux-gnu/libkrb5.so.3 (0x0000ffff911a0000) libk5crypto.so.3 => /lib/aarch64-linux-gnu/libk5crypto.so.3 (0x0000ffff91160000) libcom_err.so.2 => /lib/aarch64-linux-gnu/libcom_err.so.2 (0x0000ffff91140000) libkrb5support.so.0 => /lib/aarch64-linux-gnu/libkrb5support.so.0 (0x0000ffff91120000) libsndfile.so.1 => /lib/aarch64-linux-gnu/libsndfile.so.1 (0x0000ffff91090000) libX11-xcb.so.1 => /lib/aarch64-linux-gnu/libX11-xcb.so.1 (0x0000ffff91070000) libsystemd.so.0 => /lib/aarch64-linux-gnu/libsystemd.so.0 (0x0000ffff90f90000) libasyncns.so.0 => /lib/aarch64-linux-gnu/libasyncns.so.0 (0x0000ffff90f70000) libapparmor.so.1 => /lib/aarch64-linux-gnu/libapparmor.so.1 (0x0000ffff90f40000) libblkid.so.1 => /lib/aarch64-linux-gnu/libblkid.so.1 (0x0000ffff90ef0000) libpcre2-8.so.0 => /lib/aarch64-linux-gnu/libpcre2-8.so.0 (0x0000ffff90e50000) libgraphite2.so.3 => /lib/aarch64-linux-gnu/libgraphite2.so.3 (0x0000ffff90e20000) libdatrie.so.1 => /lib/aarch64-linux-gnu/libdatrie.so.1 (0x0000ffff90e00000) libkeyutils.so.1 => /lib/aarch64-linux-gnu/libkeyutils.so.1 (0x0000ffff90de0000) libresolv.so.2 => /lib/aarch64-linux-gnu/libresolv.so.2 (0x0000ffff90db0000) libFLAC.so.8 => /lib/aarch64-linux-gnu/libFLAC.so.8 (0x0000ffff90d60000) libzstd.so.1 => /lib/aarch64-linux-gnu/libzstd.so.1 (0x0000ffff90c90000) liblz4.so.1 => /lib/aarch64-linux-gnu/liblz4.so.1 (0x0000ffff90c60000) libcap.so.2 => /lib/aarch64-linux-gnu/libcap.so.2 (0x0000ffff90c40000)
I tried to add -static to cflags and cxxflags and it fails because OpenAL on system is dynamic linking, thats the same problem i have when i try to compile a static version of the old 3.7.2 version.
Not sure if the diference is the appimage process, no idea really, that dosent run here. Or at least i dont see it.
Ok as for the AppImage, it is not being generated, so i got the appimagetool bin and tryied to create it myself
So i ended up with this script mkdir build cd build
wget https://raw.githubusercontent.com/scp-fs2open/fs2open.github.com/master/freespace2/resources/app_icon.png
CXXFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas -static-libstdc++" CFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas"
export CXXFLAGS export CFLAGS
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFSO_BUILD_APPIMAGE=ON -DFSO_BUILD_WITH_VULKAN=OFF -DFSO_BUILD_TESTS=ON -DFSO_BUILD_QTFRED=OFF -DSHADERS_ENABLE_COMPILATION=ON ..
make -j8
cd ..
appimagetool /home/ubuntu/new/fs2open.github.com/build/ fs2_open_23_3_0_x64.AppImage
It generates the appimage but when i try to run it i get a:
execv error: No such file or directory
That said, not sure if this solves the issue of the shared libs or not.
An AppImage source has to be a specific directory structure with specific file requirements. I'm not really familiar with how FSO does AppImage stuff, but as far as I can tell the -DFSO_BUILD_APPIMAGE=ON option basically just adds an install step to create that structure and put the right files in the right places.
The FSO workflows use https://github.com/scp-fs2open/fs2open.github.com/blob/master/ci/linux/generate_appimage.sh to create the final AppImage file. It takes one argument, which is the output directory to create the directory structure in and where the resulting AppImage file is saved.
As far as your ldd output goes, I just looked at what a FSO binary from the AppImage looks like and it's nearly identical. The ffmpeg libs (at least the prebuilt ones) are installed in the AppImage along with the FSO bin, but that's all. The rest looks to be from the system SDL2, OpenAL, and freetype libs. So there are still a ton of dynamic libs there even in the official AppImage. Compatibility is just making sure to build on as old a distro as possible.
i think the only reason why the appimage generated with CI works is because the executable is packed along the "*.a" files that are just static versions of the libs needed compiled from source here.
The appimage needs the install step. So you compile like you're doing, then you install to a location, then use appimagetool on that location to create the appimage file itself. The ci script for this can be run locally without modification.
Assuming you have everything built and are in the build directory (adjust the path as needed), you can call ../ci/linux/generate_appimage.sh install and it will create the appimage in the install directory. And it doesn't have to be named "install", it can be just whatever directory you want.
Oh, and arm64 should work out-of-the-box now too. No patches, modifications, or tweaks needed. The ffmpeg prebuilt libs are there now too for arm64 so you can use those with -DFFMPEG_USE_PRECOMPILED=ON to reduce the dependency on system libs.
is adding a arm64 linux bins to official builds planned? I dont think there are issues.
Yes it's planned, but due to how things are set up with the CI there are a lot of steps involved to make it happen, which means a lot of potential to break stuff. So I'm waiting until after this release cycle before seriously working on it. I'll have a large portion of the work done locally by then though, it's mainly going to depend on the docker stuff.