Currently Online

Latest Posts

Topic: Unable to build widelands on arch linux

Mars
Joined: 2009-03-28, 10:26
Posts: 71
Ranking
Likes to be here
Location: Germany
Posted at: 2020-06-07, 22:10

Hi, I am not able to build widelands and need some help. In the past, it used to work, but this was before widelands moved to git (i.e. some time ago).

I have all the dependencies installed:

mars@archlinux ~> sudo pacman -S cmake gcc boost git glew make python python2 sdl2 sdl2_image sdl2_mixer sdl2_net sdl2_ttf
[sudo] password for mars: 
warning: cmake-3.17.3-1 is up to date -- reinstalling
warning: gcc-10.1.0-2 is up to date -- reinstalling
warning: boost-1.72.0-2 is up to date -- reinstalling
warning: git-2.27.0-1 is up to date -- reinstalling
warning: glew-2.2.0-2 is up to date -- reinstalling
warning: make-4.3-3 is up to date -- reinstalling
warning: python-3.8.3-1 is up to date -- reinstalling
warning: python2-2.7.18-1 is up to date -- reinstalling
warning: sdl2-2.0.12-1 is up to date -- reinstalling
warning: sdl2_image-2.0.5-2 is up to date -- reinstalling
warning: sdl2_mixer-2.0.4-4 is up to date -- reinstalling
warning: sdl2_net-1:2.0.1-3 is up to date -- reinstalling
warning: sdl2_ttf-2.0.15-2 is up to date -- reinstalling

and cloned the master branch from git:

git clone https://github.com/widelands/widelands.git
Cloning into 'widelands'...

The commit is: c546bc7f609716eaa80dc6d0064932628d1e54d6

  • Building a dev release with running ./compile.sh fails with
    collect2: fatal error: ld terminated with signal 9 [Killed]
    compilation terminated.
    

However, running ./compile.sh again reports all tests as passed and the widelands binary is also present.

  • Starting the dev version fails with

    widelands: ../src/graphic/text/font_set.cc:181: UI::FontSets::FontSets(): Assertion `fontset_selectors.count(fontset_name) == 1' failed.
    fish: “./widelands” terminated by signal SIGABRT (Abort)
    
  • Building a release version succeeds.

  • Starting the release version fails with
    mars@archlinux ~/p/widelands (master)> ./widelands 
    This is Widelands Version r24627[c546bc7@master] (Release)
    Set home directory: /home/mars/.widelands
    Set configuration file: /home/mars/.widelands/config
    Widelands executable directory: /home/mars/projects/widelands/
    Adding directory: /usr/share/widelands
    selected language: (system language)
    using locale en_GB.UTF-8
    Byte order: little-endian
    ERROR: Unused key "arabic" in LuaTable. Please report as a bug.
    ERROR: Unused key "cjk" in LuaTable. Please report as a bug.
    ERROR: Unused key "default" in LuaTable. Please report as a bug.
    ERROR: Unused key "devanagari" in LuaTable. Please report as a bug.
    ERROR: Unused key "hebrew" in LuaTable. Please report as a bug.
    ERROR: Unused key "myanmar" in LuaTable. Please report as a bug.
    ERROR: Unused key "sinhala" in LuaTable. Please report as a bug.
    
    Caught exception (of type 'St12out_of_range') in outermost handler!
    The exception said: map::at
    
    This should not happen. Please file a bug report on version r24627[c546bc7@master](Release).
    and remember to specify your operating system.
    

You can find the whole bash session output on [pastebin] (https://pastebin.com/hSbT2mPu) I hope you can help me.

Mars


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1001
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-06-07, 22:27

Perhaps ld ran out of memory? How much RAM do you have? It easily runs out when linking 7 executables in parallel.

You could try

rm -r build
./compile.sh -j 2

to ease the load on the linker, perhaps that already helps…

Edited: 2020-06-07, 22:27

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1001
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-06-07, 22:33

Also please check the content of the file data/i18n/fonts.lua, it seems like it might be messed up (edit: if it's not also a linker error)

Edited: 2020-06-07, 22:34

Top Quote
Mars
Joined: 2009-03-28, 10:26
Posts: 71
Ranking
Likes to be here
Location: Germany
Posted at: 2020-06-07, 23:38

Memory usage really seems to be (one of the) problem(s). I have 16 GB of memory, but it's more or less all used close to the end of building widelands.

The compile.sh does not understand the -j2 option, but cmake does. I was able to use cmake to build a widelands development version without killed linker processes. But when starting widelands, the same error remains: However, the error messages did not change

mars@archlinux ~/p/w/build (master)> gdb ./src/widelands
GNU gdb (GDB) 9.2
[..]
(gdb) run
Starting program: /home/mars/projects/wd/build/src/widelands 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
This is Widelands Version r1[7747702@master] (Debug)
Set home directory: /home/mars/.widelands
Set configuration file: /home/mars/.widelands/config
Widelands executable directory: /home/mars/projects/wd/build/src/
Adding directory: /usr/share/widelands
selected language: (system language)
using locale en_GB.UTF-8
Byte order: little-endian
widelands: /home/mars/projects/wd/src/graphic/text/font_set.cc:181: UI::FontSets::FontSets(): Assertion `fontset_selectors.count(fontset_name) == 1' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff65a1355 in raise () from /usr/lib/libc.so.6
(gdb) where
#0  0x00007ffff65a1355 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff658a853 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff658a727 in _nl_load_domain.cold () at /usr/lib/libc.so.6
#3  0x00007ffff6599936 in  () at /usr/lib/libc.so.6
#4  0x00005555566b23f7 in UI::FontSets::FontSets() (this=0x60d000001098) at /home/mars/projects/wd/src/graphic/text/font_set.cc:181
#5  0x00005555566a2f7e in UI::FontHandler::FontHandler(ImageCache*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    (this=0x60d000001080, image_cache=0x6070000035f0, locale="en_GB.UTF-8") at /home/mars/projects/wd/src/graphic/font_handler.cc:76
#6  0x00005555566a2683 in UI::create_fonthandler(ImageCache*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    (image_cache=0x6070000035f0, locale="en_GB.UTF-8") at /home/mars/projects/wd/src/graphic/font_handler.cc:115
#7  0x000055555641129d in WLApplication::WLApplication(int, char const* const*) (this=0x6120000001c0, argc=1, argv=0x7fffffffe228) at /home/mars/projects/wd/src/wlapplication.cc:383
#8  0x000055555641062a in WLApplication::get(int, char const**) (argc=1, argv=0x7fffffffe228) at /home/mars/projects/wd/src/wlapplication.cc:298
#9  0x000055555640e61e in main(int, char**) (argc=1, argv=0x7fffffffe228) at /home/mars/projects/wd/src/main.cc:40
(gdb)

