Anyone managed making an Appimage build?

Problems building or running the engine, queries about how to use features etc.
User avatar
Crystal Hammer
Orc
Posts: 412
Joined: Sat Jun 23, 2007 5:16 pm
x 122

Anyone managed making an Appimage build?

Post by Crystal Hammer »

Ogre Version: 3.0, not really important
Operating System: any Linux, trying on Debian
Render System: GL3+

So I'm trying to pack Stunt Rally 3 as 1 file universal binary Appimage.
Did anybody manage to do an Appimage? And for Ogre application?
Or an universal Linux binary (supposed to work on any recent Linux Distros), having all binaries and libs included.
I'm doing Appimage for the 2nd time, so I think half of my issues are likely not even Ogre related.

First I did this tutorial:
https://linuxconfig.org/building-a-hell ... e-on-linux
https://docs.appimage.org/packaging-guide/manual.html

So far I did for SR3 is this setup:
(SR3 starts from any path, and finds it's data/ dir basing on binary location started, so it's okay)

resources2.cfg has many paths like:

Code: Select all

FileSystem=data/terrain

and it should work if I cd to my directory on start.

Ogre plugins.cfg now I think requires to be in binary path and started in that path too.
But this shouldn't be a problem since I cd to that path (in AppRun).
plugins.cfg has:

Code: Select all

# Defines plugins to load

# Define plugin folder
PluginFolder=Plugins

# Define plugins

PluginOptional=RenderSystem_GL3Plus
PluginOptional=RenderSystem_Vulkan
PluginOptional=Plugin_ParticleFX

Main file AppRun that's starts game I have so far:

Code: Select all

#!/bin/bash

export SYSTEM_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
cd $APPDIR/usr/bin/

export LD_LIBRARY_PATH="$APPDIR/usr/bin/lib:$LD_LIBRARY_PATH"
exec ./stuntrally3

I've gathered all libs with ldd for SR3 game binary, and I've put them into lib/ dir, that's why I set LD_LIBRARY_PATH.
I should probably do that for all libs dependencies too.
Before that I had first a missing .so for bullet. Now I don't have any but I get a segfault at start. IDK yet why.

Some links I've found but didn't try yet:
reddit post
https://github.com/wheybags/glibc_version_header
https://blog.gibson.sh/2017/11/26/creat ... -binaries/

Last edited by Crystal Hammer on Thu Apr 18, 2024 8:50 pm, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5537
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1395

Re: Anyone managed making an Appimage build?

Post by dark_sylinc »

I don't have much experience with it BUT I could recommend that all dependencies in ogre-next-deps are built as static (and you build ogre-next with OGRE_STATIC = true).

ogre-next-deps doesn't have a static flag (maybe we should?), but we do support a path for all-static build because Android uses it (try to compile for Android and you'll see).

You can verify your dependencies paths with ldd. Particularly troublesome are FreeImage and FreeType, because sometimes the scripts pick up the system-installed versions instead of our custom ones. The same happens with ogg, vorbis, and opus if you link those.

