compiling MSVC 8.0 / SVN

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
odenter
Space Krill
Posts: 7
Joined: Mon Jul 07, 2008 5:00 pm

compiling MSVC 8.0 / SVN

#1 Post by odenter »

Hi,
first of all my english in writing isn't perfect. :-)

When I try to compile FreeOrion I got the following error messages:

Project includes are:

Code: Select all

C:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\include
C:\_daten\dev\extern\Python25\include
../../../network/
Studio includes are:

Code: Select all

C:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\FreeOrion\GG
C:\_daten\dev\extern\Python25\include
C:\_daten\dev\extern\boost\boost_1_35_0
C:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\include
FreeOrion needs boost 1.35 but in that SDK boost 1.34 is included

Code: Select all

1>------ Neues Erstellen gestartet: Projekt: freeorion, Konfiguration: Release Win32 ------
1>Die Zwischen- und Ausgabedateien für das Projekt "freeorion" mit der Konfiguration "Release|Win32" werden gelöscht.
1>Kompilieren...
1>ClientApp.cpp
1>ClientFSMEvents.cpp
1>chmain.cpp
1>c:\_daten\dev\projekte\freeorion\trunk\freeorion\client\human\HumanClientApp.h(26) : error C2039: 'SDLGUI': Ist kein Element von 'GG'
1>HumanClientApp.cpp
1>c:\_daten\dev\projekte\freeorion\trunk\freeorion\client\human\HumanClientApp.h(26) : error C2039: 'SDLGUI': Ist kein Element von 'GG'
1>c:\_daten\dev\projekte\freeorion\trunk\freeorion\ui\LinkText.h(26) : error C2039: 'Flags': Ist kein Element von 'GG'
...
EDIT:
No I added

Code: Select all

C:\_daten\dev\projekte\FreeOrion\trunk\FreeOrion\GG
to my include directories and it looks like its working.
Maybe I would be good to clean up these sdk/project settings so that you download each one with correct relative paths.

However I get an new error

Code: Select all

1>C:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\include\log4cpp/threading/MSThreads.hh(63) : error C2872: 'CRITICAL_SECTION': Mehrdeutiges Symbol
1>        kann 'C:\Programme\Microsoft Visual Studio 8\VC\PlatformSDK\include\winbase.h(295) sein: RTL_CRITICAL_SECTION CRITICAL_SECTION'
1>        oder "C:\_daten\dev\extern\boost\boost_1_35_0\boost/detail/lwm_win32_cs.hpp(33) : boost::detail::CRITICAL_SECTION"
Any advice for the last error? Which one is the right one?
I'll try

Code: Select all

RTL_CRITICAL_SECTION
Looks like it's compiling now correct, this should be fixed.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: compiling MSVC 8.0 / SVN

#2 Post by Geoff the Medio »

We just switched to Boost 1.35 yesterday, and I just updated the MSVC project files a few hours later, and the SDK was also just updated, so one or more of those might not have been updated when you downloaded them. What's in SVN and the current version of the SDK should work without much additional tweaking with MSVC 2005, as long as you've got the SDK contents where the project is expecting them. Except for Python, the projects use relative pathes for dependencies, so this shouldn't be difficult.

If you've got an outdated SDK with Boost 1.34, tweaking the include directories won't likely fix crashes, so I suggest getting the latest version.

Also, make sure you've built GG with Boost 1.35 and installed it with "scons install" before trying to build FreeOrion. The MSVC project files expect GG to have been installed.

odenter
Space Krill
Posts: 7
Joined: Mon Jul 07, 2008 5:00 pm

Re: compiling MSVC 8.0 / SVN

#3 Post by odenter »

Where should the SDK located?
I've checked out FreeOrion from SVN to

Code: Select all

...\FreeOrion
directories are

Code: Select all

..\FreeOrion\trunk
..\FreeOrion\branches
..\FreeOrion\tags
..\FreeOrion\FreeOrionSDK
Ok the problem was scons, but now I get there an error.

EDIT:

Code: Select all

