[CR] CMake: update rules; add Linux install targets; add support for dev-builds; #11970

Merged
merged 97 commits into from May 9, 2015

Conversation

Projects
None yet
7 participants
@brezerk
Contributor

brezerk commented Apr 10, 2015

Hi there.

I'd like to use QtCreator as dev env. But It seems like cmake scripts are outdated and require some updates.

However, currently cmake build is not upstream build system for the project...

So. Do you guys have any plans for build system migration? Does this activity will be helpful for you?

@Psimage

This comment has been minimized.

Show comment
Hide comment
@Psimage

Psimage Apr 10, 2015

Hi. Thanks for updating cmake build!
It would be definitely helpful for those who used to different development environment (e.g. I'm used to IntelliJ IDEA IDE since i'm from Java world so i want to try CLion as an IDE for C++ but it only supports CMake).

Psimage commented Apr 10, 2015

Hi. Thanks for updating cmake build!
It would be definitely helpful for those who used to different development environment (e.g. I'm used to IntelliJ IDEA IDE since i'm from Java world so i want to try CLion as an IDE for C++ but it only supports CMake).

@Psimage

View changes

src/lua/CMakeLists.txt
+ADD_CUSTOM_TARGET(
+ lua_bindings
+ COMMAND ${LUA_BINARY} generate_bindings.lua
+ BYPRODUCTS ${CMAKE_SOURCE_DIR}/src/lua/catabindings.cpp

This comment has been minimized.

@Psimage

Psimage Apr 10, 2015

BYPRODUCTS argument in ADD_CUSTOM_TARGET command requires CMake 3.2 but required version of CMake is set to 2.8

@Psimage

Psimage Apr 10, 2015

BYPRODUCTS argument in ADD_CUSTOM_TARGET command requires CMake 3.2 but required version of CMake is set to 2.8

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

Removed, thanks.

@brezerk

brezerk Apr 10, 2015

Contributor

Removed, thanks.

This comment has been minimized.

@BevapDin

BevapDin Apr 10, 2015

Contributor

Quoting the documentation:

The target has no output file and is ALWAYS CONSIDERED OUT OF DATE even if the commands try to create a file with the name of the target. Use ADD_CUSTOM_COMMAND to generate a file with dependencies.

And indeed, every time I run make, it recreates catabindings.cpp and recompiles and relinks it, which is at least a waste of time.

The standard Makefile has "$(LUA_DIR)/class_definitions.lua" and "$(LUASRC_DIR)/generate_bindings.lua" as explicit dependencies for regenerating the bindings.

@BevapDin

BevapDin Apr 10, 2015

Contributor

Quoting the documentation:

The target has no output file and is ALWAYS CONSIDERED OUT OF DATE even if the commands try to create a file with the name of the target. Use ADD_CUSTOM_COMMAND to generate a file with dependencies.

And indeed, every time I run make, it recreates catabindings.cpp and recompiles and relinks it, which is at least a waste of time.

The standard Makefile has "$(LUA_DIR)/class_definitions.lua" and "$(LUASRC_DIR)/generate_bindings.lua" as explicit dependencies for regenerating the bindings.

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

yeah. ADD_CUSTOM_COMMAND seems to work just fine. thanks!

@brezerk

brezerk Apr 10, 2015

Contributor

yeah. ADD_CUSTOM_COMMAND seems to work just fine. thanks!

@Psimage

View changes

src/version.cmake
@@ -0,0 +1,6 @@
+EXECUTE_PROCESS(
+ COMMAND /usr/bin/git describe --tags --always --dirty --match "[0-9]*.[0-9]*"

This comment has been minimized.

@Psimage

Psimage Apr 10, 2015

Absolute path to git will probably fail on platforms other then Unix-like. Since you did "find git" before maybe just use GIT_EXECUTABLE variable?

@Psimage

Psimage Apr 10, 2015

Absolute path to git will probably fail on platforms other then Unix-like. Since you did "find git" before maybe just use GIT_EXECUTABLE variable?

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

Yeah. Fixed, thanks!

@brezerk

brezerk Apr 10, 2015

Contributor

Yeah. Fixed, thanks!

@Psimage

View changes

src/version.cmake
@@ -0,0 +1,6 @@
+EXECUTE_PROCESS(

This comment has been minimized.

@Psimage

Psimage Apr 10, 2015

I tried to use EXECUTE_PROCESS myself but the output from git was truncated (instead of "0.9-19324-g874cb5d-dirty" i got only "74cb5d-dirty" part). So i tried to use EXECUTE_PROGRAM and it worked. I'm using CMake 3.1.3 btw.

@Psimage

Psimage Apr 10, 2015

I tried to use EXECUTE_PROCESS myself but the output from git was truncated (instead of "0.9-19324-g874cb5d-dirty" i got only "74cb5d-dirty" part). So i tried to use EXECUTE_PROGRAM and it worked. I'm using CMake 3.1.3 btw.

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

Hm. I am using CMake 3.1.0 and it seems like it works fine as it is:

[ himera ] brezerk@pts/4:808  ~/develop/Cataclysm-DDA-Fork/build $
echo "lol" > ../src/version.h         
[ himera ] brezerk@pts/4:809  ~/develop/Cataclysm-DDA-Fork/build $
cmake ..   
...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/brezerk/develop/Cataclysm-DDA-Fork/build
[ himera ] brezerk@pts/4:810  ~/develop/Cataclysm-DDA-Fork/build $
make
[  2%] Built target chkjson
-- Found Git: /usr/bin/git (found version "2.3.5")
[  2%] Built target get_version
[  2%] Built target lua_bindings
...
[ himera ] brezerk@pts/4:811  ~/develop/Cataclysm-DDA-Fork/build $
cat ../src/version.h
#define VERSION "0.9-19330-gb56c7af"
[ himera ] brezerk@pts/4:813  ~/develop/Cataclysm-DDA-Fork/build $
git describe --tags --always --dirty --match "[0-9]*.[0-9]*"
0.9-19330-gb56c7af

are you still having problems with current cmake version?

@brezerk

brezerk Apr 10, 2015

Contributor

Hm. I am using CMake 3.1.0 and it seems like it works fine as it is:

[ himera ] brezerk@pts/4:808  ~/develop/Cataclysm-DDA-Fork/build $
echo "lol" > ../src/version.h         
[ himera ] brezerk@pts/4:809  ~/develop/Cataclysm-DDA-Fork/build $
cmake ..   
...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/brezerk/develop/Cataclysm-DDA-Fork/build
[ himera ] brezerk@pts/4:810  ~/develop/Cataclysm-DDA-Fork/build $
make
[  2%] Built target chkjson
-- Found Git: /usr/bin/git (found version "2.3.5")
[  2%] Built target get_version
[  2%] Built target lua_bindings
...
[ himera ] brezerk@pts/4:811  ~/develop/Cataclysm-DDA-Fork/build $
cat ../src/version.h
#define VERSION "0.9-19330-gb56c7af"
[ himera ] brezerk@pts/4:813  ~/develop/Cataclysm-DDA-Fork/build $
git describe --tags --always --dirty --match "[0-9]*.[0-9]*"
0.9-19330-gb56c7af

are you still having problems with current cmake version?

This comment has been minimized.

@Psimage

Psimage Apr 10, 2015

Pulled your branch - everything works. The problem was that i escaped quotes in match string but you don't need to do that :D

@Psimage

Psimage Apr 10, 2015

Pulled your branch - everything works. The problem was that i escaped quotes in match string but you don't need to do that :D

@BevapDin

View changes

src/CMakeLists.txt
# Required library linkage
-if(TILES)
+IF(TILES)
target_include_directories(cataclysm PUBLIC ${SDL2_INCLUDE_DIR})

This comment has been minimized.

@BevapDin

BevapDin Apr 10, 2015

Contributor

Not your fault, but maybe it's time to increase the required cmake version? target_include_directories was added in cmake 2.8.11, required version is "only" 2.8.

@BevapDin

BevapDin Apr 10, 2015

Contributor

Not your fault, but maybe it's time to increase the required cmake version? target_include_directories was added in cmake 2.8.11, required version is "only" 2.8.

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

Heah. We need to do something with this :) Thanks.

@brezerk

brezerk Apr 10, 2015

Contributor

Heah. We need to do something with this :) Thanks.

This comment has been minimized.

@Psimage

Psimage Apr 10, 2015

Since the build was broken before and nobody noticed in 15 days its probably safe to upgrade.

@Psimage

Psimage Apr 10, 2015

Since the build was broken before and nobody noticed in 15 days its probably safe to upgrade.

@BevapDin

View changes

CMakeLists.txt
+
+MESSAGE(STATUS "${PROJECT} build environment -- \n")
+
+MESSAGE(STATUS "Build realm is : ${CMAKE_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_PROCESSOR}\n")

This comment has been minimized.

@BevapDin

BevapDin Apr 10, 2015

Contributor

While this looks really nice with cmake, it is slightly annoying when using ccmake as I have to confirm this explicitly by pressing a key.

In case someone doesn't known ccmake: it's a curses based UI to cmake, allowing one to change the configuration. It also lists all the available configuration options, which is why I usually use it.

However, when it runs the actual cmake with the proper settings, it captures those messages and required input from the user before it continues. My "standard" process (which works fine for other projects using cmake) is to call ccmake fro the build dir, press c once to initialize the cmake cache, look at the available options and adjust them, press c to configure again, press g to generate and exit cmake. The message introduced here requires me to confirm after each c and g.

But maybe I'm the only one using ccmake, and it's only annoying, not a real problem at all.

@BevapDin

BevapDin Apr 10, 2015

Contributor

While this looks really nice with cmake, it is slightly annoying when using ccmake as I have to confirm this explicitly by pressing a key.

In case someone doesn't known ccmake: it's a curses based UI to cmake, allowing one to change the configuration. It also lists all the available configuration options, which is why I usually use it.

However, when it runs the actual cmake with the proper settings, it captures those messages and required input from the user before it continues. My "standard" process (which works fine for other projects using cmake) is to call ccmake fro the build dir, press c once to initialize the cmake cache, look at the available options and adjust them, press c to configure again, press g to generate and exit cmake. The message introduced here requires me to confirm after each c and g.

But maybe I'm the only one using ccmake, and it's only annoying, not a real problem at all.

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

I was never using ccamke...

However:

option(SILENT       "Build-only: suppress ASCII logo. usefull for ccmake users :)"      "OFF")

It will suppress this ASCII and info stuff if you run it as follows:

ccmake .. -DSILENT=ON

btw: On the other hand, I think we can suppress the info, if -DRELEASE=OFF or -DDEBUG=ON instead of -DSILENT=ON

@brezerk

brezerk Apr 10, 2015

Contributor

I was never using ccamke...

However:

option(SILENT       "Build-only: suppress ASCII logo. usefull for ccmake users :)"      "OFF")

It will suppress this ASCII and info stuff if you run it as follows:

ccmake .. -DSILENT=ON

btw: On the other hand, I think we can suppress the info, if -DRELEASE=OFF or -DDEBUG=ON instead of -DSILENT=ON

This comment has been minimized.

@BevapDin

BevapDin Apr 10, 2015

Contributor

Uh, so much attention, I'm impressed. It works fine.

@BevapDin

BevapDin Apr 10, 2015

Contributor

Uh, so much attention, I'm impressed. It works fine.

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

no problem.

jfyi: I had to remove DSILENT in a favour of DRELEASE. In order to suppress ASCII and logging stuff set -DRELEASE=OFF

This will add ability to run resulting binary from cmake build directory as well.

@brezerk

brezerk Apr 10, 2015

Contributor

no problem.

jfyi: I had to remove DSILENT in a favour of DRELEASE. In order to suppress ASCII and logging stuff set -DRELEASE=OFF

This will add ability to run resulting binary from cmake build directory as well.

@BevapDin

View changes

src/chkjson/CMakeLists.txt
+INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/chkjson )
+
+# Add the actual executable
+ADD_EXECUTABLE(chkjson ${CHKJSON_SOURCES} ${CHKJSON_HEADERS})