For those cases sometimes creating an alias works (assuming you're compiling them yourself via CMake):

Code: Select all

add_subdirectory( Dependencies/opus )
add_subdirectory( Dependencies/opusfile )

# Use aliases to prevent accidentally linking against system libraries
add_library( opusfile_mine ALIAS opusfile )
add_library( opus_mine ALIAS opus )

target_link_libraries( ${PROJECT_NAME} ${OGRE_LIBRARIES} opusfile_mine opus_mine )

ldd is very useful. For example this is the output of Samples_PbsMaterials in my computer:

Code: Select all

ldd Sample_PbsMaterials
	linux-vdso.so.1 (0x00007fffe616f000)
	libOgreOverlay_d.so.4.0 => /home/matias/Projects/SDK/Ogre2-Hlms-private/build/Debug/lib/libOgreOverlay_d.so.4.0 (0x00007fe1a0f3c000)
	libSDL2-2.0.so.0 => /lib/x86_64-linux-gnu/libSDL2-2.0.so.0 (0x00007fe1a0dca000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe1a0da7000)
	libOgreHlmsPbs_d.so.4.0 => /home/matias/Projects/SDK/Ogre2-Hlms-private/build/Debug/lib/libOgreHlmsPbs_d.so.4.0 (0x00007fe1a0c71000)
	libOgreAtmosphere_d.so.4.0 => /home/matias/Projects/SDK/Ogre2-Hlms-private/build/Debug/lib/libOgreAtmosphere_d.so.4.0 (0x00007fe1a0c5a000)
	libOgreHlmsUnlit_d.so.4.0 => /home/matias/Projects/SDK/Ogre2-Hlms-private/build/Debug/lib/libOgreHlmsUnlit_d.so.4.0 (0x00007fe1a0c0d000)
	libOgreMain_d.so.4.0 => /home/matias/Projects/SDK/Ogre2-Hlms-private/build/Debug/lib/libOgreMain_d.so.4.0 (0x00007fe19f93a000)
	libSM.so.6 => /lib/x86_64-linux-gnu/libSM.so.6 (0x00007fe19f92f000)
	libICE.so.6 => /lib/x86_64-linux-gnu/libICE.so.6 (0x00007fe19f911000)
	libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fe19f7d4000)
	libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007fe19f7bf000)
	libXt.so.6 => /lib/x86_64-linux-gnu/libXt.so.6 (0x00007fe19f554000)
	libXaw.so.7 => /lib/x86_64-linux-gnu/libXaw.so.7 (0x00007fe19f2e0000)
	libXrandr.so.2 => /lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007fe19f2d3000)
	libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fe19f2a9000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe19f2a3000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe19f287000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe19f0a3000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe19ef54000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe19ef39000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe19ed47000)
	libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x00007fe19ec4c000)
	libpulse.so.0 => /lib/x86_64-linux-gnu/libpulse.so.0 (0x00007fe19ebf7000)
	libXcursor.so.1 => /lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007fe19ebe8000)
	libXinerama.so.1 => /lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007fe19ebe3000)
	libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x00007fe19ebd1000)
	libXss.so.1 => /lib/x86_64-linux-gnu/libXss.so.1 (0x00007fe19ebcc000)
	libXxf86vm.so.1 => /lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007fe19ebc5000)
	libwayland-egl.so.1 => /lib/x86_64-linux-gnu/libwayland-egl.so.1 (0x00007fe19ebc0000)
	libwayland-client.so.0 => /lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007fe19ebad000)
	libwayland-cursor.so.0 => /lib/x86_64-linux-gnu/libwayland-cursor.so.0 (0x00007fe19eba2000)
	libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007fe19eb60000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fe1a1042000)
	libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fe19eb57000)
	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fe19eb3d000)
	libXmu.so.6 => /lib/x86_64-linux-gnu/libXmu.so.6 (0x00007fe19eb1f000)
	libXpm.so.4 => /lib/x86_64-linux-gnu/libXpm.so.4 (0x00007fe19eb0a000)
	libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fe19e900000)
	libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fe19e8fa000)
	libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fe19e8f2000)
	libpulsecommon-13.99.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so (0x00007fe19e86e000)
	libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fe19e81d000)
	libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fe19e815000)
	libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007fe19e809000)
	libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fe19e75a000)
	libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007fe19e74c000)
	libsndfile.so.1 => /lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007fe19e6cd000)
	libasyncns.so.0 => /lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007fe19e4c7000)
	libapparmor.so.1 => /lib/x86_64-linux-gnu/libapparmor.so.1 (0x00007fe19e4b2000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe19e4a8000)
	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fe19e47f000)
	liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fe19e45c000)
	libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fe19e33e000)
	libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fe19e321000)
	libFLAC.so.8 => /lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007fe19e2e3000)
	libogg.so.0 => /lib/x86_64-linux-gnu/libogg.so.0 (0x00007fe19e2d6000)
	libvorbis.so.0 => /lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007fe19e2a8000)
	libvorbisenc.so.2 => /lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007fe19e1fb000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fe19e1df000)
	libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fe19e1bc000)

In this case, ogg, vorbis, wayland (OgreNext doesn't yet support Wayland), et al are being linked because of SDL2.
Those implicit dependencies can screw you over if the versions are too different in other distros.

Note that you need to use ldd on all your *.so, since those have dependencies as well.

Valve solved this problem with games for Linux by having multiple images of these files with difference versions, so that LD_LIBRARY_PATH points to them and it just downloads the image version the game needs. They call it the Steam Runtime.