Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004269 [DCSS] Patches minor always 2011-07-16 07:42 2013-05-20 00:53
Reporter Alexx999 View Status public  
Assigned To mumra
Priority normal Resolution done  
Status resolved   Product Branch 0.9 ancient branch
Summary 0004269: Building with MSVC broken (partial fix)
Well, I've seen that there where some attempts to patch this before, but without any success (w
ith reasons not to include patches into master were like "it may make it work worse on some pla
tforms"). Some steps where made since 0.8.1 (a few problems less), but until now there was no p
atch that will fix everything without affecting other platforms.

I've made patch that makes MOST of changes in msvc.h with only very light changes in other files.

List of changes:
- New folder MSVC2010 with solution files and "include" folder that contains posix include
 files that are needed by DCSS, but missing in MSVC

- AppHdr.h:
    Moved two includes lower so they are below msvc.h

    Included AppHdr.h

    Changed struct member assignment to less cool looking but accepted by MSVC

    Moved #include "AppHdr.h" higher so it's above other includes

And that's all - no breaking changes to code at all.

PS: file "pointer.asm" adds support for win2000 (stubs for EncodePointer/DecodePointer) 
PPS: msvc build results in nearly 40% smaller executable (compared to MinGW (GCC-4.5.2)) even if lin
ked statically
Additional Information
Tags No tags attached.
Attached Files ? file icon 0001-Partial-fix-for-broken-MSVC-build-still-need-to-fix-.patch [^] (142,525 bytes) 2011-07-16 07:42
? file icon crawl-0001-Added-VS2010-solutions-and-projects.patch [^] (186,768 bytes) 2011-07-17 20:20
? file icon crawl-freetype-0001-Add-VS2010-project.patch [^] (110,139 bytes) 2011-07-17 20:20
? file icon crawl-libpng-0001-Add-VS2010-project.patch [^] (40,146 bytes) 2011-07-17 20:21 [Show Content]
? file icon crawl-lua-0001-Add-VS2010-project.patch [^] (12,399 bytes) 2011-07-17 20:21 [Show Content]
? file icon crawl-pcre-0001-Add-VS2010-project.patch [^] (11,250 bytes) 2011-07-17 20:21 [Show Content]
? file icon crawl-sdl-0001-Add-VS2010-projects.patch [^] (34,288 bytes) 2011-07-17 20:21 [Show Content]
? file icon crawl-sdl-image-0001-Add-VS2010-project.patch [^] (211,701 bytes) 2011-07-17 20:22
? file icon crawl-sqlite-0001-Add-VS2010-project.patch [^] (11,563 bytes) 2011-07-17 20:22 [Show Content]
? file icon crawl-zlib-0001-Add-VS2010-project.patch [^] (66,696 bytes) 2011-07-17 20:22 [Show Content]

- Relationships
duplicate of 0003976resolvedmumra cmake and msvc support 
has duplicate 0001271resolvedneunon Compiling DCSS with MSVC 
related to 0006049resolvedmumra Xcode project files outdated; fail in OS X 10.8 

-  Notes
KiloByte (manager)
2011-07-17 01:50

A non-intrusive fix, me likes.

A separate directory for MSVC2010 and earlier versions is not nice, but as far as I know, project files are not compatible, with conversion taking manual effort (is that right?).

It doesn't yet work for me, though. Thus, I did not add the MSVC2010/ directory for now -- but other parts are in.
Alexx999 (reporter)
2011-07-17 03:59
edited on: 2011-07-17 03:59

Yes, that's right - they're not compatible. Actually, there are automated upgrading (not always adequate) and no downgrade options.

I saw many opensource projects that finished with separate project/solution files for each MSVC version - FreeType2 in deps of DCSS to name one.