This comment has been minimized.

@BevapDin

BevapDin Apr 10, 2015

Contributor

This adds the chkjson file to the "all" target and it's therefor made every time somebody runs make all. It's not a big thing (only 2 source files + linking), but the original Makefile has this as a separate target that has to be invoked explicitly.

@BevapDin

BevapDin Apr 10, 2015

Contributor

This adds the chkjson file to the "all" target and it's therefor made every time somebody runs make all. It's not a big thing (only 2 source files + linking), but the original Makefile has this as a separate target that has to be invoked explicitly.

This comment has been minimized.

@brezerk

brezerk Apr 10, 2015

Contributor

Yeah. It seems like it is used only for debug/test purposes.
I'll move it to 'test' chain when will start it's implementation :)

@brezerk

brezerk Apr 10, 2015

Contributor

Yeah. It seems like it is used only for debug/test purposes.
I'll move it to 'test' chain when will start it's implementation :)

@BevapDin

This comment has been minimized.

Show comment
Hide comment
@BevapDin

BevapDin Apr 10, 2015

Contributor

make install does not install the gfx folder. According to the Makefile, it should be installed (only if TILES is defined) into $DATA_PREFIX, same place where font, json etc. goes.

Contributor

BevapDin commented Apr 10, 2015

make install does not install the gfx folder. According to the Makefile, it should be installed (only if TILES is defined) into $DATA_PREFIX, same place where font, json etc. goes.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Apr 10, 2015

