Page 1 of 1

Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Sun Oct 10, 2010 12:59 am
by Kuoxsr
Hi there to anyone who may be interested.

Last night, I started to build the latest source files in Visual Studio 2010 (that would be revision 12925.) My hope is that I can streamline the build process and create a step by step list that anyone should be able to follow. From other posts, it appears that there have been some major changes lately that make it difficult to build Vega Strike on Windows, with some people questioning whether it's even going to be possible. I saw that shenle attempted this a while ago, but there doesn't appear to be any resolution to it.

Rather than revert to the revision shenle used and go through his steps, I decided to start fresh from revision 12925.

Here is what I have done so far:
  • Installed Visual C++ 2010 Express
  • Installed SVN (and Tortoise)
  • Installed Python 2.6 (actually, I tried the latest version first, and then discovered that PYString_FromString was missing, so I had to revert)
  • Installed Boost 1.44 (not sure whether I can make this work yet, as Vega Strike is currently built against 1.35, I think)
  • Installed the Windows 7 platform SDK
  • Checked out Vega Strike's head revision source code (12925)
  • Copied the vega-vc8 folder and renamed the new folder to vega-vc10
  • Opened the vegastrike2008.sln solution file from the vega-vc10 folder in the IDE, and told Visual C++ 2010 to convert the project. I'll rename it to 2010 once it compiles.
Here are a few things I did when the first compile was filled with errors:
  • Went into the properties of the "vegastrike" project (Configuration Properties|C/C++|General|Additional Include Directories), and changed the boost folder to my boost installation location "$(MSBuildProgramFiles32)\boost\1_44". I did this for every possible configuration.
  • Installed the OpenAL11SDK, to try to fix an issue with dev = alcOpenDevice( "DirectSound3D" ). Installing the openAL SDK did nothing. In the end, I had to do the following: dev = alcOpenDevice( (ALCubyte*)"DirectSound3D" ). There was another thread about this, but the only advice was to get the latest version of openal. Since I've never intentionally installed the openal library before today, I assume I must have the latest version.
  • Deleted the "boost" folder from the "vegastrike" project, because the linkage to these files was hard-coded to "..vegastrike\boost\1_35\src\" and there was nothing there in SVN. Generally, it's not considered good practice to copy files from someone else's library into your source folder; makes it harder to stay up to date that way. Once I redirected the include folders to my local 1_44 boost installation and deleted the hard-coded boost folder, most of my file not found errors went away, which is good, because finding how it kept asking for 1_35 was truly maddening.
  • Deleted the following files from the following folders (only in the project file, of course): cmd\unit_bsp.cpp & .h, gfx\bounding_box.cpp & h, gfx\bsp.cpp & h, and gui\general.cpp & h. These files were nowhere to be found in the vegastrike source code in SVN. I can only assume that further development on a Linux version removed them, and the project file got out of date.
I now have only one error (for now):

error C3861: 'png_set_expand_gray_1_2_4_to_8': identifier not found

Anyone have any thoughts? I've attached my build log.

Thanks in advance.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Sun Oct 10, 2010 8:26 pm
by klauss
The change was done in r12688, fixing ticket #18 ( http://vegastrike.wcjunction.com/trac/ticket/18 if you can see it without logging in ), basically, newer versions of libpng have deprecated some functions and they were replaced by the ones your compiler can't find.

You'd have to update the libraries to newer versions.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Mon Oct 11, 2010 12:49 am
by ace123
I ran into the same error, so I looked in a header, and saw a similar version that was missing "expand_" (the comment said it was also expanding colors, so I assume it was just renamed).

I just committed a fix to use that one instead for WIN32.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Tue Oct 12, 2010 8:18 am
by Kuoxsr
Well, I was able to compile the latest revision with VS2008 and 2010. Hooray!

The problem is that the binaries that get built won't run. Well, to be more precise, they won't stay running.

