flare-engine icon indicating copy to clipboard operation
flare-engine copied to clipboard

Shipping a binary Linux version

Open dorkster opened this issue 6 years ago • 9 comments

We should look into shipping a binary Linux version with the game data bundled. Possibly using something like AppImage or Flatpak, but those may require some changes to our hard-coded paths. Of course, a simple tarball may make more sense.

dorkster avatar Mar 12 '18 17:03 dorkster

In the meantime, I've put together a quick x86_64 tarball. I built it on Ubuntu 16.04LTS and tried to include all the necessary libraries based on ldd output and what we include for Windows builds. Thankfully our dependency tree is simple, so I don't think I missed anything.

We might stick with this over using AppImage or Flatpak. It's pretty simple in our case, and I like simple.

dorkster avatar Mar 12 '18 22:03 dorkster

I created a Flatpak manifest:

{
	"app-id": "org.flarerpg.Flare",
	"rename-desktop-file": "flare.desktop",
	"rename-icon": "flare",
	"runtime": "org.freedesktop.Platform",
	"runtime-version": "1.6",
	"sdk": "org.freedesktop.Sdk",
	"command": "flare.sh",
	"finish-args": [
		"--socket=wayland",
		"--socket=x11",
		"--share=ipc",
		"--socket=pulseaudio",
		"--device=dri"
	],
	"build-options": {
		"cflags": "-O2",
		"cxxflags": "-O2"
	},
	"cleanup": [
		"/lib/debug",
		"/share/man"
	],
	"modules": [
		{
			"name": "flare-engine",
			"buildsystem": "cmake-ninja",
			"sources": [
				{
					"type": "archive",
					"url": "https://github.com/clintbellanger/flare-engine/archive/v1.0.tar.gz",
					"sha256": "4bbd4674513b643be6294188904665c53f0ef2912e803212c05e8fd22a44d74d"
				}
			],
			"post-install": [
				"mkdir /app/bin",
				"mv /app/games/flare /app/bin",
				"yes | rm -r /app/games"
			]
		},
		{
			"name": "flare-game",
			"buildsystem": "cmake-ninja",
			"sources": [
				{
					"type": "archive",
					"url": "https://github.com/clintbellanger/flare-game/archive/v1.0.tar.gz",
					"sha256": "5c8e9d72fcbe59f1861f79ac7b76ceffe3ec61d1df241c32d9133fe158fba4c1"
				},
				{
					"type": "file",
					"path": "org.flarerpg.Flare.appdata.xml"
				}
			],
			"post-install": [
				"install -Dm644 org.flarerpg.Flare.appdata.xml /app/share/appdata/org.flarerpg.Flare.appdata.xml",
				"echo \"flare --mods=fantasycore,empyrean_campaign --data-path=/app/share/games/flare\" > /app/bin/flare.sh",
				"chmod +x /app/bin/flare.sh",
				"desktop-file-edit --set-key=Exec --set-value=flare.sh /app/share/applications/flare.desktop"
			]
		},
		{
		"name": "SDL2",
		"config-opts": ["--enable-sdl-dlopen",
				"--disable-arts",
				"--disable-esd",
				"--disable-nas",
				"--enable-pulseaudio",
				"--disable-alsa",
				"--disable-oss",
				"--disable-sndio",
				"--disable-libudev",
				"--enable-video-wayland",
				"--enable-wayland-shared=no"],
		"cleanup-platform": ["/bin/sdl2-config"],
		"sources": [
			{
				"type": "archive",
				"url": "http://www.libsdl.org/release/SDL2-2.0.7.tar.gz",
				"sha256": "ee35c74c4313e2eda104b14b1b86f7db84a04eeab9430d56e001cea268bf4d5e"
			}
		]
		}
	]
}

SDL2 is already in the runtime, it's still version 2.0.6 though. But there's already a pull request, after that's merged, SDL can be removed from this manifest.

Would you like to submit this to Flathub? In that case you'd need to create a pull request here: https://github.com/flathub and add this metadata file: https://github.com/clintbellanger/flare-game/pull/717

