Author Topic: Linux issues  (Read 2649 times)

d.healey

  • Jr. Member
  • **
  • Posts: 18
Linux issues
« on: August 02, 2017, 12:37:45 AM »
Hi,

I've just recently started playing this game on Windows and I'm really enjoying it. I would like to play it on GNU/Linux, I'm running LinuxMint, unfortunately when I try running it in Wine I get an error message about it being unable to find fonts - I've checked that the correct fonts listed in the text file are installed on my system - I've also tried building and installing from the makefile but I get a segmentation error which as I understand is a memory access error somewhere in the code. Any tips?

d.healey

  • Jr. Member
  • **
  • Posts: 18
Re: Linux issues
« Reply #1 on: August 09, 2017, 01:22:02 PM »
I found two methods to resolve the font issue. Method A is to install the ms core fonts  - I had already done this but there is a known bug with the usual installation method. What you need to do is first of all uninstall them (if you've already installed them) and then install them via winetricks - Google for more info. Method B is to add Tahoma to the fonts.txt, apparently this font is included with Wine - so perhaps this should be added to the fonts.txt by default in a future update. So after solving this issue the game window will at least open but it just hangs on a blank screen so I still can't run it via Wine :(

I haven't found a solution for the segmentation fault yet either but I think this is something that will require some code debugging which is not my area.
« Last Edit: August 09, 2017, 01:24:18 PM by d.healey »

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: Linux issues
« Reply #2 on: August 09, 2017, 08:12:07 PM »
Building from sources worked fine to me.
Are you sure you've installed all the required libraries?

What I've done:
1) Downloaded and installed Linux Mint 18.2 "Sonya" - KDE (64-bit)
2) Installed g++, libboost-dev, libboost-filesystem-dev, libboost-system-dev, libboost-thread-dev, libsdl-dev, libcurl4-openssl-dev, libfreetype6-dev, libfontconfig-dev
3) Downloaded and extracted knights source code package from the download page
4) Launched make file
5) Launched the game and tried connecting to the server
« Last Edit: August 09, 2017, 08:17:49 PM by ImpassIve_rus »


d.healey

  • Jr. Member
  • **
  • Posts: 18
Re: Linux issues
« Reply #3 on: August 09, 2017, 09:43:11 PM »
I'm sure I've installed them but if it's working for you I must have missed something. I'll try reinstalling the prerequisites

d.healey

  • Jr. Member
  • **
  • Posts: 18
Re: Linux issues
« Reply #4 on: August 10, 2017, 12:18:01 PM »
Ok I originally installed the dependencies through the graphical package manager, I've just reinstalled them all through the terminal and each one said it already had the latest version except libcurl. I then did Make and Make install but I still get:

Loading data files from "knights_data".
Segmentation fault

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: Linux issues
« Reply #5 on: August 10, 2017, 01:40:16 PM »
Hm... to be honest, I don't have much experience with Linux, so I'm not sure if I could help you, especially since I haven't yet found a way to reproduce this error.
Anyway, let's try to add some info:
  • Does it simply outputs "Segmenation fault" without providing any stack trace?
  • Have you tried launching it with gdb (just "gdb ./knights" and then "run"), to see if it stops at the location of the segmentation fault? (you may want to add debugging symbols to the knights executable, by adding "-g" flag to the "CFLAGS" of your Makefile and rebuilding it like "make clean && make")
  • Could you put your knights folder (with both sources and compiled executables) into an archive and post it here?


Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 259
Re: Linux issues
« Reply #6 on: August 10, 2017, 06:14:53 PM »
If it's crashing it would be helpful to see the call stack at least.
To get that, run using gdb as ImpassIve_rus describes, then when it crashes, type "bt" and post the output here.

Also I'll look into updating the fonts.txt file as it certainly makes sense to have one of the default fonts installed with Wine in there.

d.healey

  • Jr. Member
  • **
  • Posts: 18
Re: Linux issues
« Reply #7 on: August 10, 2017, 09:09:20 PM »
This is the output I get after remaking (and setting CFLAGS)

dave@dave-TP300LA ~/Desktop/knights_025_src $ knights
Loading data files from "knights_data".
Segmentation fault
dave@dave-TP300LA ~/Desktop/knights_025_src $ gdb ./knights
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./knights...done.
(gdb) bt
No stack.
(gdb)

Here's a link to my knights folder - http://www.filedropper.com/davesknightsfolder

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: Linux issues
« Reply #8 on: August 10, 2017, 09:51:11 PM »
Yeah, something is wrong with those executables, not sure about the reason. Maybe you could try to replace them with mine and see if that works?
http://www.filedropper.com/linuxmintexecutablestar
(just a reminder: after replacement, run the game as "./knights" instead of "knights" since the latter will launch a previously installed copy, instead of a local one)