Contributor

Fixed in: https://github.com/brezerk/Cataclysm-DDA/commit/b21dd954dd414bdac793e6d0dc50dd4443513695 :P

Btw: it seems like current source code does not able to run binary from arbitrary PREFIX_PATH directory? Or am I missing something?

Contributor

brezerk commented Apr 10, 2015

Fixed in: https://github.com/brezerk/Cataclysm-DDA/commit/b21dd954dd414bdac793e6d0dc50dd4443513695 :P

Btw: it seems like current source code does not able to run binary from arbitrary PREFIX_PATH directory? Or am I missing something?

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Apr 10, 2015

Contributor

ah. I see:

398     DEFINES += -DPREFIX="$(PREFIX)"
Contributor

brezerk commented Apr 10, 2015

ah. I see:

398     DEFINES += -DPREFIX="$(PREFIX)"
@BevapDin

This comment has been minimized.

Show comment
Hide comment
@BevapDin

BevapDin Apr 10, 2015

Contributor

There is another thing, cmake installs the content of the data folder to "./share/cataclysm-dda/data/", but it belongs into "./share/cataclysm-dda/" (there should be no data folder at all).

Contributor

BevapDin commented Apr 10, 2015

There is another thing, cmake installs the content of the data folder to "./share/cataclysm-dda/data/", but it belongs into "./share/cataclysm-dda/" (there should be no data folder at all).