Alexander-Wilms avatar Mar 14 '18 00:03 Alexander-Wilms

As commented on the flatpak thread, SDL is at release 2.0.8, which I believe is what I compiled the MacOS binary against, and what is distributed in the MacOS DMG. Also, three other SDL libraries are included as .frameworks, SDL_ttf, SDL_image, and SDL_mixer (at various 2.x versions). Are these not necessary for including in the flatpak manifest?

tvleavitt avatar Mar 16 '18 07:03 tvleavitt

These are included in the Sdk as well: https://github.com/flatpak/freedesktop-sdk-images/blob/1.6/org.freedesktop.Sdk.json.in#L2389

Alexander-Wilms avatar Mar 16 '18 12:03 Alexander-Wilms

If you're interested in using the snap format, I have a call for testing at https://forum.snapcraft.io/t/call-for-testing-flare-an-open-source-2d-rpg/4516 . We could polish this up for upstream distribution whenever the audio bug is fixed in snapd, if you're happy with it?

mcphail avatar Mar 16 '18 23:03 mcphail

@mcphail Sure. Even if we don't provide the snap ourselves, it'd be nice to have a script for building the snap in the distribution/ directory.

dorkster avatar Mar 17 '18 00:03 dorkster

Hello. I've tried to download "Engine (x86_64) + Game (131.2 MB)" package from http://flarerpg.org/index.php/download/ . After unpacking and running ./flare.sh I've got notice of several missing libraries (the game won't start):

./x86_64/flare.x86_64: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./x86_64/flare.x86_64)
./x86_64/flare.x86_64: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by x86_64/libSDL2-2.0.so.0)
./x86_64/flare.x86_64: /lib/x86_64-linux-gnu/libdbus-1.so.3: no version information available (required by x86_64/libfluidsynth.so.1)
./x86_64/flare.x86_64: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by x86_64/libjack.so.0)

It seems some of my installed libraries are a bit older then required ( I'm using Debian :) ). I was able to recompile Flare on my system and run the game, so the problem was solved.

Still, could you consider to include the necessary libraries in the game tarball?

noooway avatar Mar 17 '18 04:03 noooway

@noooway The Linux binary that we provide is built on Ubuntu 16.04 LTS. I'm not sure if it's appropriate to bundle some of those libs. I think we could add libxkbcommon.so.0 and libdbus-1.so.3 without issue, but we can't just bundle libstdc++.so.6. Instead, we'd have to compile on an older distro with an older g++.

Considering that the push for 1.0 was initiated by a Debian packager, it might just make more sense to wait until it makes into the repos. Are you using sid, or are you using one of the more stable channels?

dorkster avatar Mar 17 '18 05:03 dorkster

The Linux binary that we provide is built on Ubuntu 16.04 LTS. I'm not sure if it's appropriate to bundle some of those libs. I think we could add libxkbcommon.so.0 and libdbus-1.so.3 without issue, but we can't just bundle libstdc++.so.6. Instead, we'd have to compile on an older distro with an older g++.

Ok, I see. So this is not that simple as including a couple of additional libraries ...

Are you using sid, or are you using one of the more stable channels?

Still on Jessie. gcc --version outputs gcc (Debian 4.9.2-10+deb8u1) 4.9.2 Installed version of libstdc++-6 is also 4.9.2-10+deb8u1 Also I've found the following command strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX which might be of some relevance in this case. The output is

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
... ( and so on up to ) ...
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_DEBUG_MESSAGE_LENGTH

Indeed, `GLIBCXX_3.4.21' is missing.

Considering that the push for 1.0 was initiated by a Debian packager, it might just make more sense to wait until it makes into the repos.

I was able to solve the problem for myself by compiling the engine from source. This is fine for me. My comment was more of FYI-type, so that you can keep in mind that there might be problems with your current binary distribution on certain systems.

noooway avatar Mar 17 '18 06:03 noooway