scons: Reading SConscript files ...
Checking for pkg-config... no
Configuring for WIN32 system...
Checking for C++ header file boost/shared_ptr.hpp... no
Boost configuration... (cached) no
gnarf...
Wrong directory...
Last edited by odenter on Mon Jul 07, 2008 6:37 pm, edited 1 time in total.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: compiling MSVC 8.0 / SVN

#4 Post by Geoff the Medio »

When you open up the SDK zip file, it contains the FreeOrion_SDK directory. In that there are the lib, include, FreeOrion and Boost directories and two files. What matters is that these four directories are all contained in the same path. I've got them all in C:\ but you could put them all in D:\something\FreeOrion_SDK\ if you were so inclined. The non-Python project file include pathes are relative, so it shouldn't matter as long as, if you're in FreeOrion, ../include is the include directory (etc.)

You can arrange things differently if you want (perhaps putting include, lib and Boost within FreeOrion) but you'll have to update the project files in that case, and the scons install script for GiGi won't work without modification. Your problem appears to be that you put the SDK directory in FreeOrion, when it should be the other way around...

You should be able to do an "svn up" (or equivalent) on the FreeOrion directory in the SDK to get the latest from SVN. This should also update GiGi automatically.

There's no way to check out the SDK. What's wrong with downloading it from sourceforge as a zip file?

If you want to update the SDK without messing up any local modifications to the FreeOrion code, you can delete the include, lib and Boost directories and extract the ones in the SDK in their place. You should also unzip all the files in the FreeOrion directory in the zip into your own FreeOrion directory, but you shouldn't need to overwrite anything in subdirectories of FreeOrion (those can be updated from SVN).

odenter
Space Krill
Posts: 7
Joined: Mon Jul 07, 2008 5:00 pm

Re: compiling MSVC 8.0 / SVN

#5 Post by odenter »

I think the problem is that at this moment I don't understand that directory structure, if I can make an SVN update and make an "rebuild all", all is fine, without change any project files etc. :)

In SConstruct you should change env.Copy() to env.Clone() this works with SCons 0.98.5.

Now I've to install MSVC 2005 SP1, normally I'm working with MSVC 2008, but this throws only errors. When I compiled FO with MSVC 2005 I can take a look at this.

EDIT:
Next problem.
Scons throws an error

Code: Select all

scons: Reading SConscript files ...
Warning: You have requested to build Ogre support, but Ogre was not found, and so has been disabled.  To fix this, run scons configure.
scons: done reading SConscript files.
scons: Building targets ...
cl /nologo /MD /EHsc /W3 /Zc:forScope /GR /Gd /Zi /wd4099 /wd4251 /wd4800 /wd4267 /wd4275 /wd4244 /wd4101 /wd4258 /wd4351 /wd4996 /TP /DNDEBUG /DWIN32 /D_WINDOWS /D_USRDLL /D_WINDLL /DGIGI_EXPORTS /IC:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\Boost\include\boost-1_35 /IC:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\include /IC:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\include /I. /Ilibltdl /c src\AlignmentFlags.cpp /Fosrc\AlignmentFlags.obj
AlignmentFlags.cpp
C:\_daten\dev\projekte\FreeOrion\FreeOrionSDK\include\GG/Base.h(34) : fatal error C1083: Datei (Include) kann nicht geöffnet werden: "windows.h": No such file or directory
scons: building terminated because of errors.
Any advice?
scons configure output

Code: Select all

scons: Reading SConscript files ...
Checking for pkg-config... no
Configuring for WIN32 system...
Checking for C++ header file boost/shared_ptr.hpp... yes
Checking Boost version >= 1.35... (cached) yes
Boost configuration... (cached) ok
Checking freetype2 version >= 2.1.2... (cached) yes
Checking for C header file ft2build.h... yes
Checking DevIL version >= 1.6.1... (cached) yes
Checking for C header file IL/il.h... yes
Checking for C header file IL/ilu.h... yes
Configuration successful... (cached) yes
Copy("GG\ltdl.h", "libltdl\ltdl.h")
Copy("GG\ltdl_config.h", "libltdl\config.h")
Configuring GiGiSDL driver...
Checking for sdl-config... (cached) no
Checking for C header file SDL/SDL.h... yes
Checking SDL version >= 1.2.7... (cached) yes
SDL configuration... (cached) yes
Configuration successful... (cached) yes
Configuring GiGiOgre driver...
Checking for pkg-config... no
Checking Ogre version >= 1.4.3... (cached) no
Warning: Ogre not configured.  The GiGiOgre library will not be built!
Configuration successful... (cached) no