When it starts up, where there should be a splash screen, I see nothing but a red rectangle. Music plays for a while, and I can see modules loading, but eventually it crashes. The last thing it loads (at least that it reports on-screen) is spec04.image, and then it dies.

I'll try to track down what might be going wrong. I assume that ace123 does not have the same error...

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Mon Oct 18, 2010 7:42 pm
by shenle
Yes, I have the same result. I managed to compile the latest svn (12930) after replacing all of boost with the latest revision; in addition to what was said above, I had to replace all of the "boost" files themselves in the project with the newer versions.

The generated binary runs, but only shows a solid red rectangle then crashes.

FWIW I'm attaching the stdout and stderr.

I'm pretty sure we're missing on something big.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Tue Oct 19, 2010 1:42 am
by Kuoxsr
I'm glad I'm not the only one.

In debugging the app, it seems to crash on line 479 of winsys.cpp, several times through the loop.

Not sure why yet, though.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Tue Oct 19, 2010 5:02 pm
by shenle
Here's more information.

I use 2 computers, let's call them "build machine" which runs Windows 7, and "test machine" which runs XP.

On the build machine, the compiled binary of rev.12930 behaves as above (red rectangle then crash). The vegastrike.exe from the win32 svn folder (rev.12926 committed by ace123 on 10/10) also does the same. Some previous builds (rev 12742, 12748 and 12763) begin loading, show some splash screens then crash with a runtime error.

On the test machine, ace123's binary from the svn runs perfectly fine. :o
I did not test my binary on the test machine yet... but I wouldn't be surprised if it runs there too. I'll try it tonight. The older builds crash on that machine also.

Now, the test machine used to be my previous build machine when I was experimenting with codeblocks+VC toolkit, cmake on Windows, various libraries etc. It's hard to say at this point what extra stuff it has that's not on my (current) build machine.

(edit) I've tested my compiled binary of rev 12930 on the test machine, it starts running and actually displays a couple of startup images, then crashes. No red rectangle. Stdout/stderr attached, but I see nothing useful in there.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Wed Oct 20, 2010 3:36 am
by ace123
The one glaring difference between your build and mine is Visual C++ Express 2010 instead of 2008, so I'm going to wager a guess that there's some sort of subtle incompatibility between the two, and some of the .lib's we use need to be recompiled.

I'm probably not going to install yet another version of visual studio on my computer for a while, so if you use 2010, you're kind of on your own for now.

I will suggest either getting 2008 SP1 for now, or try to dig deeper into the cause of the crash. If you can reproduce the problem on VC 2008, then it will be easier for me to find a workaround so that we aren't changing two variables (new VC version + new computer)

Thanks for testing this.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Wed Oct 20, 2010 4:35 am
by shenle
Well 2008 isn't available anymore, 2010 is all you can get.

And... your compiled binary, inside a freshly checked out win32 folder, works on the XP computer... but not on the Windows 7 one. The XP computer may have on it some older libraries (or may not), but the Win7 one for sure doesn't have any crap laying around.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Wed Oct 20, 2010 5:08 am
by ace123
They always go one revision back for compatibility reasons.

Did you try this one?
http://www.microsoft.com/express/Downlo ... _Downloads
but not on the Windows 7 one.
I built and tested my binary on windows 7, so it shouldn't be a compatibility problem.
The red rectangle sounds like a graphics driver issue, especially if it happened on previous versions as well.
Make sure you have the latest Intel/NVIDIA/ATI drivers from the chip manufacturer's website (don't get them from Microsoft's site--those are years out of date).

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Wed Oct 20, 2010 5:14 am
by shenle
Yes, ATI drivers up-to-date on the Win7 machine, and nVidia on the XP one...

The red rectangle only happens on the Win7 computer, and it happens with both my compiled version, and with yours. It does not happen on XP with either version (but mine still crashes there too while yours runs).

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Wed Oct 20, 2010 2:25 pm
by Kuoxsr
I thought that it might be VC2010 as well, so I installed 2008 and built it (same day.) I got the same red rectangle and crash.