@BevapDin

This comment has been minimized.

Show comment
Hide comment
@BevapDin

BevapDin Apr 10, 2015

Contributor

Btw: it seems like current source code does not able to run binary from arbitrary PREFIX_PATH directory? Or am I missing something?

I have CMAKE_INSTALL_PREFIX set to "/tmp/cataclysm" and can run the binary from there with ./bin/cataclysm --basepath . (after moving the contents of share/cataclysm-dda/data/ to share/cataclysm-dda/).

Edit: and now it works with the parameter, just ./bin/cataclysm is enough.

Contributor

BevapDin commented Apr 10, 2015

Btw: it seems like current source code does not able to run binary from arbitrary PREFIX_PATH directory? Or am I missing something?

I have CMAKE_INSTALL_PREFIX set to "/tmp/cataclysm" and can run the binary from there with ./bin/cataclysm --basepath . (after moving the contents of share/cataclysm-dda/data/ to share/cataclysm-dda/).

Edit: and now it works with the parameter, just ./bin/cataclysm is enough.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Apr 10, 2015

Contributor

Good catch, thanks! Updating build rules...

Contributor

brezerk commented Apr 10, 2015

Good catch, thanks! Updating build rules...

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Apr 10, 2015

Contributor

OK. It seems I will need to modify the source to be able to run binary from the cmake build directory:

[ himera ] brezerk@pts/4:1028 :( 1 ~/develop/Cataclysm-DDA-Fork/build $
cmake .. -DRELESE=OFF
--  build options --
-- Build  in development mode (RELEASE=ON) --
-- CMAKE_INSTALL_PREFIX          : /home/brezerk/develop/Cataclysm-DDA-Fork
-- Configuring done
-- Generating done
-- Build files have been written to: /home/brezerk/develop/Cataclysm-DDA-Fork/build

However trying to run it:

[ himera ] brezerk@pts/4:1029  ~/develop/Cataclysm-DDA-Fork/build $
./src/cataclysm
[ himera ] brezerk@pts/4:1030 :( 1 ~/develop/Cataclysm-DDA-Fork/build $

strace output:

close(4)                                = 0
open("/home/brezerk/.cataclysm-dda/config/fonts.json", O_RDONLY) = -1 ENOENT (No such file or directory)
open("\"/home/brezerk/develop/Cataclysm-DDA-Fork\"/share/cataclysm-dda/fontdata.json", O_RDONLY) = -1 ENOENT (No such file or directory)
write(3, "16:48:50.732 WARNING : opendir ["..., 142) = 142
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2097, ...}) = 0

So it tries to look into 'share/cataclysm-dda'.
Will try to use -DRELEASE to control this.

Contributor

brezerk commented Apr 10, 2015

OK. It seems I will need to modify the source to be able to run binary from the cmake build directory:

[ himera ] brezerk@pts/4:1028 :( 1 ~/develop/Cataclysm-DDA-Fork/build $
cmake .. -DRELESE=OFF
--  build options --
-- Build  in development mode (RELEASE=ON) --
-- CMAKE_INSTALL_PREFIX          : /home/brezerk/develop/Cataclysm-DDA-Fork
-- Configuring done
-- Generating done
-- Build files have been written to: /home/brezerk/develop/Cataclysm-DDA-Fork/build

However trying to run it:

[ himera ] brezerk@pts/4:1029  ~/develop/Cataclysm-DDA-Fork/build $
./src/cataclysm
[ himera ] brezerk@pts/4:1030 :( 1 ~/develop/Cataclysm-DDA-Fork/build $

strace output:

close(4)                                = 0
open("/home/brezerk/.cataclysm-dda/config/fonts.json", O_RDONLY) = -1 ENOENT (No such file or directory)
open("\"/home/brezerk/develop/Cataclysm-DDA-Fork\"/share/cataclysm-dda/fontdata.json", O_RDONLY) = -1 ENOENT (No such file or directory)
write(3, "16:48:50.732 WARNING : opendir ["..., 142) = 142
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2097, ...}) = 0

So it tries to look into 'share/cataclysm-dda'.
Will try to use -DRELEASE to control this.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Apr 10, 2015

Contributor

Yeah! I was able to build and run Cataclysm-DDA from QtCreator using CMake.

/me happy.

However, there are some other thing needs to be fixed/added. sigh

qtcreator

Contributor

brezerk commented Apr 10, 2015

Yeah! I was able to build and run Cataclysm-DDA from QtCreator using CMake.

/me happy.

However, there are some other thing needs to be fixed/added. sigh

qtcreator

@kevingranade

This comment has been minimized.

Show comment
Hide comment
@kevingranade

kevingranade Apr 10, 2015

Member
Member

kevingranade commented Apr 10, 2015

