Compiling on windows

Compiling on windows

Postby Samonella » 14 Jun 2017, 18:32

Hello everyone! I'm just popping in to say that the INSTALL.md file seems to be a bit outdated for windows. I spent quite a while before managing to get cmake to work without any errors or warnings, and when it finally did I still couldn't compile. I don't know if that's because I didn't put in the right filepaths or because I was using visual studio 2017 community edition, whereas INSTALL.md only mentions 2015. Eventually, I gave up and setup my computer to dual boot linux, installed all the dependencies, configured, made, and installed supertux, which all combined still took me less time than getting supertux to work with cmake on windows.

I'm not demanding that someone figure out what went wrong or anything (to be honest, there's a good chance it was my fault anyway, not the code), just thought the developers might want to know. If you want, i'd be happy to detail the errors and what I tried doing. Anyway, as long as I'm posting, here's a sincere thank you to the developers and level contributers, you made a big part of my childhood!
Samonella
 
Posts: 3
Joined: 14 Jun 2017, 18:03

Re: Compiling on windows

Postby Tobbi » 15 Jun 2017, 10:03

Samonella {l Wrote}:If you want, i'd be happy to detail the errors and what I tried doing. Anyway, as long as I'm posting, here's a sincere thank you to the developers and level contributers, you made a big part of my childhood!


Yes, please do so! This helps us improve the build process. Thanks!
SuperTux developer.
User avatar
Tobbi
SuperTux Moderator
 
Posts: 353
Joined: 12 Oct 2013, 13:08

Re: Compiling on windows

Postby Samonella » 15 Jun 2017, 21:43

Tobbi {l Wrote}:Yes, please do so! This helps us improve the build process. Thanks!

Earlier attempts, mostly just a list of my mistakes:
Right. So the first thing I did (and the first mistake I made) was to download the repository as a zip. Then (I had never used cmake before, only heard of it) so I had to figure out that it was a program I needed to install. Next I tried the 'cmake ..' command, but got lots of errors; cmake couldn't find ANY of the dependencies or external libraries. Like i said, I've never used cmake before, but looking through CMakeLIsts.txt, it sure looks like it's supposed to find those folders on it's own; I put the dependencies folder just where INSTALL.md said to. Anyway, I slowly specified each file path (after figuring out that cmake doesn't use the regular environment variables and I had to use -Dxxx=<filepath> in the command) and figured out that the 'external' libraries didn't download in the zip with everything else, so I added them one by one too.

Finally, there was just one error left, cmake couldn't find the version number. Apparently those used the git version (or so I gathered from CMakeLists.txt and version.cmake.in) so eventually I tried starting over with a properly cloned repo. I still had to specify each and every path to .libs and include directories, but eventually I actually got it to configure and generate the makefiles without errors or warnings.

Of course... I don't know if that guarantees that I gave it the right file paths, or if it was just satisfied that I had given it some filepath for each required library. But at any rate, I could open the solution in Visual Studio 2017. I'm pretty sure that cmake was targeting the right compiler (the 2017 VS one) but I still can't build the entire solution. Many of the individual projects (squirrel, physfs) will build without so much as a warning, but if I try to build the entire thing (or one of the 'supertux2' projects) things don't go so well:

I get hundreds of C4244 warnings, about converting from dobule to float or something very similar
Also common, but much less so, is 'Unknown compiler version - please run the configure tests and report the results'
A few rare warnings (there doubtless are others I missed):
  • warning C4068: unknown pragma
  • 7>C:\Users\samth\Documents\supertux\src\video\drawing_context.cpp(263): warning C4291: 'void *operator new(::size_t,obstack &)': no matching operator delete found; memory will not be freed if initialization throws an exception
  • 7>C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\corecrt_math_defines.h(22): warning C4005: 'M_PI': macro redefinition (compiling source file C:\Users\samth\Documents\supertux\src\supertux\menu\keyboard_menu.cpp)
  • C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\memory(1384): note: see reference to function template instantiation 'std::_Ref_count_obj<_Ty>::_Ref_count_obj<Vector&,int,int,int,int,Vector,int,Color&,double,double,int>(Vector &,int &&,int &&,int &&,int &&,Vector &&,int &&,Color &,double &&,double &&,int &&)' being compiled
    with
    [
    _Ty=Particles
    ]
Finally, I suddenly get 202 errors. As far as I can see, they are all from supertux2.lib, and all say 'unresolved external symbol' followed by something like '_SDL_RenderReadPixels' or '_ov_pcm_tell.' These are followed up by about a dozen warnings: "warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'," coming from the dependency libraries.

...
Ok, that actually explains a lot of the problems. Apparently my system information lied to me, and i should have gotten the x32 dependeny package. Which explains why cmake couldn't find anything, it expected to find things in a directory called dependencies32. Let me try this one more time.

Today's attempt, this time with the right dependencies package:
Right off the bat things look much better, the only library cmake can't find is physfs. It also has these two concerning looking lines:
-- Looking for vorbis_bitrate_addblock in vorbis - not found
-- Performing Test HAVE_ICONV_CONST - Failed
But apparently these aren't fatal errors; they aren't even mentioned next time i try the command. I set PHYSFS_INCLUDE_DIR and PHYSFS_LIBRARY both to an absolute path to external\physfs\src (since I can't find any .lib or .so files for physfs) and cmake runs without errors or warnings.

Open the solution with visual studio aaaaaand... what do you know. I'm still swamped in warnings, but it finishes without errors. run_supertux.bat doesn't work though, whether I build in release or debug. It says it can't find supertux.exe, even though it exists in the debug/release folder. If I try to run the exe directly it says it can't find squirrel.dll. I'm too tired of this to figure it out today.

TL;DR
For the most part I got it to work after all, there are just lots of warnings, I had to specify paths to physfs, and run_supertux.bat doesn't work (or i just don't know how to use it). I suppose the next step would be trying to run the "configure tests," wherever those are, so I can "report the results" like the warnings asked me to.
Samonella
 
Posts: 3
Joined: 14 Jun 2017, 18:03

Re: Compiling on windows

Postby Tobbi » 17 Jun 2017, 20:54

Hey, thanks. I'll get someone to look at it.
SuperTux developer.
User avatar
Tobbi
SuperTux Moderator
 
Posts: 353
Joined: 12 Oct 2013, 13:08

Re: Compiling on windows

Postby Samonella » 22 Jun 2017, 21:08

Hey, so it turns out all I needed to do to make the .bat file work was cd into the Release folder (where the .exe was). Heh heh. Now i've played a couple levels and everything seems to be working great!

However, I can't figure out what the "configure tests" are. Visual studio can't find any unit tests, and all I can find are a few short files in the "tests" folder that I don't exactly know what to do with (I haven't used c++ too much).
Samonella
 
Posts: 3
Joined: 14 Jun 2017, 18:03

Re: Compiling on windows

Postby Tobbi » 28 Jun 2017, 10:55

afaik, configure tests are for the compiler to find the correct setup of your machine.
SuperTux developer.
User avatar
Tobbi
SuperTux Moderator
 
Posts: 353
Joined: 12 Oct 2013, 13:08

Who is online

Users browsing this forum: No registered users and 1 guest