Difference between revisions of "Compiling the viewer (MSVS2005)"
(→Fmod) |
|||
Line 55: | Line 55: | ||
* Copy "fmodapi375win\api\lib\fmodvc.lib" to "linden\libraries\i686-win32\lib_release" and to "linden\libraries\i686-win32\lib_debug" | * 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" | * Copy "fmodapi375win\api\fmod.dll" to "linden\indra\newview" | ||
*If you notice that things are named with an x like fmodex.dll - just rename them to the ones above. | |||
=== OpenGL === | === OpenGL === |
Revision as of 17:43, 23 May 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 for Viewer release 1.14.0.0 or later. See an older version of this page for the Viewer releases before Mar. 2007.
Development Environment
You need to setup the compiler and Microsoft Development tools as follows:
- Visual Studio 2005 -or- Visual C++ 2005 Express(Free)
- 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, rather than the lib folder itself, or you will get a Link error.
You will also need some open source development tools.
- AcrivePython 2.3x - Latest Version is 2.5.1.1
- ActivePerl
- 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.
Source Files
You can download the Viewer source codes on the source downloads page. You can also use a version control repository.
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.
- 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, but it's easiest to also grab the provided library package.
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:
Fmod
- Download & extract fmod 3.75 api for win32.
- 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"
- If you notice that things are named with an x like fmodex.dll - just rename them to the ones above.
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)
- 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".
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.
First Steps
Environment Setup
Lindens use VS2003 to develop the viewer. You need to convert solution file and project files from VS2003 format to VS2005 format. You also need to modify project files to work around the incompatibility between VS2003 and VS2005.
Note: linden\indra\indra_complete_vs8.sln is a solution file intended for the Visual Studio 2005, but it doesn't work (at least in 1.14.0.1 distribution.) You need to convert from 2003 version by yourself.
- 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".
- 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.
- 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 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.
- Do the same thing for test. (if llmozlib.lib is not there, forget about it.)
- Now, the tough part. Do the following for all projects in the solution except for lscript_compile_fb, one project at a time:
- Right click on a project and choose Properties
- Under Configuration Properties > C/C++ > Preprocessor, append ";_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T" at the end of the Preprocessor Definitions.(screen shot)
- Click OK.
- Pick ReleaseForDownload in the Solution Configurations drop-down box. Do the same thing (as 1 to 7 above) again.
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.
unistd.h (Express only)
- If you are using Visual C++ Express, create an empty file at "linden\libraries\include\unistd.h"
- This should not be needed if you are using Visual Studio.
llwindowwin32.cpp (fixed in 1.15.1.3)
- If you have a recent Windows SDK (e.g., v6.0 for Vista), two redeclared constants cause VS2005 to get confused during parsing (syntax errors, missing ;'s, etc.) Comment out the following two lines in linden\indra\llwindow\llwindowwin32.cpp:
- const S32 WM_MOUSEWHEEL = 0x020A;
- const S32 WHEEL_DELTA = 120;
- If you are still using an older version of SDK (e.g., those released around 2003), keep these lines.
- This issue has been reported as VWR-415.
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.
test project
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.
Missing resources
When compiling resources, it fail with several errors, the first being
.\res\newViewRes.rc(64) : error RC2135 : file not found: ll_icon.ico
Missing files were last seen in the 1.14.0.1 release.
- Go to the source downloads page and grab the [1.14.0.1 viewer] sources.
- Explore the archive to "linden/indra/newview/res" folder and extract content to your "linden/indra/newview/res" folder into current revision.
building 1.15.0.2
When building lscript_compile under Windows environment, the file indra.l line 20 should include "ytab.hpp" rather than wrong "ytab.h".
Cannot open include file: 'windows.h'
If you run into this problem:
..\..\..\boost/regex/v4/fileiter.hpp(44) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
Fix it with this: (thanks Fairlight!)
set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;%INCLUDE% set LIB=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;%LIB%
Ready, Set, Build!
- Build either ReleaseNoOpt (for debugging) or ReleaseForDownload (for production).
- SecondLife.exe will be built in linden\indra\newview\ReleaseNoOpt or linden\indra\newview\ReleaseForDownload.
- 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.)
Problems Running?
Inventory errors
If you're getting errors while trying to load your inventory, try clearing your cache and deleting other temporary files.
Second Life is unable to access a file that it needs
The Output window of VS2005's debugger also contain following warning message :
WARNING: LLVFS::LLVFS: Can't find XXX\linden\indra\newview\app_settings\static_data.db2
- Copy 'static_data.db2' and 'static_index.db2' files from your official client's "app_settings" folder to "linden\indra\newview\app_settings".
Missing smime3 DLL
Thus 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".
It's ugly, buttons are grey squares
Also missing the icons of ingame interface and Linden's plants are all grey.
- Copy 'character' and 'skins' folders from your official client's main folder to "linden\indra\newview". Do not overwrite any files that have a newer version.