The fonts.lua file seems to be ok, my local file matches https://github.com/widelands/widelands/blob/master/data/i18n/fonts.lua. But to be sure a cloned the git repo again for the cmake builds.


Top Quote
Mars
Joined: 2009-03-28, 10:26
Posts: 71
Ranking
Likes to be here
Location: Germany
Posted at: 2020-06-08, 00:04

I did some more tests and added a log statement before the assertion

mars@archlinux ~/p/wd (master)> git diff
diff --git a/src/graphic/text/font_set.cc b/src/graphic/text/font_set.cc
index eb3d04dd..2786b956 100644
--- a/src/graphic/text/font_set.cc
+++ b/src/graphic/text/font_set.cc
@@ -178,6 +178,8 @@ FontSets::FontSets() {
        // Read all fontsets
        std::unique_ptr<LuaTable> fontsets_table(lua.run_script("i18n/fonts.lua"));
        for (const std::string& fontset_name : fontsets_table->keys<std::string>()) {
+               log("fontset_name: %s %ld \n",
+                   fontset_name.c_str(), fontset_selectors.count(fontset_name));
                assert(fontset_selectors.count(fontset_name) == 1);
                FontSets::Selector selector = fontset_selectors.at(fontset_name);
                fontsets[selector] = std::unique_ptr<FontSet>(new FontSet(fontset_name));

The results are unexpected:

mars@archlinux ~/p/w/build (master)> ./src/widelands
This is Widelands Version r1[7747702@master] (Debug)
Set home directory: /home/mars/.widelands
Set configuration file: /home/mars/.widelands/config
Widelands executable directory: /home/mars/projects/wd/build/src/
Adding directory: /usr/share/widelands
selected language: (system language)
using locale en_GB.UTF-8
Byte order: little-endian
fontset_name: arabic 1 
fontset_name: cjk 1 
fontset_name: default 1 
fontset_name: devanagari 1 
fontset_name: hebrew 1 
fontset_name: myanmar 0 
widelands: /home/mars/projects/wd/src/graphic/text/font_set.cc:183: UI::FontSets::FontSets(): Assertion `fontset_selectors.count(fontset_name) == 1' failed.
fish: “./src/widelands” terminated by signal SIGABRT (Abort)
mars@archlinux ~/p/w/build (master) [SIGABRT]> grep -r myanmar .. 
mars@archlinux ~/p/w/build (master) [1]>

There is no myanmar in the whole git repo and I am not sure where it comes from. My only guess is some old system-wide config files. I will do some more investigation tomorrow.


Top Quote
niektory
Avatar
Joined: 2019-06-03, 20:06
Posts: 169
Ranking
At home in WL-forums
Location: Poland
Posted at: 2020-06-08, 04:49

This is the problem:

Adding directory: /usr/share/widelands

You have Build 20 installed from the Arch repositories and Widelands loads the data directory from that older version. To make it use the proper data directory start it with:

./widelands --datadir=./data

See also issue #3490 and issue #3776.


Top Quote
Mars
Joined: 2009-03-28, 10:26
Posts: 71
Ranking
Likes to be here
Location: Germany
Posted at: 2020-06-08, 06:08

Thanks for the help and the links to the github issues!

Adding the datadir option solved my problem.


Top Quote