It still doesn't have any prebuild - unfortunately I'm not as good with makefiles as with C language concepts :(

if somebody will help me a bit and say how I can hack makefile so it writes all executed commands into a text file (or even better - just GEN commands) - I'll make prebuild script from that.

golgepapaz (reporter)
2011-07-17 15:01

Yay, a fellow MSVC user like me. Getting past the kilobyte's ruthless vetting process is not easy as we don't get much luv.I also use msvc but I am using a cmake generated MSVC project (works with msvc 2010 and 2008) but seeing we may gain some momentum here, I'd like to chip in some of my thoughts.

  Adding per configuration project files is not really the solution here seeing they are hard and cumbersome modify everytime the makefile changes and you have to do it for every project file msvc2008,2010,contribs(if those ever change) and although it's not pertinent here what about xcode?
POSIX header files does not need to be included except inttypes.h (which I've managed to getting included somehow), the code is written with consideration
to those and compiles and runs just fine if you omit them.(by preprocessor directives), I don't think we need to include them in a non supporting platform for the sake of not changing the existing code. I had committed this before(see my relevant post) but it was, not accepted/overlooked last time. Thanks for getting that one in.One less local commit for me.

msvc.h :
  define mode_t unsigned short;
this should be a typedef IMO ,yeah the place is right this time. I'd placed this in syscalls.h before (again see my relevant post)

//this is targeting for st
#define _int64 var_int64
 Heh I've renamed this to int64type before and castigated for my poor english skills .Then again I am not comfortable with replacing an implementation defined datatype(a widely used one) to something else by a macro mechanism. Changing the name of the variable is way too less error prone and it can not possibly introduce any bugs other than looking less slick and inconsistent.

 Overloading for math functions.
 Thanks for this one also. Another less local commit for me.
 I think there should be a rule that states "Don't forget to include AppHdr.h in your source files as first thing if you don't want to be frowned upon by a angry and spiteful minority called windows developers" and put it in development docs or something like that :).

Well we still have a game-crashing bug in the form of a [^] in here.Although kilobyte is right standard-wise here, MSVC insist using a signed enum variable (unless we use the nonstandard extension which is worse), we can wait this out until C++0x becomes the norm in five years or so then fix it sneakily :).

Also For your generation needs I give you this. those are generated by cmake so change the directories as appropriate.You need a patched because the current one does not work with command prompt...

cd E:\crawl\crawl-ref\source
perl E:/crawl/crawl-ref/source/util/
if errorlevel 1 goto :VCEnd

Generating ../art-data.h, ../art-enum.h, ../rltiles/, ../rltiles/dc-unrand.txt


cd E:\crawl\crawl-ref\source
perl E:/crawl/crawl-ref/source/util/ compflag.h UNKNOWN UNKNOWN
if errorlevel 1 goto :VCEnd
perl E:/crawl/crawl-ref/source/util/ build.h
if errorlevel 1 goto :VCEnd


Generating ../compflag.h, ../build.h

cd E:\crawl\crawl-ref\source
perl E:/crawl/crawl-ref/source/util/
if errorlevel 1 goto :VCEnd


Generating ../mon-mst.h

For the Tiles build, do this for every dngn,feat,floor,gui,icons,main,player,wall.
Change the names as required.


cd E:\crawl\crawl-ref\source\rltiles
E:\crawl\crawl-ref\source\build\rltiles\tool\Debug\tilegen.exe E:/crawl/crawl-ref/source/rltiles/dc-dngn.txt
if errorlevel 1 goto :VCEnd
"d:\Program Files\DEVELOP\CMake 2.8\bin\cmake.exe" -E copy dngn.png E:/crawl/crawl-ref/source/rltiles/../dat/tiles/dngn.png
if errorlevel 1 goto :VCEnd


 Generating ../../rltiles/
KiloByte (manager)
2011-07-17 16:03

goglegapaz: while I do have reasons against cmake for building in the general -- it stops any serious cross-compiling and doesn't allow reliable detection of available libraries and their features, it might be not a bad idea to have cmake generate MSVC08/10 projects. MSVC can't do cross compiling, contribs are always built, etc -- it's a static configuration that doesn't need detecting anything.
KiloByte (manager)
2011-07-17 16:16

A totally unrelated thing: perhaps either of you has a clue if Uniscribe or its ilk can be forced to work with freetype somehow?