@brezerk brezerk changed the title from [WIP] [CI] Some cmake updates to [WIP] [CR] Some cmake updates Apr 10, 2015

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 5, 2015

Contributor

Hi guys. Sorry, I was ill a bit ;)

@kevingranade the current branch state is:

  • Linux build/install works;
  • FreeBSD build/install not tested (tbd);
  • MacOS build/install not implemented/not tested (tdb);
  • Windows build seems to works fine on 32 bit system. I was able to build both curses and tiles version using msys2 32-bit:
    ddacurses
    Note: Windows tiles version wont work for me (SDL Segmentation fault). Maybe b/c of KVM+RDP+Binary/Game data are located on Network mapped drive (headbang);

There are some known issues:

  • Windows: Tiles static compilation does not link SDL* libs statically (tbd);
  • Windows: I was not able to test MSYS2 64bit compilation (tbd);

In general, if there are no comments/or objections from the community, it can be merged as is.
The rest of the work can be done via separate branches.

Contributor

brezerk commented May 5, 2015

Hi guys. Sorry, I was ill a bit ;)

@kevingranade the current branch state is:

  • Linux build/install works;
  • FreeBSD build/install not tested (tbd);
  • MacOS build/install not implemented/not tested (tdb);
  • Windows build seems to works fine on 32 bit system. I was able to build both curses and tiles version using msys2 32-bit:
    ddacurses
    Note: Windows tiles version wont work for me (SDL Segmentation fault). Maybe b/c of KVM+RDP+Binary/Game data are located on Network mapped drive (headbang);

There are some known issues:

  • Windows: Tiles static compilation does not link SDL* libs statically (tbd);
  • Windows: I was not able to test MSYS2 64bit compilation (tbd);

In general, if there are no comments/or objections from the community, it can be merged as is.
The rest of the work can be done via separate branches.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 5, 2015

Contributor

As for:

Note: Windows tiles version wont work for me (SDL Segmentation fault). Maybe b/c of KVM+RDP+Binary/Game data are located on Network mapped drive (headbang);

