Latest Posts

Topic: Debug binary compiled in MSYS2 can't read datadir

palino
Avatar
Topic Opener
Joined: 2022-12-19, 08:06
Posts: 10
OS: Windows 10
Version: 1.1
Ranking
Pry about Widelands
Posted at: 2022-12-20, 01:35

Hello

I am trying to build WL on Windows 10 without visual studio, but debug builds are somehow damaged. I use this procedure: Buildingwidelandsunderwindowsnew. Step with cmake:

cmake -G "Ninja" -DCMAKE_C_COMPILER=C:/msys64/mingw64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/msys64/mingw64/bin/g++.exe -DCMAKE_BUILD_TYPE=Debug -DOPTION_USE_GLBINDING=OFF -DOPTION_BUILD_WINSTATIC=ON -DOPTION_BUILD_WEBSITE_TOOLS=OFF -DOPTION_ASAN=OFF -DOPTION_BUILD_TRANSLATIONS=OFF ..

When running compiled binary, std output is

This is Widelands version 1.2~git25985 (9f8244e@HEAD) Debug
[00:00:00.000 real] INFO: Set home directory: C:\Users\A686861\.widelands
[00:00:00.000 real] INFO: Set configuration file: C:\Users\A686861\.widelands\config
[00:00:00.008 real] INFO: Widelands executable directory: C:\bin\Widelands
[00:00:00.014 real] ERROR: Unable to detect the datadir. Please specify a datadir explicitly
[00:00:00.014 real] ERROR: with the --datadir command line option. Tried the following 1 path(s):
[00:00:00.014 real] ERROR:  · 'C:\bin\Widelands\./data': Incorrect version string part

or when specifying --datadir option manually:

This is Widelands version 1.2~git25985 (9f8244e@HEAD) Debug
[00:00:00.000 real] INFO: Set home directory: C:\Users\A686861\.widelands
[00:00:00.000 real] INFO: Set configuration file: C:\Users\A686861\.widelands\config
[00:00:00.001 real] ERROR: Invalid explicit datadir 'c:\bin\Widelands\data': Incorrect version string part

If I run binary downloaded from github - Windows 64-bit Debug (MinGW), it starts up correctly. I've tried latest HEAD and 1.1 version, results the same. If I try -DCMAKE_BUILD_TYPE=Release, on one PC there are datadir problems, on second PC (Windows 7) it starts up correctly.

Do you have idea what is wrong in build procedure?

Pavol


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2380
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2022-12-20, 09:12

I think the build procedure is fine. The problem is the missing datadir, I believe. You need to specify the path to the data directory used in the build. you can try to move/copy the resulting exe in the folder above this data directory as well. Personally I usually compile the ninary in a seperate folder different from the source. Afterwars I specify a link on the desktop with the --datadir option pointing to the data dir in the repo of the source. you need to be careful with slash and backslash in path specificatiuons on windows. if you still encounter problems please tell: the folder of the src and the path used in the datadir option


Top Quote
palino
Avatar
Topic Opener
Joined: 2022-12-19, 08:06
Posts: 10
OS: Windows 10
Version: 1.1
Ranking
Pry about Widelands
Posted at: 2022-12-20, 17:04

Thank you for pointing me out; I realised there is consistency check between binary version and datadir version. I made installation with installer from github first and afterwards I wanted to copy updated exe in the folder above data directory, like you suggested. But then I was confused from log messages.

These changes work for me well now:

  • cmdline option (when exe is above data directory from installer)
--skip_check_datadir_version
  • cmake parameter (then I can directly run generated exe in build\src\ of source tree)
-DWL_INSTALL_DATADIR=..\\\\..\\\\data

Top Quote