Author Topic: Build Guide: Win 32/64 MS Visual C++ 2010  (Read 956 times)

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Build Guide: Win 32/64 MS Visual C++ 2010
« on: December 23, 2014, 06:19:36 pm »
This guide will help enable people to more easily build PlaneShift for windows. The guide was written based on how to do a 64bit build and adapted to include 32 bit build. The guide will Cover Setting up the environment and tools, getting the code, compiling Crystal Space and PlaneShift then will finish with FAQs. All tools in this guide are free versions.
Contents
Setting up the Environment and Tools
Getting the Code
Compiling Crystal Space
Compiling PlaneShift
FAQs
« Last Edit: December 23, 2014, 06:27:00 pm by Tuathanach »
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #1 on: December 23, 2014, 06:20:09 pm »
Setting up the Environment and Tools
Setting up Build Environment
Install Visual C++ 2010 Express
Silverlight and SQL server not required
http://www.visualstudio.com/downloads/download-visual-studio-vs#DownloadFamilies_4

Install Service pack 1 for Visual C++ 2010 Express
http://www.microsoft.com/en-gb/download/details.aspx?id=23691

Install Windows SDK for Windows 7
Note: Do NOT install Visual C++ compilers or redistributable packages, as will stop install.
http://www.microsoft.com/en-gb/download/details.aspx?id=8279

Install compilers using SP1, important for 64 bit setup.
http://www.microsoft.com/en-gb/download/details.aspx?id=4422

Getting Tools
TortoiseSVN
Download and install TortoiseSVN
http://tortoisesvn.net/downloads.html
Gives 32bit and 64bit versions

MySQL
Download from: (select  appropriate zip archive ex. mysql-noinstall-5.1.73-winx64.zip)
http://dev.mysql.com/downloads/mysql/5.1.html
Open archive and extract files to C:\development\mysql. (it should now contain folders bin, data. include, lib and more)

Set Environment Variables
Right-Click My Computer on your desktop and choose Properties. Under Advanced choose Environmental Variables. Click New under either User or System variables depending on how you want it setup. If you choose System, you will have to log off to make the changes.
Variable Name: CRYSTAL (all caps)
Variable Value: C:\development\cs
« Last Edit: March 05, 2015, 01:05:30 am by Tuathanach »
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #2 on: December 23, 2014, 06:20:43 pm »
Getting the Code
Next Create a folder for source code i.e. C:\development\ (Which is what will be used for rest of guide).

Curl
Download “Files Only” (32/64 bit) from:
http://www.confusedbycode.com/curl
Open archive and extract files to C:\development\curl. . (it should now contain folders bin, dlls. include, lib and more)