Older versions worked on Windows 7. For example: r12868 runs just fine.

Something has changed with this revision.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Thu Oct 21, 2010 3:11 am
by ace123
Yikes. Anything could have changed between those two builds.

May I suggest possibly going into setup.exe and turning off shaders and turning down some other things?
I don't have an ATI computer so it might be something we're doing wrong there.

Another possibility is a sound-related crash. We found some sound cards which crashed Vega Strike in some cases, such as when there was no speaker cable plugged into the computer.
I think we fixed all the sound issues, but it's possible that your audio driver does something different.
To test this, can you try turning Sound/Music off in Setup.exe?

r12868 was a binary from around March, 2010 built with VS 2003 or 2005--so completely different. There's been months of development between the two (especially the new sound system).

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Fri Oct 22, 2010 12:46 am
by Kuoxsr
Sound: no sound
Music: Off
Video: Retro detail
Shaders: No shader support

I still get a red rectangle, and it eventually crashes.

Here's the error from Visual C++:

Unhandled exception at 0x77918c19 in vegastrikeD.exe: 0xC0000005: Access violation writing location 0x00000014.


The last item on the call stack is the following line of code:

PyRun_SimpleFile( inFile, pyfile );

This is on line 91 of base_xml.cpp.

Maybe I have the wrong version of python? How do I correctly install that? Is there a special procedure I need to follow to make sure I have the right version of Python? I installed 2.6, but is this the right version?

See the attachment for the contents of inFile the moment it crashes.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Sun Nov 14, 2010 12:22 am
by pheonixstorm
Compiling for win32 has always been a real bitch... I had a working exe for awhile but that was pre cubemaps... which is another thing to ask about. Did the project file you used to compile have cubemaps included? I havent checked any of the source lately (been running ragged by a new baby and trying to find work), but have recently started back on a few of my projects.

I will see if I can find my backup of what I was working on.. If not I will rebuild everything again.

Don't forget to recompile ALL of the dll files that are required (not many) suchs as python. On a side note has ffmpeg been included yet?? If so that will need to be compiled under mingw and NOT VC according to the sites win compile doc.

Maybe I can get another working build going again... It was such a pain the first time around... I have one build machine running VC6 and VC8 while this machine will end up running VC9 under XP and VC10 under 7 (tri boot xp/7/ubuntu hehe)

Heres hoping for a stable win build :mrgreen:

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Sun Nov 14, 2010 8:28 pm
by ace123
The only way to know you have the correct version of python is to compile it yourself, using VC 2010, in both Debug and Release, as crappy as it may seem. Then, make sure your project references the includes from that version of python, as well as the debug and release "python26.lib" that your compile generated. At this point, you'll need to Rebuild All in the vegastrike.sln!

Also, you'll need to have the DLLs fom that version (both the debug and release versions) in the same bin directory as vegastrike. If you get stuck on this part, there's a program called "Dependency Walker" you can download (depends.exe) which will tell you which DLL version it is actually using, and you can move things around until it finds your version. At that point, you will definitely stop getting crashes in python code.

If you don't want to do this, it is possible to fix the python errors by making sure you pass no data structures between Vegastrike and Python. In your case, the reason it's likely crashing is because you're passing a FILE*, and the size of a FILE has changed between versions of Visual Studio (I remember having this bug in other places). It might be enough to change that code segment to read in all the data from the file, and then do PyRun_SimpleString instead of PyRun_SimpleFile.

Re: Compiling r12925 on Windows 7 with Visual C++ Express 2010

Posted: Mon Nov 15, 2010 5:23 am
by pheonixstorm
Adding NV_CUBE_MAP to the preprocessor directives will clear up the white space background under the other compile. Not sure about the white ship yet...