P.S. To Stephen:
http://imgur.com/a/0DF2r
"p pimpl" command results in "Couldn't access memory at 0x40".
Something went wrong right after "RStream::Initialize" call (it is hard to tell for sure with -O3), since "&pimpl = 0x7fffffffdbe0" turned into "&pimpl = 0x40". There is only one call inside, so looks like "bfs::canonical(base_path_)" caused this.

P.P.S.
On the asm level:
address of pimpl (0x7fffffffdbe0) was stored on the ebx register.
it was saved onto the stack at the entry of RStream::Initialize with "push ebx" instruction, but recovering instruction "pop ebx" at the exit returned "0x40" instead. Something obviously corrupted the stack in the middle, but I have no idea how did this happen and what to do with this fact.

P.P.P.S.
The exact stack corruption happened here (there is no source code available, but this part is imported from libboost-filesystem-dev library)
http://imgur.com/a/SdvUa
« Last Edit: August 11, 2017, 01:01:11 AM by ImpassIve_rus »


d.healey

  • Jr. Member
  • **
  • Posts: 18
Re: Linux issues
« Reply #9 on: August 11, 2017, 10:03:49 AM »
Yeah, something is wrong with those executables, not sure about the reason. Maybe you could try to replace them with mine and see if that works?
http://www.filedropper.com/linuxmintexecutablestar
(just a reminder: after replacement, run the game as "./knights" instead of "knights" since the latter will launch a previously installed copy, instead of a local one)
Thanks. When I extracted your archive it said an error occurred, truncated tar archive. An executable still popped out though which when run with ./knights still gives the segmentation fault.

Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 259
Re: Linux issues
« Reply #10 on: August 11, 2017, 07:34:19 PM »
Firstly, to d.healey, I forgot to say, thank you for your interest in Knights, and I'm sorry you're having problems. With your help I'm sure we'll get it sorted :)

To ImpassIve:

Thanks for your investigation, it looks like there is some useful info there. I need to refresh my memory about that code though, I'll have a look and get back to you soon... :)

d.healey

  • Jr. Member
  • **
  • Posts: 18
Re: Linux issues
« Reply #11 on: August 12, 2017, 12:38:52 AM »
Firstly, to d.healey, I forgot to say, thank you for your interest in Knights, and I'm sorry you're having problems. With your help I'm sure we'll get it sorted :)
Yeah it's an excellent game. I found it by chance, it's a shame it isn't in a repo (or is it). The mods are great too, I play it with some friends online (on Windows) and it's great fun.

Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 259
Re: Linux issues
« Reply #12 on: August 12, 2017, 04:46:17 PM »
I did some investigating.

First I reproduced Impassive's result -- I did a clean Linux Mint install and built Knights and there was no crash.

Then I downloaded d.healey's executable and ran it, and I got a segmentation fault.

From reading what Impassive wrote it does indeed sound as though the stack is being corrupted across one of the boost library calls.

The only thing I can think of that might cause this is a mismatch between Boost header and library (.so) versions on d.healey's system.

I can see that the knights exe supplied by d.healey links against boost 1.58 (you can see this by running "objdump -p knights" and looking at the .so file versions). I can't see which version of the boost headers he used though.

d.healey please could you look in /usr/include/boost/version.hpp (or wherever you have the boost headers installed) and see what it says for BOOST_LIB_VERSION. It's possible you might have boost installed in two places or something like that, and it's picking up the wrong version of the headers during the compile.

d.healey

  • Jr. Member
  • **
  • Posts: 18
Re: Linux issues
« Reply #13 on: August 12, 2017, 08:08:28 PM »
d.healey please could you look in /usr/include/boost/version.hpp (or wherever you have the boost headers installed) and see what it says for BOOST_LIB_VERSION. It's possible you might have boost installed in two places or something like that, and it's picking up the wrong version of the headers during the compile.

This is what it shows in that file on my system - #define BOOST_LIB_VERSION "1_58"

Is there a way to check if there are multiple versions installed?

Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 259
Re: Linux issues
« Reply #14 on: August 12, 2017, 09:51:13 PM »
Hmm... good question...

Maybe try "find / -name boost 2>/dev/null" and see what it prints out.

On my clean linux install it gives

/usr/include/boost
/usr/include/boost/chrono/typeof/boost

...which indicates there is only one set of boost headers, in /usr/include/boost.