Crystal Space
Create directory C:\development\cs. Right click on folder, select SVN Checkout.
URL of repository: http://svn.code.sf.net/p/crystal/code/CS/trunk
Checkout Directory: C:\development\cs
Checkout Depth: Fully Recursive
Revision:  39798
Note: PlaneShift not compatible currently with “Head” revision.
Once Downloaded patch 39918 needs applied.
(to see code https://sourceforge.net/p/crystal/code/39918/)
Basically all that needs done i edit C:\development\cs\include\csutil\csuctransform.h
Search for “if ((srcSize == 0) || (source == 0))” and change it to “if (srcSize == 0)”. This fixes a windows based start up crashes.

WinLibs for CS
Download appropriate  version of winlibs.
http://www.crystalspace3d.org/downloads/cs-winlibs/cs-win32libs-2.1_003.exe (32bit Windows)
or
http://www.crystalspace3d.org/downloads/cs-winlibs/cs-winlibs-x64-2.1_003.exe (64bit Windows)

when it asks for Crystalspace directory point at C:\development\cs. Also at end copy dlls to CS directory

Cal3d
Create directory C:\development\cs\libs\cal3d. Right click on folder, select SVN Checkout.
URL of repository: http://svn.gna.org/svn/cal3d/trunk/cal3d/
Checkout Directory: C:\development\cs\libs\cal3d
Checkout Depth: Fully Recursive
Revision: 507

Other Items for CS
CeGUI
Download and extract to C:\development\cs\libs\cegui
http://Download sourceforge.net/projects/crayzedsgui/files/CEGUI%20Mk-2/0.8/cegui-0.8.4.zip/download

Jpeg
Download the following and extract to C:\development\cs\libs\jpeg
http://ijg.org/files/jpegsr9.zip

Lib3ds
Download the following and extract to C:\development\cs\libs\lib3ds
http://code.google.com/p/lib3ds/downloads/detail?name=lib3ds-1.3.0.zip

LibMng
Download the following and extract to C:\development\cs\libs\libmng
http://sourceforge.net/projects/libmng/files/libmng-devel/1.0.10/lm010010.zip/download?use_mirror=skylink&download=

LibPng
Download the following and extract to C:\development\cs\libs\libpng
http://sourceforge.net/projects/libpng/files/libpng16/1.6.15/lpng1615.zip/download?use_mirror=heanet

Zlib
Download the following and extract to C:\development\cs\libs\zlib
http://zlib.net/zlib128.zip

PlaneShift
Create directory C:\development\planeshift. Right click on folder, select SVN Checkout.
URL of repository: http://svn.code.sf.net/p/planeshift/code/trunk
Checkout Directory: C:\development\planeshift
Checkout Depth: Fully Recursive
Revision:  HEAD
« Last Edit: January 16, 2015, 03:43:24 pm by Tuathanach »
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #3 on: December 23, 2014, 06:21:14 pm »
Compiling Crystal Space
Start Visual C++ 2010 Express
Open Project > C:\development\cs\mk\msvc10\wkstypical.sln
At Top set:
Configuration: ReleaseWithDlls
Platform: x64 (for 64 bit build. Use Win32 for 32 bit)
Select first project “app3ds2lev” then shift select last project “plgxmltiny” all should now be selected. Right click on one > Properties.
Select Configuration Properties > General
Set “Include Directories” to the following:

64bit
C:\development\cs\include;C:\development\cs\include\csutil\win32;C:\development\cs\winlibs\x64\include;C:\development\curl\include;C:\development\mysql\include; C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;$(IncludePath)

32bit
C:\development\cs\include;C:\development\cs\include\csutil\win32;C:\development\cs\winlibs\win32\include;C:\development\curl\include;C:\development\mysql\include; C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;$( IncludePath)

Set “Library Files” to the following:
64 Bit
C:\development\cs\libs;C:\development\cs\winlibs\x64\lib;C:\development\mysql\lib\opt;C:\development\curl\lib;C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;$(LibraryPath)

32 Bit
C:\development\cs\libs;C:\development\cs\winlibs\win32\lib;C:\development\mysql\lib\opt;C:\development\curl\lib;C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;$(LibraryPath)

Then “Apply” and “Ok”. Then wait for it to search Directories.
Then Right click on Solution > Build Solution
Note: I am sure that not all projects require all if anyone is able to tell me how to streamline and only add directories that projects require, it would be welcome.
« Last Edit: December 23, 2014, 06:31:17 pm by Tuathanach »
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #4 on: December 23, 2014, 06:21:57 pm »
Compiling PlaneShift
Copy from C:\Development\cs
crystalspace-2.1-vc10-x64.dll
libcal3d-csvc10_d-x64.dll
libcal3d-csvc10-x64.dll
libzcs-x64.dll
to C:\Development\planeshift
for 32bit copy files
crystalspace-2.1-vc10.dll
libcal3d-csvc10_d.dll
libcal3d-csvc10.dll
libzcs.dll

Open Project > C:\development\planeshift\mk\msvc10\wkspstypical.sln
At Top set:
Configuration: ReleaseWithDlls
Platform: x64 (for 64 bit build. Use Win32 for 32 bit)

Select first project “appccheck” then shift select last project “plgsoundmngr” all should now be selected. Right click on one > Properties.
Select Configuration Properties > General
Set “Include Directories” to the following:

64bit
c:\development \mysql\include;c:\development\curl\include;C:\development\CS\include\csutil\win32;C:\development\CS\winlibs\x64\include;C:\development\CS\include;$(IncludePath)

32bit
c:\development \mysql\include;c:\development\curl\include;C:\development\CS\include\csutil\win32;C:\development\CS\winlibs\win32\include;C:\development\CS\include;$(IncludePath)

Set “Library Files” to the following:

64 Bit
C:\development\CS\libs\csutil\win32;C:\development\mysql\lib\opt;c:\development\curl\lib;C:\development\CS\libs;C:\development\CS\winlibs\x64\lib;C:\development\CS\out\release10-x64\libs;C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;c:\development\planeshift\out\release10-x64\libs;$(LibraryPath)

32 Bit
C:\development\CS\libs\csutil\win32;C:\development\mysql\lib\opt;c:\development\curl\lib;C:\development\CS\libs;C:\development\CS\winlibs\win32\lib;C:\development\CS\out\release10 \libs;C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;c:\development\planeshift\out\release10\libs;$(LibraryPath)

Linker
Select and right click “plgsoundmanager” > Properties.
Select Configuration Properties  > Linker > Input
Add libpsmusic.lib;libpsutil.lib; to “Additional Dependancies”

Client
To just build client select and right click apppsclient > build
To get your new client working easiest way is to copy a existing client ie from C:\Program files\PlaneShift to from C:\Program files\PlaneShift-build. This will ensure you have all working art etc.
Copy contents of C:\development\Planeshift\Data to C:\Program files\PlaneShift-build\Data except emotes.xml and servers.xml.
Copy files only in C:\development\Planeshift\ to  C:\Program files\PlaneShift-build.

Server and others
Copy C:\development\mysql\lib\opt\libmysql.dll to C:\development\Planeshift
Select and right click “plgdbmysql” > Properties.
Select Configuration Properties  > Linker > Input
Add libpsutil.lib; to “Additional Dependancies”

Right click Solution > Build

C:\development\palneshift\docs\compiling.html has more detail on server setting up and running.

« Last Edit: March 20, 2015, 01:17:23 pm by Tuathanach »
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #5 on: December 23, 2014, 06:22:29 pm »
Frequently Asked Questions

Cannot install Windows SDK
This is a common issue and possibly one of hardest parts troubleshoot. When installing the SDK do not install the compilers as having compilers from visual studio are enough to stop install process completing successfully, and sadly installer does not tell you this. Also this happens if you already have redistributable packages installed.
Solution: Install SDK without compilers or redistributable packages. As the sdk service pack will install these.

Using a newer version of visual studio
Quote
Error   94   error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1800' in ccheck.obj
This is a problem that comes from using a newer version of Visual Studio. You can solve this problem by right-clicking your projects -> Properties -> Configuration Properties -> General, then change Platform Toolset to Visual Studio 2010 (v100). This will require that Visual Studio 2010 is installed on your machine as well.

Missing Libraries
Quote
1>     Creating library ..\..\out\release10-x64\build\plgsoundmngr\x64\plgsoundmngr.lib and object ..\..\out\release10-x64\build\plgsoundmngr\x64\plgsoundmngr.exp
1>data.obj : error LNK2001: unresolved external symbol "void __cdecl pslog::LogMessage(char const *,int,char const *,int,enum LOG_TYPES,unsigned int,char const *,...)" (?LogMessage@pslog@@YAXPEBDH0HW4LOG_TYPES@@I0ZZ)
1>instrumentmngr.obj : error LNK2001: unresolved external symbol "class csPtr<struct iDocument> __cdecl ParseFile(struct iObjectRegistry *,class csString const &)" (?ParseFile@@YA?AV?$csPtr@UiDocument@@@@PEAUiObjectRegistry@@AEBVcsString@@@Z)
1>manager.obj : error LNK2001: unresolved external symbol "bool __cdecl pslog::DoLog(int,enum LOG_TYPES,unsigned int)" (?DoLog@pslog@@YA_NHW4LOG_TYPES@@I@Z)
1>soundmanager.obj : error LNK2001: unresolved external symbol "public: void __cdecl psString::Split(class csStringArray &,char)" (?Split@psString@@QEAAXAEAVcsStringArray@@D@Z)
1>..\..\soundmngr.dll : fatal error LNK1120: 4 unresolved externals
Errors like the one listed above mean that you are missing some .lib files in your Linker. plgdbmysql requires you to add libmysql.lib and libpsutil.lib while plgsoundmngr requires you to add libpsmusic.lib and libpsutil.lib. You can add these by right-clicking on the project -> Properties -> Configuration Properties -> Linker -> Input and adding them to the Additional Dependencies field.

Missing float.h
Quote
c:\development\cs\include\cstypes.h(29): fatal error C1083: Cannot open include file: 'float.h': No such file or directory
This error means that a header file cannot be found for some reason. Since you are either using Visual Studio 2010 or have it installed somewhere and are using Visual Studio 2010 as the Platform Toolset, it probably means that your installation did not complete properly. Navigate to your installation of Visual Studio 2010 (likely C:\Program Files\Microsoft Visual Studio 10.0 or something similar) and go into the VC directory and then the include directory. Look for the missing file, which is float.h in this case. There should be somewhere around 200 files in the directory, so if you only have a few the installation definitely failed to complete properly. This solution is what works for the majority of people.
« Last Edit: March 06, 2015, 03:57:47 am by Tuathanach »
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

steuben

  • Veteran
  • *
  • Posts: 1834
    • View Profile
    • Myspace
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #6 on: December 23, 2014, 10:04:39 pm »
this going to end up behind usual the build guide link?
may laanx frighten the shadow from my path.
hardly because the shadow built the lexx.
the shadow will frighten laanx from my path.

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #7 on: December 24, 2014, 03:11:46 am »
I plan to have it added into compile guide once it has been proven to work for more than just me.
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

Serneum

  • Wayfarer
  • *
  • Posts: 6
    • View Profile
    • SernProgramming
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #8 on: January 21, 2015, 10:35:14 pm »
Hey Tuathanach, I'm just now getting around to trying out your guide. I'm trying to configure everything for 64bit but Visual Studio 2010 is erroring out on setting properties once I set everything to ReleaseWithDlls and x64. I get an "unspecified error" when trying to open up the properties for the projects in the solution. I'll let you know if I can get around the issue.

Other notes:
1) On my machine, C:\development\CS\winlibs\win32 is C:\development\CS\winlibs\x86
2) On my machine, C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib is C:\Program Files\Microsoft SDKs\Windows\v7.1A\Lib and I'm wondering if this lib is even necessary. It looks like it's for developing Windows apps
3)
Select Configuration Properties > General
Should be
Select Configuration Properties > VC++ Directories