If we are to have translations for 0.10, there is one important problem to solve: given a glyph, Crawl needs to locate a system font that includes it. My current plan is to use pango (which pulls in fontconfig and glib), as it works cross-platform, giving the same functionality on Windows, Unix and Mac, and integrates well with freetype as well. The last part is not needed -- merely a path to the font would be enough (OpenType collections complicate this a bit), but as far as I know, Uniscribe can at most draw some text for you to a DC, with little support for fixed width glyphs (especially in a mix with CJK). Scraping that into a bitmap and converting it into a texture could work, but that's a lot of complexity compared to using the same API for all platforms.
golgepapaz (reporter)
2011-07-17 17:49

I tend do disagree but again stating that I am not very knowledgeable about cross-compiling and might very well be talking out of my depth but I have successfully created makefiles for mingw from a linux host including using imported targets from host(tilegen) with minimal changes and although it didn't compile (nor did the regular makefile in that respect at the same place) the process was relatively painless. I wonder how many cross compiling options we currently support out of the box.(I really do and asking out of ignorance). As for library detection we can't do worse than what we have at the moment, we hard code the paths or using pk-config to locate the libs which cmake can easily do .I think latest cmake also supports the triplets for library detection but we've discussed this before and I am okay with side by side configuration. Me and/or Alexx can maintain this.

As for uniscribe I don't have a clue tbh.But translation idea seems wonderful although it looks like an enormous undertake
Alexx999 (reporter)
2011-07-17 20:16
edited on: 2011-07-18 00:24

well, thanks for the prebuild description, but I'be managed to hack makefile by that moment :)

about #define _int64 var_int64:
well, yes, dirty-dirty hack, but, since _int64/__int64 are microsoft-specific - it's pretty safe.

about POSIX headers:
since all devs except for us two are on *nix (at least it looks so, and MinGW/MSYS is still a *nix build system) I suppose it wouldn't hurt much to have some headers for compatability in case somebody forgets about VC #ifdefs. And all of those headers where needed to build 0.8.1 (need for unistd.h fixed by now, not sure about others)

about game-crashing bug:
how could I see that crash? game seems work just OK for me.

Prebuilt finally working. Also added projects for contrib.
All patches but sdl-image contain only projects. SDL-image also has two updated headers (used to be 1.2.8 while crawl-libpng is 1.4.0 - could lead to problems)

golgepapaz (reporter)
2011-07-17 23:18

yes they are microsoft specific and that's where the problem lies in.What if a system header that uses _int64 gets included along the chain? it might be rare but it's might happen in the future but I digress.

I can build the trunk with just inttypes.h and stdint.h in my msvc folder with no problems

any dungeon feature with enum greater than 127,creating a god altar and saving the game does the trick for me. also there are other modifications that need to be done for console,debug and WIZARD builds and other myriad of choices that you can specify from command line.have you tried those?
Alexx999 (reporter)
2011-07-17 23:41

well, since it doesn't cause any trouble for anything but VC - it can be hacked around, for example including that header in msvc.h above that define.

well, OK then, other headers could be omitted when submitting to trunk.

your patch resolve that issue?
console build working, debug builds too. and wtf is WIZARD? also I would be happy if anybody would give some tips about other choises
golgepapaz (reporter)
2011-07-18 00:03

well it enables wizmode, also I'll paste an excerpt of the cmake file I am using
so you can figure out the options available to you.

    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4351 /wd4244 /wd4996")

    set(FT ON)
    set(SDL ON)
    set(GL ON)
Alexx999 (reporter)
2011-07-18 00:12

well, patch for build without LUA buildings I've submitted a bit earlier. however, it's no longer supported so CLUA_BINDINGS should be defined always

FULLDEBUG/ASSERTS - debugging options I suppose?
WIZARD - some gameplay feature? same goes for EUCLIDEAN, I suppose.

WINMM_PLAY_SOUNDS - is it MinGW exclusive? or it may work with msvc?
Alexx999 (reporter)
2011-07-18 00:44
edited on: 2011-07-18 01:00

about fonts:

Uniscrybe has multiple steps in process of rendering something to screen, so it's potentially possible to use FreeType with it.

However, pango is using Uniscribe as backend on Windows platform.