Here the backtrace. Not sure what is wrong here :(

devw7@devw7-d3 MINGW32 /c/Games/CataclysmDDA
$ gdb.exe cataclysm-tiles.exe
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 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 "i686-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Games\CataclysmDDA\cataclysm-tiles.exe...done.
(gdb) run
Starting program: C:\Games\CataclysmDDA/cataclysm-tiles.exe
[New Thread 3512.0x678]
[New Thread 3512.0xc30]
[New Thread 3512.0x588]
[New Thread 3512.0xc04]

Program received signal SIGSEGV, Segmentation fault.
0x76f3e39e in ntdll!RtlInitUnicodeString () from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x76f3e39e in ntdll!RtlInitUnicodeString ()
   from C:\Windows\system32\ntdll.dll
#1  0x0e450000 in ?? ()
#2  0x76f3e003 in ntdll!RtlFreeHeap () from C:\Windows\system32\ntdll.dll
#3  0x75b998cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
#4  0x0e450000 in ?? ()
#5  0x6c7e0529 in ?? () from C:\Games\CataclysmDDA\SDL2.dll
#6  0x6c78fb68 in ?? () from C:\Games\CataclysmDDA\SDL2.dll
#7  0x6c77eead in ?? () from C:\Games\CataclysmDDA\SDL2.dll
#8  0x006f11b9 in WinCreate () at Y:/Cataclysm-DDA-Fork/src/sdltiles.cpp:309
#9  0x006f752d in curses_init ()
    at Y:/Cataclysm-DDA-Fork/src/sdltiles.cpp:1433
#10 0x006ef8a2 in initscr () at Y:/Cataclysm-DDA-Fork/src/cursesport.cpp:43
#11 0x0068a430 in main (argc=0, argv=0xe4517f4)
    at Y:/Cataclysm-DDA-Fork/src/main.cpp:370
(gdb)
Contributor

brezerk commented May 5, 2015

As for:

Note: Windows tiles version wont work for me (SDL Segmentation fault). Maybe b/c of KVM+RDP+Binary/Game data are located on Network mapped drive (headbang);

Here the backtrace. Not sure what is wrong here :(

devw7@devw7-d3 MINGW32 /c/Games/CataclysmDDA
$ gdb.exe cataclysm-tiles.exe
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 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 "i686-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Games\CataclysmDDA\cataclysm-tiles.exe...done.
(gdb) run
Starting program: C:\Games\CataclysmDDA/cataclysm-tiles.exe
[New Thread 3512.0x678]
[New Thread 3512.0xc30]
[New Thread 3512.0x588]
[New Thread 3512.0xc04]

Program received signal SIGSEGV, Segmentation fault.
0x76f3e39e in ntdll!RtlInitUnicodeString () from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x76f3e39e in ntdll!RtlInitUnicodeString ()
   from C:\Windows\system32\ntdll.dll
#1  0x0e450000 in ?? ()
#2  0x76f3e003 in ntdll!RtlFreeHeap () from C:\Windows\system32\ntdll.dll
#3  0x75b998cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
#4  0x0e450000 in ?? ()
#5  0x6c7e0529 in ?? () from C:\Games\CataclysmDDA\SDL2.dll
#6  0x6c78fb68 in ?? () from C:\Games\CataclysmDDA\SDL2.dll
#7  0x6c77eead in ?? () from C:\Games\CataclysmDDA\SDL2.dll
#8  0x006f11b9 in WinCreate () at Y:/Cataclysm-DDA-Fork/src/sdltiles.cpp:309
#9  0x006f752d in curses_init ()
    at Y:/Cataclysm-DDA-Fork/src/sdltiles.cpp:1433
#10 0x006ef8a2 in initscr () at Y:/Cataclysm-DDA-Fork/src/cursesport.cpp:43
#11 0x0068a430 in main (argc=0, argv=0xe4517f4)
    at Y:/Cataclysm-DDA-Fork/src/main.cpp:370
(gdb)
@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 5, 2015

Contributor

Ok. I was able to test both MSYS2: MinGW32 and MinGW64 bit using:

For MinGW32:

        $ cmake -G "MSYS Makefiles" \
                -DCMAKE_MAKE_PROGRAM=mingw32-make\
                -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc\
                -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++\
                -DCMAKE_SYSTEM_PREFIX_PATH=/c/msys32/mingw32\
                ..
        $ mingw32-make

For MinGW64:

        $ cmake -G "MSYS Makefiles" \
                -DCMAKE_MAKE_PROGRAM=mingw32-make\
                -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc\
                -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++\
                -DCMAKE_SYSTEM_PREFIX_PATH=/c/msys64/mingw64\
                ..
        $ mingw32-make

Compiles ok. ncurses version works as expected. The tiles one fails as expected :D

Small investigation showes that it do segfault on:

WinCreate () at Y:/Cataclysm-DDA-Fork/src/sdltiles.cpp:309

 308         renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_ACCELERATED |
 309                                        SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE );
SDL_RENDERER_ACCELERATED the renderer uses hardware acceleration

Not sure if my KVM has any hw accel... :D

Contributor

brezerk commented May 5, 2015

Ok. I was able to test both MSYS2: MinGW32 and MinGW64 bit using:

For MinGW32:

        $ cmake -G "MSYS Makefiles" \
                -DCMAKE_MAKE_PROGRAM=mingw32-make\
                -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc\
                -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++\
                -DCMAKE_SYSTEM_PREFIX_PATH=/c/msys32/mingw32\
                ..
        $ mingw32-make

For MinGW64:

        $ cmake -G "MSYS Makefiles" \
                -DCMAKE_MAKE_PROGRAM=mingw32-make\
                -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc\
                -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++\
                -DCMAKE_SYSTEM_PREFIX_PATH=/c/msys64/mingw64\
                ..
        $ mingw32-make

Compiles ok. ncurses version works as expected. The tiles one fails as expected :D

Small investigation showes that it do segfault on:

WinCreate () at Y:/Cataclysm-DDA-Fork/src/sdltiles.cpp:309

 308         renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_ACCELERATED |
 309                                        SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE );
SDL_RENDERER_ACCELERATED the renderer uses hardware acceleration

Not sure if my KVM has any hw accel... :D

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 5, 2015

Contributor

Not sure if my KVM has any hw accel... :D

I can test this out again when I get home for you.

Contributor

KrazyTheFox commented May 5, 2015

Not sure if my KVM has any hw accel... :D

I can test this out again when I get home for you.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 5, 2015

Contributor

@KrazyTheFox It will be helpfull. thanks.

Contributor

brezerk commented May 5, 2015

@KrazyTheFox It will be helpfull. thanks.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 5, 2015

Contributor

Yeah. It seems like my assumption was correct.

I have modified config/options:SOFTWARE_RENDERING true

And now it works using sf renderer instead of hw one :)
ddatiles

Contributor

brezerk commented May 5, 2015

Yeah. It seems like my assumption was correct.

I have modified config/options:SOFTWARE_RENDERING true

And now it works using sf renderer instead of hw one :)
ddatiles

@kevingranade

This comment has been minimized.

Show comment
Hide comment
@kevingranade

kevingranade May 5, 2015

Member
Member

kevingranade commented May 5, 2015

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 6, 2015

Contributor

In case, if some one wish to test Cataclysm-DDA cmake build scripts, here is doc COMPILING-CMAKE.md

Contributor

brezerk commented May 6, 2015

In case, if some one wish to test Cataclysm-DDA cmake build scripts, here is doc COMPILING-CMAKE.md

@brezerk brezerk changed the title from [CR][WIP] CMake: update rules; add Linux install targets; add support for dev-builds; to [CR] CMake: update rules; add Linux install targets; add support for dev-builds; May 6, 2015

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 7, 2015

Contributor

