Difference between revisions of "Compiling the viewer (MSVS2005)"
m (→VS2005) |
|||
Line 10: | Line 10: | ||
You need to setup the compiler and Microsoft Development tools as follows: | You need to setup the compiler and Microsoft Development tools as follows: | ||
* Visual Studio 2005 '''''-or-''''' [http://msdn.microsoft.com/vstudio/express/visualc/download/ Visual C++ 2005 Express]<small>(Free)</small> | * Visual Studio 2005 '''''-or-''''' [http://msdn.microsoft.com/vstudio/express/visualc/download/ Visual C++ 2005 Express]<small>(Free)</small> (Also, although not strictly necessary, eventually pick up and install SP1 for VS2005.) | ||
* [http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en Microsoft Platform SDK] | * [http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en Microsoft Platform SDK] | ||
* A DirectX 9.0 SDK released on or after Summer of 2003 [http://download.microsoft.com/download/5/1/f/51ff8357-0af3-418b-9d0b-e9a5cdc39759/dxsdk_dec2006.EXE DirectX 9.0 SDK (December 2006)] [http://www.microsoft.com/downloads/details.aspx?FamilyID=9216652f-51e0-402e-b7b5-feb68d00f298&displaylang=en DirectX 9.0 SDK Update (Summer 2003)] | * A DirectX 9.0 SDK released on or after Summer of 2003 [http://download.microsoft.com/download/5/1/f/51ff8357-0af3-418b-9d0b-e9a5cdc39759/dxsdk_dec2006.EXE DirectX 9.0 SDK (December 2006)] [http://www.microsoft.com/downloads/details.aspx?FamilyID=9216652f-51e0-402e-b7b5-feb68d00f298&displaylang=en DirectX 9.0 SDK Update (Summer 2003)] |
Revision as of 08:40, 10 June 2007
This page explains how you can compile the viewer on Microsoft Windows using Visual Studio 2005 or Visual C++ Express 2005. If you are using Visual Studio 2003, you should read another page. Note that Lindens are using VS2003, and you will get less trouble with it than with VS2005.
The following explanation is adjusted for Viewer releases 1.16.0.5 or later. See an older version of this page for the Viewer releases 1.15 or before.
Development Environment
VS2005
You need to setup the compiler and Microsoft Development tools as follows:
- Visual Studio 2005 -or- Visual C++ 2005 Express(Free) (Also, although not strictly necessary, eventually pick up and install SP1 for VS2005.)
- Microsoft Platform SDK
- A DirectX 9.0 SDK released on or after Summer of 2003 DirectX 9.0 SDK (December 2006) DirectX 9.0 SDK Update (Summer 2003)
- Note: If you have previously installed an older version of the DirectX 9.0 SDK, remove it first (from Control Panel -> Add or Remove Programs) before installing this version. Installing the new SDK "on top" of an older version may cause problems.
- Set up the project globals:
- Start Microsoft Visual Studio 2005
- Go to Tools > Options > Projects > VC++ Directories
- Make sure that the includes (screen shot) and libraries (screen shot) paths have the Platform SDK paths first, then the DirectX SDK paths, and then the Visual C++ paths. You may need to check "Show All Settings" at the bottom for VC++ Directories to show.
- If the DirectX SDK paths aren't present, add them to both includes and libraries.
- Note: The newest DirectX SDK ("December 2006") lib folder has two sub-folders, x64 and x86. Make sure your path goes to one of them (select lib/x86, not just lib), or you will get a Link error.
Other Development Tools
You will also need some open source development tools.
- Cygwin
- When you run the cygwin setup utility make sure you have selected to install patchutils, flex, and bison (all located under "devel") which are not part of the default install. The project files use several hardcoded references that expect Cygwin to be installed at C:\cygwin, if it's not you'll need to edit those references.
- The two packets below were recommended for previous versions on this Wiki, but it currently appears, that they are not strictly necessary unless you are planning to build your own version of all libraries, so for a start it may be safe to skip these.
- AcrivePython 2.3x - Latest Version is 2.5.1.1
- ActivePerl
Source Files
You can download the Viewer source codes on the source downloads page. You can also use a version control repository.
At a minimum, grab the source package and the artwork package. Many of the libraries can either be compiled from source or downloaded from other sites (see below), but it's easiest to also grab the provided library package.
WARNING:
- If the directory path you keep the SL source in has a space in it, the batch file that copies message_template.msg will fail. So, if you unzip or checkout the source tree into, e.g., "C:\Projects\Dir with space in name\Etc\linden", it won't work!
- You should also avoid using non-ASCII (national) characters in the paths, although some localized versions of the tool puts some as a default...
- Unzip or checkout your source tree into a directory that has as short full pathname as possible, since long paths cause some unexpected trouble during the build.
In other words, the easiest way to get this working is to get source, artwork and libraries from the source downloads page and unpack them all into the same directory/folder, which ideally would be a folder in (or near) the root directory with a short name like sl_1_16_0_5.
Libraries
SL Viewer depends on some third party libraries. Some of them are open source, some others are not.
Open Source Libraries
You can download the pre-build open source libraries from LL. They are available on source downloads page. Unzip them into your SL viewer source code directory, maintaining the same directory structure.
Alternatively, it may be possible to get the source files for the libraries and build by yourself. See the instruction for VS2003 users if you try it. Please note, however, it is not known that VS2005 can successfully compile the libraries. You have been warned. (If you can make it, please write the info on this wiki...)
Proprietary Libraries
Lindens does not inlcude the following proprietary libraries. You will need to follow the instructions to acquire below and copy them to the source path.
However, it probably is a good idea to build an empty directory tree for the files below and first copy the files there and once completed, copy the whole tree to the actual source folder (like XCOPY OLIB SL_1_16_0_5 /S). The reason is, that these steps are cumbersome and will have to be repeated for each new release (at least if you keep the source for each release in it's own folder). If you do not want to do this, of course you can just copy the files directly into the linden source paths.
rem OLIBS.CMD to build a folder tree for 3rd party libraries and includes md olibs md olibs\linden\ md olibs\linden\libraries md olibs\linden\libraries\include md olibs\linden\libraries\i686-win32 md olibs\linden\libraries\i686-win32\lib_release md olibs\linden\libraries\i686-win32\lib_debug md olibs\linden\libraries\i686-win32\include md olibs\linden\libraries\i686-win32\include\GL md olibs\linden\libraries\i686-win32\include\quicktime md olibs\linden\indra md olibs\linden\indra\newview
Fmod
- Download & extract fmod 3.75 api for win32 (later versions, like FMOD Ex, are incompatible).
- Copy "fmodapi375win\api\inc\fmod.h" to "linden\libraries\include"
- Copy "fmodapi375win\api\inc\fmod_errors.h" to "linden\libraries\include"
- Copy "fmodapi375win\api\lib\fmodvc.lib" to "linden\libraries\i686-win32\lib_release" and to "linden\libraries\i686-win32\lib_debug"
- Copy "fmodapi375win\api\fmod.dll" to "linden\indra\newview"
OpenGL
- Download glext.h, glxext.h, and wglext.h
- Copy them to "linden\libraries\i686-win32\include\GL"
- You don't need any additional *.lib or *.dll for OpenGL.
Quicktime (optional)
Note: that you can avoid using QuickTime if you want. See below for details. Remember that your viewer can't play in-world movies if you do so.
- Download & install the Quicktime SDK for Windows
- Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "linden\libraries\i686-win32\lib_release" and to "linden\libraries\i686-win32\lib_debug".
- Copy the contents of "QuicktimeSDK\CIncludes" into "linden\libraries\i686-win32\include\quicktime".
Configuring for VS2005
Lindens use VS2003 to develop the viewer.
You either need to convert solution file and project files from VS2003 format to VS2005 format or obtain files compatible with VS2005. You may also need to modify source files to work around the incompatibility between VS2003 and VS2005.
Note: linden\indra\indra_complete_vs8.sln is a solution file already included in the source archive and intended for the Visual Studio 2005, but it does not work (at least between 1.14.0 and 1.17.0.9 distribution). This may change in a future release, if Lindens include an updated versions of the _vc8 files.
Using pre-built solution/project files
Currently there is a ZIP file with solution/project files available on the JIRA bug tracker issue VWR-1151.
If you are building 1.16 or 1.17, most likely the easiest way towards compiling SL on MS2005 will be to:
- download the ZIP archive there
- unpack it and copy it onto your linden source tree (allow to overwrite files that have _vc8 in the name).
- start Visual Studio 2005 (or VC++ Express).
- use "File > Open > Project/Solution" to open the linden\indra\indra_complete\indra_complete_vc8.sln
- right click newview in the frame Solution Explorer and click "Set as StartUp Project".
- proceed with applying the Workarounds below (skip Manual conversion).
Note: If, while compiling, you later encounter errors or problems regarding the projects you may have to do the manual conversion instead
Manual conversion of the solution/projects
Global steps
- Start Visual Studio 2005 (or VC++ Express).
- Use "File > Open > Project/Solution" to open the linden\indra\indra_complete\indra_complete.sln
- Visual Studio prompts to update your project files. Allow it to do so. When the results are displayed, you may see warnings, but you should not see any errors.
- Right click newview in the frame Solution Explorer and click "Set as StartUp Project".
- From your Visual Studio directory (Microsoft Visual Studio 8\VC\VCProjectDefaults) copy UpgradeFromVC71.vsprops to your SL build directories. For convenience I suggest you name it SL-UpgradeFromVC71.vsprops and put it into the indra_complete folder (where the indra_complete.sln file resides).
- Edit SL-UpgradeFromVC71.vsprops with a text editor. For the 2 lines containing PreprocessorDefinitions add ;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T
- Under the first Preprocessor definitions (in the "VCCLCompilerTool" section) add a line with: TreatWChar_tAsBuiltInType="false"
- Here is what the file will look like after the edit:
<?xml version="1.0"?> <VisualStudioPropertySheet ProjectType="Visual C++" Version="8.00" Name="Upgrade From VC 7.1"> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="_VC80_UPGRADE=0x0710;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T" TreatWChar_tAsBuiltInType="false" /> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_VC80_UPGRADE=0x0710;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T" /> </VisualStudioPropertySheet>
Per Configuration Steps
- Pick ReleaseNoOpt in the Solution Configurations drop-down box beside the green arrow under the tool bar, and do the followings on the Solution Explorer frame:
- Select all projects, i.e., llaudio, llcharacter, ..., win_updater, except for lscript_compile_fb and test. (You can do it by control-clicking on the projects.) Then, right click on the selection and choose Properties.
- Under the Configuration Properties > General change Inherited Project Property Sheets and enter the full pathname for your SL-UpgradeFromVC71.vsprops (if you put it in the indra_complete folder you can use $(SolutionDir)\SL-UpgradeFromVC71.vsprops instead of the full path)
- On the Property Pages dialog box, under the Configuration Properties > C/C++ > General, change Treat Warnings As Errors to "No". (screen shot)
- Under the Configuration Properties > C/C++ > Language, change (if necessary) Treat wchar_t as Build-in Type to "No (/Zc:wchar_t-)" (screen shot).
- Click OK.
- Click newview to select it alone. Right click on it again and do the following:
- Choose Properties.
- Under Configuration Properties > Linker > Input, click Additional Dependencies on the right to show a button labeled "..." on it at the very right on the line, then click the ... button.
- Scroll down the list to find libboost_regex-vc71-mt-s.lib. Rewrite it to libboost_regex-vc80-mt-s.lib.
- Scroll down again to find llmozlib.lib and rewrite it to llmozlib-vc80.lib.
- Click OK to close the "Additional Dependencies" dialog, then click OK again to close the "newview Property Pages" dialog box.
- Technically you need to do step 6) for test (if llmozlib.lib is not there, forget about it.), but since test does not seem to work under VC2005 you can skip this.
- Pick ReleaseForDownload in the Solution Configurations drop-down box. Do the same thing (as 1 to 7 above) again.
Done :-)
Congratulations! You've converted solution file and project files.
NOTE: You need to do this by hand everytime a new viewer version is released...
Workarounds
There are more compatibility problems between VS2003 and VS2005. You need the following code edits.
test project/crash_logger/updater
For whatever reason, the test project doesn't work under VS2005. Workaround is to disable it as follows: Right click on the test and choose Unload Project.
If you do not plan to create a full download build, you can exclude the win_crash_logger and win_updater from newview's project dependencies and unload them also. But be careful with unloading these projects without removing them from the dependencies, because I have seen VS2005 act highly erratic while linking then project when I tried this.
QuickTime removal
If you don't want to get Apple QuickTime SDK, you can disable it as follows:
- linden\indra\llcommon\llpreprocessor.h - near line 58 (the line below #elif LL_WINDOWS)
--50: #define LL_QUICKTIME_ENABLED 1 ++50: #define LL_QUICKTIME_ENABLED 0
- Pick ReleaseNoOpt in the Solution Configurations drop-down box beside the green arrow under the tool bar, and do the followings on the Solution Explorer frame:
- Click newview to select it alone.
- Choose Properties.
- Under Configuration Properties > Linker > Input, click Additional Dependencies on the right to show a button labeled "..." on it at the very right on the line, then click the ... button.
- Scroll down the list to find qtmlclient.lib. Delete this single line.
- Click OK to close the "Additional Dependencies" dialog, then click OK again to close the "newview Property Pages" dialog box.
- Pick ReleaseForDownload in the Solution Configurations drop-down box. Click newview to select it alone and do the same thing again.
Ready, Set, Build!
Building
- Build either ReleaseNoOpt (for debugging) or ReleaseForDownload (for production code).
- To do this, pick either in the Solution Configurations drop-down box beside the green arrow under the tool bar.
- Make sure newview is set as the active project (otherwise set from newview's right-click menu).
- Select Build-Menu > Build Solution or press F7.
- newview_noopt.exe will be built in linden\indra\newview\ReleaseNoOpt or SecondLife.exe will be linden\indra\newview\ReleaseForDownload.
Common compile errors
See Common compilation problems if you run into other errors while building.
Running
- You can run the viewer by Debug > Start Debugging or Debug > Start "Without Debugging in Visual Studio.
- To run it outside VS, create a shortcut to SecondLife.exe, and change the start location to linden\indra\newview\ (all the .dll will be found there.)
- Alternately copy the exe (possibly rename it) to your "c:\program files\second life" folder.
Debugging Info/Configurations
- Usually you will either use ReleaseNoOpt or the ReleaseForDownload configuration.
- ReleaseNoOpt compiles faster and has more debugging information, but this comes at a runtime penalty of about 50% of your FPS in busy areas, compared to ReleaseForDownload build.
- ReleaseForDownload also has debugging information and runs fine in the debugger (although at times you may miss access to some local variables).
- ReleaseNoOpt comes with a seperate debugging console window opens and stays open for the duration of your session, but you can access the same information also by pressing Shift+Ctrl+4 in the viewer (all builds).
- The debug console log can also be redirected to a file if you add "2>secondlife.log" to the command line (Newview, Properties, Debugging, Command line arguments).
Problems Running?
- Inventory errors: If you're getting errors while trying to load your inventory, try clearing your cache and deleting other temporary files.
- Missing smime3 DLL: Those are parts of the integrated web browser. Copy 'smime3.dll', 'nss3.dll', 'softokn3.dll', and 'ssl3.dll' files from your official client's main folder to "linden\indra\newview".
- Can't connect: In the debug builds there is a selection box on the login screen to select the server to connect to. Agni is the production grid, aditi is the beta grid. (There seems to be a bug in this part of the code, you may have to make your selection, close the viewer and repoen it, before you can connect to the selected grid).
Submit Patches
This is probably faaar down the road, but if you make changes to the source and want to submit them, see the page about submitting patches.