Set “Library Files” to the following:
Should be
Set “Library Directories” to the following:
« Last Edit: January 21, 2015, 11:06:34 pm by Serneum »

Serneum

  • Wayfarer
  • *
  • Posts: 6
    • View Profile
    • SernProgramming
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #9 on: March 04, 2015, 11:56:10 pm »
I had an issue where my builds kept saying they couldn't find float.h. I looked through my VS 2010 files and noticed that none of the header files existed. I came across this solution and it solved my problems.

I'm also trying to use VS 2013 because that's what Unreal Engine 4 uses and I had some issues because the files detect that the compiler is not VS 2010. You can right-click your projects -> Properties -> Configuration Properties -> General, then change Platform Toolset to Visual Studio 2010 (v100). On a 64 bit operating system, it may say that the Visual Studio 2010 (v100) toolset is not installed because Visual Studio 2010 Express does not support 64-bit builds by default. By following the instructions in some of the other posts, you may not hit the same issue. I apparently couldn't get the Windows 7 SDK to install on my machine for some reason, so I just installed Visual Studio 2010 Professional and got around the issue.

I'm trying to configure everything for 64bit but Visual Studio 2010 is erroring out on setting properties once I set everything to ReleaseWithDlls and x64. I get an "unspecified error" when trying to open up the properties for the projects in the solution. I'll let you know if I can get around the issue.
I believe the problem I was having when I mentioned this was that my Visual Studio 2010 was not able to build 64-bit apps because the Windows 7 SDK hadn't installed and I thought it had. Using Visual Studio 2010 solves the issue because it can build 64-bit apps without any additional installations