Using a fresh install of msys and a clean copy of Cataclysm, I was unable to compile a working version on Windows. I still needed to specify the libraries as in my previous compilation post when using cmake. It would successfully generate the makefile and when running make, it would build without errors. Upon trying to run either cataclysm.exe or cataclysm-tiles.exe, nothing would happen and I was unable to get either of the exes to generate any error messages.

Contributor

KrazyTheFox commented May 7, 2015

Using a fresh install of msys and a clean copy of Cataclysm, I was unable to compile a working version on Windows. I still needed to specify the libraries as in my previous compilation post when using cmake. It would successfully generate the makefile and when running make, it would build without errors. Upon trying to run either cataclysm.exe or cataclysm-tiles.exe, nothing would happen and I was unable to get either of the exes to generate any error messages.

@macrosblackd

This comment has been minimized.

Show comment
Hide comment
@macrosblackd

macrosblackd May 7, 2015

Contributor

Did you install the deps with msys or manually?
On May 7, 2015 8:30 AM, "Mitchell Matthews" notifications@github.com
wrote:

Using a fresh install of msys and a clean copy of Cataclysm, I was unable
to compile a working version on Windows. I still needed to specify the
libraries as in my previous compilation post when using cmake. It would
successfully generate the makefile and when running make, it would build
without errors. Upon trying to run either cataclysm.exe or
cataclysm-tiles.exe, nothing would happen and I was unable to get either of
the exes to generate any error messages.


Reply to this email directly or view it on GitHub
#11970 (comment)
.

Contributor

macrosblackd commented May 7, 2015

Did you install the deps with msys or manually?
On May 7, 2015 8:30 AM, "Mitchell Matthews" notifications@github.com
wrote:

Using a fresh install of msys and a clean copy of Cataclysm, I was unable
to compile a working version on Windows. I still needed to specify the
libraries as in my previous compilation post when using cmake. It would
successfully generate the makefile and when running make, it would build
without errors. Upon trying to run either cataclysm.exe or
cataclysm-tiles.exe, nothing would happen and I was unable to get either of
the exes to generate any error messages.


Reply to this email directly or view it on GitHub
#11970 (comment)
.

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 7, 2015

Contributor

Did you install the deps with msys or manually?

With msys.

Contributor

KrazyTheFox commented May 7, 2015

Did you install the deps with msys or manually?

With msys.

@macrosblackd

This comment has been minimized.

Show comment
Hide comment
@macrosblackd

macrosblackd May 7, 2015

Contributor

That's strange, I was able to build with cmake and it detected the
installed dependencies.

On 5/7/15, Mitchell Matthews notifications@github.com wrote:

Did you install the deps with msys or manually?

With msys.


Reply to this email directly or view it on GitHub:
#11970 (comment)

Contributor

macrosblackd commented May 7, 2015

That's strange, I was able to build with cmake and it detected the
installed dependencies.

On 5/7/15, Mitchell Matthews notifications@github.com wrote:

Did you install the deps with msys or manually?

With msys.


Reply to this email directly or view it on GitHub:
#11970 (comment)

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 8, 2015

Contributor

@KrazyTheFox You are specifying archive libraries for !static build. I guess, this is the reason, why you are getting broken executables.

It is strange, b/c I had no need to specify the libraries manually...

Are you using mingw shell or msys2 shell to build the project?

msys2

Contributor

brezerk commented May 8, 2015

@KrazyTheFox You are specifying archive libraries for !static build. I guess, this is the reason, why you are getting broken executables.

It is strange, b/c I had no need to specify the libraries manually...

Are you using mingw shell or msys2 shell to build the project?

msys2

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 8, 2015

Contributor

Msys 2 shell. I'll spin up a clean Windows vm today and try it in there to make sure I don't have something external messing it up.

Contributor

KrazyTheFox commented May 8, 2015

Msys 2 shell. I'll spin up a clean Windows vm today and try it in there to make sure I don't have something external messing it up.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 8, 2015

Contributor

@KrazyTheFox If I understand it correctly, default "MSYS2 Shell" is used for pacman stuff.
I just checked, and it seems like it does not setup PATH for libraries/cmake/whatever for me too.

Can you try to build using "MinGW Win64 Shell" or "MinGW Win32 Shell" please?

Contributor

brezerk commented May 8, 2015

@KrazyTheFox If I understand it correctly, default "MSYS2 Shell" is used for pacman stuff.
I just checked, and it seems like it does not setup PATH for libraries/cmake/whatever for me too.

Can you try to build using "MinGW Win64 Shell" or "MinGW Win32 Shell" please?

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 8, 2015

Contributor

Using the MinGW32 shell did make it easier to build, but the problem wasn't that. I was building (or attempting to build) release versions with "-DRELEASE=1". When I switched that to "-DRELEASE=0" to build a debug build, it succeeded in building a working tiles build.

Edit: I'm able to build a release build that launches, however, when opened I get only a blank, black screen.

Contributor

KrazyTheFox commented May 8, 2015

