Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Getting DF to run under 64-bit Ubuntu with full sound (should apply to Debian)  (Read 10089 times)

NCommander

  • Bay Watcher
  • Dwarven Military Master
    • View Profile
    • SoylentNews

So I finally decided to try DF, just to find that the Linux build is 32-bit only, and refuses to run out of the box on Ubuntu. After a fair bit of tinkering, I managed to get it to start (though I haven't extensively tested it to make sure). These directions will likely only work with Ubuntu 11.10 (oneiric), and possibly Ubuntu 11.04 (natty) as these were the versions when 32-bit compat support was GREATLY overhauled by the transition to multilib. If someone is running an older distro and needs help, I'll try and help provide instructions.

Trying to run DF at this point provides the following error
Code: [Select]
./libs/Dwarf_Fortress: error while loading shared libraries: libSDL-1.2.so.0: wrong ELF class: ELFCLASS64
First off, unlike most distros, Ubuntu does NOT ship with 32-bit compatibility installed out of the box, so first download the DF package, and put it somewhere easy to get to, then you need to open a terminal, and run the following command


Code: [Select]
mcasadevall@daybreak:~/df_linux$ sudo apt-get install ia32-libs-multiarch libsdl1.2debian:i386 libgtk2.0-0:i386 libsdl-image1.2:i386 libsdl-ttf2.0-0:i386 libglu1-mesa:i386 libopenal-dev:i386 libsndfile1-dev:i386
(the dev packages are needed to get proper symlinks needed for sndfile and openal to work around a bug in DF: http://www.bay12games.com/dwarves/mantisbt/view.php?id=3200)

Enter your password when prompted.

Press enter, and let it run. When you see the prompt again, apt-get is done.

Trying to start DF however will still fail:

Code: [Select]
mcasadevall@daybreak:~/df_linux$ ./df
./libs/Dwarf_Fortress: error while loading shared libraries: libGL.so.1: wrong ELF class: ELFCLASS64

The problem here is that libGL.so.1 is installed as part of MESA (or for those with ATi/NVIDIA video cards, as part of fglrx/nvidia drivers), and lives in the wrong folder on a multiarch install (its in /usr/lib/i386-linux-gnu/mesa). I suspect this is a bug with the changeover to multiarch, but I haven't had time to run it down yet. Anyway, working around it is fairly straightforward, simply start DF with LD_LIBRARY_PATH as such and enjoy your dwarfy fun

Code: [Select]
mcasadevall@daybreak:~/df_linux$ LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/mesa/ ./df
If your lucky, you should see DF start up in a window. It's possible those with ATi/NVIDIA graphics cards might run into issues (GL on Linux is a serious case of black magic. If anyone tries this with the binary drivers for those cards, please report back. I have some deeper voodoo that should get THOSE working, but my laptop only has Intel video drivers).
Logged
Quote from: TheFlame52
Fucking hell man, you aren't just getting the short end of the stick, you're being beaten with it.
Quote from: NRDL
Is your plan really to flush water into hell, and have the CARP marines fight them without threat of flame or disease?  If so, you are awesome, and one of the greatest DF military visionaries I've seen yet ( not that I've seen that many, or any, for that matter )

Jake

  • Bay Watcher
  • Remember Boatmurdered!
    • View Profile
    • My Web Fiction

If that all sounds too complicated or you're on a shared Linux machine without root access, the Windows version should run okay under Wine, with negligible FPS loss.
Logged
Never used Dwarf Therapist, mods or tilesets in all the years I've been playing.
I think Toady's confusing interface better simulates the experience of a bunch of disorganised drunken dwarves running a fort.

Black Powder Firearms - Superior firepower, realistic manufacturing and rocket launchers!

CharlesPeter

  • Bay Watcher
  • My Dark Twisted Pretzel Fantasy
    • View Profile

You should put this on the wiki somewhere, in case people search there too.
Logged
UU,.~U~,.\b,.

Kamamura

  • Bay Watcher
    • View Profile

If that all sounds too complicated or you're on a shared Linux machine without root access, the Windows version should run okay under Wine, with negligible FPS loss.

I hope you are joking. Emulation never comes with negligible performance costs - the sole exception is when a kernel is compiled with binary compatibility, like Linux Base on FreeBSD.
Logged
The entire content consists of senseless murder, a pile of faceless naked women and zero regard for human life in general, all in the service of the protagonist's base impulses. It is clearly a cry for help from a neglected, self absorbed and disempowered juvenile badly in need of affectionate guidance. What a sad, sad display.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile

Oh, thanks, man! The latest Ubuntu versions have been doing so many things wrong different...

Such as doing 64 bits in lib and 32 in lib32..... this just saved me a ton of time of finding out which libs to find where and how to refer to them.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

stamasd

  • Bay Watcher
    • View Profile

The solution in the OP works very well on Ubuntu 12.04 LTS Precise Pangolin 64-bit as of the beta1. Moreover you don't need the LD_LIBRARY_PATH at all, just installing the compatibility libs is enough. caveat: this was tested on a machine with a Radeon video card and fglrx installed. YMMV if using Nvidia or non-proprietary drivers.
« Last Edit: March 15, 2012, 05:29:46 pm by stamasd »
Logged

Over_Forty_Urists

  • Escaped Lunatic
    • View Profile

I had a similar experience with the libGL.so.1 library but simply installing compatibility libraries didn't quite work. I ended up having to find the library that the dwarves actually wanted to get it running (I'm in ubuntu 14.04 using a nvidia 331.89 driver).

Code: [Select]
guy@fortyurists:~$ locate libGL.so.1
I looked for a 32 bit library, which I installed using the dwarf fortress on linux guide found here: http://www.bay12forums.com/smf/index.php?topic=123116.0. The library I wanted was in /lib32. The error is showing up because installing new nvidia drivers can mess up the order in which libraries are found - your computer finds a libGL.so.1 and is like "oh yeh" and goes to town. Turns out, the library that it finds on its own isn't a dwarf's library. It's a human's library.

To run using the dwarven library, you pick the one that is definitely 32 bit, like this:

Code: [Select]
guy@fortyurists:~/df$ LD_LIBRARY_PATH=/usr/lib32/ ./df
tldr; works in Ubuntu 14.04 with NVIDIA x86_64-331.89 if you tell it to run with the right library, look for it with locate and pick the right one.
Logged

My Urist Eternal

  • Bay Watcher
    • View Profile

Every so often I am reminded why I quit using Linux in 1997. This is one of those times.  :o
Logged

Nopenope

  • Bay Watcher
    • View Profile

I hope you are joking. Emulation never comes with negligible performance costs - the sole exception is when a kernel is compiled with binary compatibility, like Linux Base on FreeBSD.

Wine stands for Wine Is Not an Emulator. It's a compatibility layer.
Logged