odenter
Space Krill
Posts: 7
Joined: Mon Jul 07, 2008 5:00 pm

Re: compiling MSVC 8.0 / SVN

#6 Post by odenter »

I've read this thread viewtopic.php?f=24&t=2127 but don't help, because SCons don't know the commands/variables described there.

So how can I compile GiGi?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: compiling MSVC 8.0 / SVN

#7 Post by Geoff the Medio »

The error where it can't find windows.h suggests that you're running under a standard command prompt that lacks Patform SDK path environment variables. You should be using the MSVC command prompt, which should have a start menu link under Microsoft Visual Studio 200X -> Visual Studio Tools, or something similar. Alternatvely, there should be a vcvarsall.bat somewhere that should set up the required environment variables within any command prompt that can find and run it. Alternatively, you should be able to Start -> Run... "cmd.exe" (as opposed to "command") to start with the required pathes.

Also, I'm in the midst of trying to get a MSVC 2008 project set up that won't require building GG separately. You could wait (hopefully a day or a few days) for that.

Or, you could try removing all references to GG from the existing MSVC 2005 project files and adding in each GG file that it compains it can't find in order to make your own GG-Free project file. If things go well with 2008, I'll probably do it for 2005 as well, as it is rather inconvenint and clunky to have to build GG separately and to have an otherwise-unnecessary SCons dependency... Particularly since SCons doesn't seem to install properly on my Vista machine...

odenter
Space Krill
Posts: 7
Joined: Mon Jul 07, 2008 5:00 pm

Re: compiling MSVC 8.0 / SVN

#8 Post by odenter »

A few days I can wait. :)

I tried the command prompt, but doesn't work. Here is my PATH variable using the command prompt.

Code: Select all

C:\Programme\Microsoft Visual Studio 8\Common7\IDE;
C:\Programme\Microsoft Visual Studio 8\VC\BIN;
C:\Programme\Microsoft Visual Studio 8\Common7\Tools;
C:\Programme\Microsoft Visual Studio 8\Common7\Tools\bin;
C:\Programme\Microsoft Visual Studio 8\VC\PlatformSDK\bin;
C:\Programme\Microsoft Visual Studio\SDK\v2.0\bin;
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;
C:\Programme\Microsoft Visual Studio 8\VC\VCPackages;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
c:\Programme\Microsoft SQL Server\90\Tools\binn\;
C:\PROGRA~1\ULTRAE~1;
C:\Programme\Microsoft SQL Server\80\Tools\Binn\;
C:\Programme\Microsoft SQL Server\90\DTS\Binn\;
C:\Programme\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;
C:\Programme\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;
c:\Programme\TortoiseSVN\bin;
C:\_daten\dev\extern\Python25\Scripts;
C:\_daten\dev\extern\boost\boost_1_35_0\;
C:\Programme\Microsoft SDKs\Windows\v5.0\Include 
the path to "windows.h" is the last line, I tried here additional the path to the following directories

Code: Select all

C:\Programme\Microsoft SDKs\Windows\v6.0A\Include
C:\Programme\Microsoft Visual Studio 8\VC\PlatformSDK\Include
Maybe the Problem is, that I've installed VS 2008, tomorrow I'll try to build it in an VW-Ware WinXP/MSVC2005, then I'll see if vs 2008 is the problem.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: compiling MSVC 8.0 / SVN

#9 Post by Geoff the Medio »

I just committed some MSVC 2008 project files to build FO without requiring GG to be pre-built as a dll.

The FreeOrion SDK doesn't have 2008 versions of the Boost libraries as of this writing, so until / unless it is updated, you'll have to get or build those yourself. boost-consulting has a downloadable pre-built installer for boost 1.35, if necessary.

You'll likely need to update the library and include directories for Boost that the solution file uses, in the properties of the three projects, in the Linker -> General and C++ -> General sections.