Using the MinGW32 shell did make it easier to build, but the problem wasn't that. I was building (or attempting to build) release versions with "-DRELEASE=1". When I switched that to "-DRELEASE=0" to build a debug build, it succeeded in building a working tiles build.

Edit: I'm able to build a release build that launches, however, when opened I get only a blank, black screen.

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 8, 2015

Contributor

@KrazyTheFox Yes, -DRELEASE=1 require you to place binary into game folder manually make install currently will now work for Windows (will fix this in the future).

Does ncurses version works? afik: the first CataclysmDDA start can take some time, while it read game data and create an cache?

Not sure, but can you try to build with -DUSE_HOME_DIR=OFF option set.

Contributor

brezerk commented May 8, 2015

@KrazyTheFox Yes, -DRELEASE=1 require you to place binary into game folder manually make install currently will now work for Windows (will fix this in the future).

Does ncurses version works? afik: the first CataclysmDDA start can take some time, while it read game data and create an cache?

Not sure, but can you try to build with -DUSE_HOME_DIR=OFF option set.

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 8, 2015

Contributor

@brezerk
I've moved the exe manually and placed all the required DLLs in the folder as needed. I'll give the curses version a try later as well as the home dir option, but for now I must go spend a large sum of money on an air conditioner since my HOA sucks. :( Should be able to test this out this evening.

Contributor

KrazyTheFox commented May 8, 2015

@brezerk
I've moved the exe manually and placed all the required DLLs in the folder as needed. I'll give the curses version a try later as well as the home dir option, but for now I must go spend a large sum of money on an air conditioner since my HOA sucks. :( Should be able to test this out this evening.

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 8, 2015

Contributor

I've figured out the problems with the release builds. The .exe itself can be in any folder, but it expects the data/ folder to actually be located at C:\Program Files (x86)\CataclysmDDA\share\cataclysm-dda\. This is problematic, since the game can't access any of those files without running it as an Administrator and it also mean you'll need to copy those files manually with every update. The configuration directory it generates is in the correct place, ./config/. The debug build uses all relative paths as expected.

The exact cmake command run:

cmake -G "MSYS Makefiles" -DUSE_HOME_DIR=0 -DTILES=1 -DLOCALIZE=0 -DRELEASE=1 -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ -DCMAKE_SYSTEM_PREFIX_PATH=/c/msys32/mingw32 ..

I will say thanks for helping me out with all this and getting a simpler build system up on Windows. It'll be very nice to not have to run Cataclysm in a VM!

Contributor

KrazyTheFox commented May 8, 2015

I've figured out the problems with the release builds. The .exe itself can be in any folder, but it expects the data/ folder to actually be located at C:\Program Files (x86)\CataclysmDDA\share\cataclysm-dda\. This is problematic, since the game can't access any of those files without running it as an Administrator and it also mean you'll need to copy those files manually with every update. The configuration directory it generates is in the correct place, ./config/. The debug build uses all relative paths as expected.

The exact cmake command run:

cmake -G "MSYS Makefiles" -DUSE_HOME_DIR=0 -DTILES=1 -DLOCALIZE=0 -DRELEASE=1 -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ -DCMAKE_SYSTEM_PREFIX_PATH=/c/msys32/mingw32 ..

I will say thanks for helping me out with all this and getting a simpler build system up on Windows. It'll be very nice to not have to run Cataclysm in a VM!

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk May 8, 2015

Contributor

@KrazyTheFox thank you for your feedback.

-DPREFIX has no scene in case of WIN32 build, since it will hardcore data patch to CMAKE_INSTALL_PREFIX which is defaults to C:\Program Files (x86)\CataclysmDDA\share\cataclysm-dda\.

Fixed in: https://github.com/brezerk/Cataclysm-DDA/commit/6d0678c184c1793389e5a16fca5bc7af7eb48116

Contributor

brezerk commented May 8, 2015

@KrazyTheFox thank you for your feedback.

-DPREFIX has no scene in case of WIN32 build, since it will hardcore data patch to CMAKE_INSTALL_PREFIX which is defaults to C:\Program Files (x86)\CataclysmDDA\share\cataclysm-dda\.

Fixed in: https://github.com/brezerk/Cataclysm-DDA/commit/6d0678c184c1793389e5a16fca5bc7af7eb48116

@KrazyTheFox

This comment has been minimized.

Show comment
Hide comment
@KrazyTheFox

KrazyTheFox May 9, 2015

Contributor

@brezerk
Perfect! Just went through the whole set of instructions again to double check that things work. Built a release version that runs on Windows with almost no effort. Very nice!

Contributor

KrazyTheFox commented May 9, 2015

@brezerk
Perfect! Just went through the whole set of instructions again to double check that things work. Built a release version that runs on Windows with almost no effort. Very nice!

@kevingranade kevingranade merged commit 2cd2c05 into CleverRaven:master May 9, 2015

1 check passed

default
Details

@brezerk brezerk deleted the brezerk:improved_build_system branch May 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment