Libc problems when running an old dosbox from gog.com

Hi all-

I need some help figuring out how to run a packaged GOG game from a few years ago. The game is the Star Trek 25th Anniversary point and click adventure, and GOG packages it up alongside a DOSBox instance that can run it. Of course, it’s linked to expect things in an FHS arrangement, so I did a bit of work to make it run under NixOS.

In April 2016, I wrote this shell.nix file to go alongside the downloaded files:

{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSUserEnv {
  name = "gog-env";
  targetPkgs = pkgs: (with pkgs; [
      alsaLib
      SDL_sound
      SDL_net
      SDL
      libpng12
      zlib
    ]) ++ (with pkgs.xorg; [
      libX11
    ]);
}).env

From what I remember, this worked: I could do nix-shell and then run the start script that came with the game. I tried this again just now and I get this error message:

Running Star Trek - 25th Anniversary
Starting DOSBox
/home/roni/Downloads/Star Trek - 25th Anniversary/dosbox/dosbox_x86_64: relocation error: /usr/lib/libc.so.6: symbol __tunable_get_val, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference
Done.

So it seems like glibc has updated beyond compatibility with a DOSBox from two years ago. To try to fix it, I tried this:

{ pkgs ? import <nixpkgs> {} }:

let
  snapshot = import (fetchTarball {
    url = https://github.com/NixOS/nixpkgs-channels/archive/660806066abc4a64ac44b53b2b1a20f5ab4d920b.tar.gz;
    sha256 = "1zv6scshygxaxbmyxkx01xnkh5s79ixl40b1sic5b2g5k7wbwg5v";
  }) {};
in
  (snapshot.buildFHSUserEnv {
    name = "gog-env";
    targetPkgs = pkgs: (with snapshot; [
        alsaLib
        SDL_sound
        SDL_net
        SDL
        libpng12
        zlib
      ]) ++ (with snapshot.xorg; [
        libX11
      ]);
  }).env

But this gives the exact same error as before. Note that I’m using snapshot everywhere to try to grab packages from April 2016 (I’m even using snapshot.buildFHSUserEnv to try to recreate the exact working conditions).

Also, I tried steam-run but wasn’t able to get that to work (I got errors about libasound not being found, which is related to the fact that alsaLib is in my shell.nix files above).

Can someone help me figure out how to solve this glibc problem and/or help me generally get things “from the past” to work? More specifically, if someone has advice on getting DOSBox / GOG games / steam-run to work that would also be great.

Thanks!

roni

First of all, I really don’t know why this doesn’t work. I think it should.

That aside, I think your best option might be using the dosbox in nixpkgs rather than GOG’s wrapper. I don’t know what GOG’s distribution of the game looks like but I suspect it would be a lot simpler.

1 Like

First of all, I really don’t know why this doesn’t work. I think it should.

I’d love to figure out why this doesn’t work. One thing I’m afraid of is that I’ve done something imperatively to my system at some point that crippled this “time travel” behavior. Because of all the stated benefits of reproducible, pure builds, I’d really like to figure out how I can leverage this time travel notion for real problems, but it’s discouraging to find that I did something that should work but doesn’t.

Is there a recommended way for me to be sure I have a well-configured system somehow? What I mean is, I could back up all my data and then do a fresh install of NixOS, just to see if this approach would work on a clean system, but I’d like to do some sort of housekeeping or something like that short of reinstalling everything.

That aside, I think your best option might be using the dosbox in nixpkgs rather than GOG’s wrapper. I don’t know what GOG’s distribution of the game looks like but I suspect it would be a lot simpler.

You were definitely right about that. With a recent dosbox, and parsing through the launcher script that came with the game, I was able to run the game perfectly well by recreating the relevant commands.

The next step here, I suppose, would be to create my own package for this game. The major problem to solve here is that the game files are large, and therefore I am not sure of a good place to host them, especially if it’s not legal to do so in a place where others could download them as well. I’m not super concerned with the morality of protecting a 27-year-old game, but rather the technical aspects of setting this up. Though the question is probably outside the general scope of “help with NixOS”, can you recommend a way to store such files so that I can retrieve them as part of a derivation that gathers the files and emits a shell script to run the appropriate dosbox command?

Thanks for all the help up to this point!

roni

Hey,

This looks like an issue I ran in before, you should try disabling “stripping”, I could be very wrong though

This sounds interesting: could you be more specific? Where/how do I disable “stripping”?

Thanks!

roni

I would probably not store it at all, but instead fetch the game directly from GOG using a fixed-output derivation like this:

Usage is like this:

fetchGog {
    productId = 1234567890;
    downloadName = "foobar";
    sha256 = ...;
}

Unfortunately, GOG frequently wants you to solve captchas, so I haven’t added this to nixpkgs yet because the above implementation is a bit ugly and prompts for them by connecting to a hardcoded TCP port of a helper tool.

For packaging only a single game you probably won’t need the captcha helper, because GOG only prompts for it after a certain number of requests.

1 Like

Btw. ScummVM has a GSoC student working on this, so you might want to give this a try as well and wrap it accordingly (example): GitHub - Stewmath/scummvm at startrek