PlaneShift
Development => Development Deliberation => Topic started by: Tuathanach on December 24, 2014, 12:19:36 am
-
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 (http://www.hydlaaplaza.com/smf/index.php?topic=41967.msg474456#msg474456)
Getting the Code (http://www.hydlaaplaza.com/smf/index.php?topic=41967.msg474457#msg474457)
Compiling Crystal Space (http://www.hydlaaplaza.com/smf/index.php?topic=41967.msg474458#msg474458)
Compiling PlaneShift (http://www.hydlaaplaza.com/smf/index.php?topic=41967.msg474459#msg474459)
FAQs (http://www.hydlaaplaza.com/smf/index.php?topic=41967.msg474460#msg474460)
-
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
-
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
-
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.
-
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.
-
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
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
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
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 (http://stackoverflow.com/questions/12460307/installation-of-visual-studio-2010-any-edition-installs-only-2-files-in-the-c/16588726#16588726) is what works for the majority of people.
-
this going to end up behind usual the build guide link?
-
I plan to have it added into compile guide once it has been proven to work for more than just me.
-
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:
-
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 (http://stackoverflow.com/a/16588726) 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
-
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.
-
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:
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.
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.
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 (http://stackoverflow.com/questions/12460307/installation-of-visual-studio-2010-any-edition-installs-only-2-files-in-the-c/16588726#16588726) is what works for the majority of people.