Linker
Select and right click “plgdbmysql” > Properties.
Select Configuration Properties  > Linker > Input
Add libpsmusic.lib;libpsutil.lib; to “Additional Dependancies”
This applies to plgsoundmngr otherwise you'll get linker errors. You also don't need to add libpsmusic.lib to plgdbmysql

2) On my machine, C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib is C:\Program Files\Microsoft SDKs\Windows\v7.1A\Lib and I'm wondering if this lib is even necessary. It looks like it's for developing Windows apps
I don't think these need to be added. Visual Studio appears to include $(WindowsSdkDir)lib\x64 as an inherited library. $(WindowsSdkDir) points to C:\Program Files\Microsoft SDKs\Windows\v7.0A, or in my case C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A. I assume the 32bit version would inherit $(WindowsSdkDir)lib. You can see where macros like $(WindowsSdkDir) point by right-clicking a project -> Properties -> Configuration properties -> VC++ Directories and then clicking on Library Directories and clicking <Edit...>. Once that pops up, click the "Macros >>" button and look through the values
« Last Edit: March 05, 2015, 12:18:50 am by Serneum »

Tuathanach

  • Associate Developer
  • Hydlaa Citizen
  • *
  • Posts: 206
  • Arch Chancellor of the Knowledge Seekers
    • View Profile
    • Knowledge seekers
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #10 on: March 05, 2015, 01:04:17 am »
Thanks for feedback. Installing window 7 SDK is not easy as it crashes/cancels as soon as it runs into a conflict, only bare minimum is required, the compilers and redistributable packages tend to conflict with what will be on your machine. I install it without either and use the Service Pack 1 to install compilers.

