Page 1 of 1

Compiling with msys2

PostPosted: Friday, 30th March 2018, 14:19
by dplusplus
Hi all.

I had built dcss 0.21.1 with msys2, but some tiles are not displayed.

Image

What should I do to fix this problem?

Environment:
- Windows 10 (Home)
- Git for windows SDK 1.0.6 https://github.com/git-for-windows/build-extra/releases
- g++.exe (Rev1, Built by MSYS2 project) 7.2.0
- building as follows:
  Code:
$ git clone --recursive https://github.com/crawl/crawl.git dcss-0.21
$ cd dcss-0.21/crawl-ref/source
$ git checkout stone_soup-0.21
$ git describe --tags
0.21.1-1-g345015fe64

edit contrib/sdl2/src/core/windows/SDL_xinput.h for compile error:
  Code:
#if 0 // comment out for compile error
#ifndef HAVE_XINPUT_GAMEPAD_EX
typedef struct
{
    WORD wButtons;
    BYTE bLeftTrigger;
    BYTE bRightTrigger;
    SHORT sThumbLX;
    SHORT sThumbLY;
    SHORT sThumbRX;
    SHORT sThumbRY;
    DWORD dwPaddingReserved;
} XINPUT_GAMEPAD_EX;
#endif

#ifndef HAVE_XINPUT_STATE_EX
typedef struct
{
    DWORD dwPacketNumber;
    XINPUT_GAMEPAD_EX Gamepad;
} XINPUT_STATE_EX;
#endif
#endif

  Code:
$ make TILES=y
$ ./crawl.exe

Re: Compiling with msys2

PostPosted: Friday, 30th March 2018, 14:39
by advil
This pops up sporadically but it's not entirely clear what's going on, and it often resolves on its own. In past reports like this, what's usually been necessary is to upgrade your video driver. Specifically, you should download the latest version from the graphics card manufacturer's site, since the windows update thing won't necessarily get this. There are specific graphics cards that show up more in reports (HP). You should also do any pending windows updates etc. Also, for unclear reasons, this seems to consistently happen when dcss runs in a virtualbox VM, and there is unfortunately no known solution to that right now.

Do you have this problem with release version of 0.21.1?

(Also, the SDL_xinput.h thing is patched in trunk, and is unrelated to this graphical issue.)

Re: Compiling with msys2

PostPosted: Friday, 30th March 2018, 15:26
by dplusplus
Thank you for reply.

> Do you have this problem with release version of 0.21.1?

With official release binary(stone_soup-0.21.1-tiles-win32), It looks all fine.
(screen shot) https://i.imgur.com/Q1vVMrt.png

What building environment did devteam use for windows binary?

Re: Compiling with msys2

PostPosted: Friday, 30th March 2018, 15:34
by advil
dplusplus wrote:Thank you for reply.

> Do you have this problem with release version of 0.21.1?

With official release binary(stone_soup-0.21.1-tiles-win32), It looks all fine.
(screen shot) https://i.imgur.com/Q1vVMrt.png

What building environment did devteam use for windows binary?


It's actually cross-compiled on linux, using msys2; gammafunk is the one who does these so he would have more information on exactly how it is built. There aren't many devs around who build on windows right now; I've only done windows work in a VM. It's a bit puzzling that the release version would work, though, and it does suggest that there may be some build setting that isn't right. I'll see if I can check what exact build options gammafunk uses for doing the cross-compiling.

Re: Compiling with msys2

PostPosted: Saturday, 31st March 2018, 00:56
by advil
The one potentially relevant thing I found out about how it is cross-compiled is that it is a 64 bit build target; so maybe make sure you aren't running the 32bit version of msys2 (IIRC there are different shell commands). The full cross-compiling build command is `make CROSSHOST=i686-w64-mingw32 package-windows`, which probably would need to be run on a linux instance with the right libraries installed. You could try `make package-windows`, since that does maybe do something to set the architecture. Let me know if you have any success.

At some point I'll try to test this problem out again on a VM but I need to rebuild the VM from scratch so I won't get to it immediately.

Re: Compiling with msys2

PostPosted: Monday, 2nd April 2018, 14:08
by dplusplus
I've tried to build as follows, though, it didn't work out.

- Install mingw-w64 http://mingw-w64.org/doku.php/download/mingw-builds
- Install makensis http://nsis.sourceforge.net/Download
- add to $PATH
- edit Makefile
  Code:
-AR := $(CROSSHOST)-ar
-RANLIB := $(CROSSHOST)-ranlib
+AR := $(CROSSHOST)-gcc-ar
+RANLIB := $(CROSSHOST)-gcc-ranlib

- edit SDL_xinput.h if needed
  Code:
 $ make CROSSHOST=i686-w64-mingw32 package-windows

 ...

 * rebuilding tilegen: new build flags or prefix
    HOSTCXX tool/tile_colour.o
    HOSTCXX tool/tile.o
    HOSTCXX tool/tile_page.o
    HOSTCXX tool/tile_list_processor.o
    HOSTCXX tool/main.o
    HOSTLINK tool/tilegen.elf
tool/tile_colour.o: In function `Z9write_pngPKcP11tile_colourjj':
C:\git-sdk-64\dcss-0.21-test\crawl-ref\source\rltiles/tool/tile_colour.cc:260: undefined reference to `png_create_write_struct'
C:\git-sdk-64\dcss-0.21-test\crawl-ref\source\rltiles/tool/tile_colour.cc:265: undefined reference to `png_create_info_struct'
C:\git-sdk-64\dcss-0.21-test\crawl-ref\source\rltiles/tool/tile_colour.cc:272: undefined reference to `png_init_io'
(ommited)



Finally, I've suceed to build win32 binary with `make CROSSHOST=i686-w64-mingw32 package-windows-zips` on Ubuntu Linux / mingw-w64.
It works very fine. Thanks for your advice!

Re: Compiling with msys2

PostPosted: Monday, 2nd April 2018, 14:55
by advil
well, I'm glad something worked. Those png errors look to be something new, but I'm not immediately sure what (linking against wrong version of libpng, maybe; we often use a contrib version in a submodule).