odenter
Space Krill
Posts: 7
Joined: Mon Jul 07, 2008 5:00 pm

Re: compiling MSVC 8.0 / SVN

#10 Post by odenter »

So compiling works now with MSVC 2008.
Thanks :)

But today afternoon I'll take a look at some other things, my compiler tries to link against libboost*.lib, but I can't find the place where libboost stands in config Files, because they don't sounds so on my computer.

To debug the game I've to start the server and the client?
Which exe is server and which is for the client?

When I choose to debug freeorion project it starts but there's no server startet, so I can't do anything. It just starts.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: compiling MSVC 8.0 / SVN

#11 Post by Geoff the Medio »

The libboost*.lib files weren't built for me by running bjam, regardless of what parameters I specified, so I eventually just downloaded the installer from boost consulting which does contain them.

"freeorion.exe" is the human client, "freeoriond.exe" is the server and "freeorionca.exe" is the AI client. To debug the server, I generally run freeorion, then click start new game. This starts the server, to which you can attach the debugger before clicking "done" on the galaxy setup screen. Alternatively, you can run "freeoriond" from the command line and run "freeorion --force-external-server" in a separate window, and the two should talk to eachother, with the bonus that you can see server debug output in the server's console, which you would otherwise have to look in freeoriond.log to see.

User avatar
Trilarion
Krill Swarm
Posts: 14
Joined: Mon Aug 04, 2008 2:33 pm
Location: Germany

Re: compiling MSVC 8.0 / SVN

#12 Post by Trilarion »

I used somehow the same pathway. Here is my recipe.

- Downloaded the SVN
- Downloaded the Freeorion SDK from 07-06-25 and unzipped to the base directory of the svn
- Reverted all the changes from the SDK in the SVN to again obtain the actual state
- Installed Python 2.5 into C:\python25
- Installed Visual Studio 2008 Express Edition C++
- Loaded the solution in the msvc2008 directory and started building the solution without adding any directories ...
- One hour later: Only two errors during the linking step: some boost_..._vc90..lib not found
- Used the installer of the binaries from boost consulting and downloaded boost 1.35 for vc90 (2008) (multi-threaded libraries and dlls would be enough?)
- Built solution again -> finished 8)

Comments
The 'Express' Edition 2008 is awfully slow. My computer is a Athlon XP X2 2Ghz and 2GB Ram, so not too bad, but every single cpp file needs like 1 minute!!! I guess its due to whole include files/dependencies. So maybe precompiled headers could safe a lot of time. What is the general opinion about these? And the solution file for msvc2008 only contains a Release configuration. Shouldn't there also be a Debug configuration or how what is the best way to debug the code?

What is the best way for compiling FO under Windows and without the commercial versions of MSVC 2005 or 2008?

Greetings
Jan

odenter
Space Krill
Posts: 7
Joined: Mon Jul 07, 2008 5:00 pm

Re: compiling MSVC 8.0 / SVN

#13 Post by odenter »

I'm using Standard-Edition on (at home) dual core CPU and at work (quad core) compiling were fast, all core's worked.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: compiling MSVC 8.0 / SVN

#14 Post by Geoff the Medio »

FreeOrion is fairly complicated and has a lot of dependencies, leading to inconveniently long build times. If you avoid editing commonly-included headers when not necessary, it's usually not a huge issue after the initial build, though.

I don't know much about precompiled headers, but I vaguely recall there being a problem with them. This might be my imagination, though. If you want to use them in your local build, feel free.

The "Release" build confgurations have debugging enabled, and there's no reason I'm aware of not to leave it enabled. You can run the client with the debugger attached from in the GUI, or attach the debugger to the already-running client, server or AI processes. Stepping through code and breakpoints work most of the time.

User avatar
Trilarion
Krill Swarm
Posts: 14
Joined: Mon Aug 04, 2008 2:33 pm
Location: Germany

Re: compiling MSVC 8.0 / SVN

#15 Post by Trilarion »

What about using mingw and an IDE like CodeBlocks? This could be a complete open-source compilation solution for windows. Should I try and set this up or will the gnu compiler have problems with the libraries in the SDK?

Post Reply