I think you may be right that C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib is not required I will check and amend.
Shindroks Crater Project Wiki
Interested contact Myself or Zunna.
We are contactable ingame, by PM or on Discord

Serneum

  • Wayfarer
  • *
  • Posts: 6
    • View Profile
    • SernProgramming
Re: Build Guide: Win 32/64 MS Visual C++ 2010
« Reply #11 on: March 05, 2015, 08:01:00 pm »
libzcs.dll
For 64-bit, that should be libz-cs-x64.dll
For 32-bit, that should be libz-cs.dll

Also, feel free to add these to your FAQ:
Quote
Quote
Error   94   error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1800' in ccheck.obj
This is a problem that comes from using a newer version of Visual Studio. You can solve this problem by right-clicking your projects -> Properties -> Configuration Properties -> General, then change Platform Toolset to Visual Studio 2010 (v100). This will require that Visual Studio 2010 is installed on your machine as well.

Quote
1>     Creating library ..\..\out\release10-x64\build\plgsoundmngr\x64\plgsoundmngr.lib and object ..\..\out\release10-x64\build\plgsoundmngr\x64\plgsoundmngr.exp
1>data.obj : error LNK2001: unresolved external symbol "void __cdecl pslog::LogMessage(char const *,int,char const *,int,enum LOG_TYPES,unsigned int,char const *,...)" (?LogMessage@pslog@@YAXPEBDH0HW4LOG_TYPES@@I0ZZ)
1>instrumentmngr.obj : error LNK2001: unresolved external symbol "class csPtr<struct iDocument> __cdecl ParseFile(struct iObjectRegistry *,class csString const &)" (?ParseFile@@YA?AV?$csPtr@UiDocument@@@@PEAUiObjectRegistry@@AEBVcsString@@@Z)
1>manager.obj : error LNK2001: unresolved external symbol "bool __cdecl pslog::DoLog(int,enum LOG_TYPES,unsigned int)" (?DoLog@pslog@@YA_NHW4LOG_TYPES@@I@Z)
1>soundmanager.obj : error LNK2001: unresolved external symbol "public: void __cdecl psString::Split(class csStringArray &,char)" (?Split@psString@@QEAAXAEAVcsStringArray@@D@Z)
1>..\..\soundmngr.dll : fatal error LNK1120: 4 unresolved externals
Errors like the one listed above mean that you are missing some .lib files in your Linker. plgdbmysql requires you to add libmysql.lib and libpsutil.lib while plgsoundmngr requires you to add libpsmusic.lib and libpsutil.lib. You can add these by right-clicking on the project -> Properties -> Configuration Properties -> Linker -> Input and adding them to the Additional Dependencies field.

Quote
c:\development\cs\include\cstypes.h(29): fatal error C1083: Cannot open include file: 'float.h': No such file or directory
This error means that a header file cannot be found for some reason. Since you are either using Visual Studio 2010 or have it installed somewhere and are using Visual Studio 2010 as the Platform Toolset, it probably means that your installation did not complete properly. Navigate to your installation of Visual Studio 2010 (likely C:\Program Files\Microsoft Visual Studio 10.0 or something similar) and go into the VC directory and then the include directory. Look for the missing file, which is float.h in this case. There should be somewhere around 200 files in the directory, so if you only have a few the installation definitely failed to complete properly. This solution is what works for the majority of people.
« Last Edit: March 05, 2015, 11:47:24 pm by Serneum »