mumra (developer)
2013-03-29 18:36

I've linked to the two older tickets attempting to fix this issue for reference.

It'd be really good to get things building in MSVC.

I have VS2012 now - at some point I'll look through these patches and see how easily the VS2010 project can be upgraded.

Is Alexx999 still around? Would be good to get some help with the project files since it's an area I don't know much about.

For reference:
"WIZARD" means compile with wizmode
"EUCLIDEAN" sounds like probably something redundant relating to squarelos

The others are reasonably self-explanatory.
mumra (developer)
2013-05-20 00:53

MSVC compilation is now working and in trunk, using Alexx999's patch and some other contributions and tweaks -- closing this issue.

- Issue History
Date Modified Username Field Change
2011-07-16 07:42 Alexx999 New Issue
2011-07-16 07:42 Alexx999 File Added: 0001-Partial-fix-for-broken-MSVC-build-still-need-to-fix-.patch
2011-07-17 01:50 KiloByte Note Added: 0013839
2011-07-17 03:59 Alexx999 Note Added: 0013840
2011-07-17 03:59 Alexx999 Note Edited: 0013840
2011-07-17 03:59 Alexx999 Note Edited: 0013840
2011-07-17 15:01 golgepapaz Note Added: 0013848
2011-07-17 16:03 KiloByte Note Added: 0013855
2011-07-17 16:16 KiloByte Note Added: 0013856
2011-07-17 17:49 golgepapaz Note Added: 0013859
2011-07-17 20:16 Alexx999 Note Added: 0013860
2011-07-17 20:16 Alexx999 Note Edited: 0013860
2011-07-17 20:19 Alexx999 Note Edited: 0013860
2011-07-17 20:20 Alexx999 File Added: crawl-0001-Added-VS2010-solutions-and-projects.patch
2011-07-17 20:20 Alexx999 File Added: crawl-freetype-0001-Add-VS2010-project.patch
2011-07-17 20:21 Alexx999 File Added: crawl-libpng-0001-Add-VS2010-project.patch
2011-07-17 20:21 Alexx999 File Added: crawl-lua-0001-Add-VS2010-project.patch
2011-07-17 20:21 Alexx999 File Added: crawl-pcre-0001-Add-VS2010-project.patch
2011-07-17 20:21 Alexx999 File Added: crawl-sdl-0001-Add-VS2010-projects.patch
2011-07-17 20:22 Alexx999 File Added: crawl-sdl-image-0001-Add-VS2010-project.patch
2011-07-17 20:22 Alexx999 File Added: crawl-sqlite-0001-Add-VS2010-project.patch
2011-07-17 20:22 Alexx999 File Added: crawl-zlib-0001-Add-VS2010-project.patch
2011-07-17 20:26 Alexx999 Note Edited: 0013860
2011-07-17 23:18 golgepapaz Note Added: 0013866
2011-07-17 23:41 Alexx999 Note Added: 0013867
2011-07-18 00:03 golgepapaz Note Added: 0013870
2011-07-18 00:12 Alexx999 Note Added: 0013871
2011-07-18 00:24 Alexx999 Note Edited: 0013860
2011-07-18 00:44 Alexx999 Note Added: 0013873
2011-07-18 00:46 Alexx999 Note Edited: 0013873
2011-07-18 01:00 Alexx999 Note Edited: 0013873
2013-03-29 18:31 mumra Relationship added has duplicate 0001271
2013-03-29 18:31 mumra Relationship added duplicate of 0003976
2013-03-29 18:36 mumra Note Added: 0021989
2013-03-29 18:44 mumra Relationship added related to 0006049
2013-03-29 18:48 mumra Severity major => minor
2013-05-20 00:53 mumra Note Added: 0022710
2013-05-20 00:53 mumra Status new => resolved
2013-05-20 00:53 mumra Fixed in Branch => 0.13 development branch
2013-05-20 00:53 mumra Resolution open => done
2013-05-20 00:53 mumra Assigned To => mumra

Mantis 1.1.8[^]
Copyright © 2000 - 2009 Mantis Group
Powered by Mantis Bugtracker