Compiling the viewer (MSVS2005)

From Second Life Wiki
Revision as of 16:06, 10 January 2007 by Eddy Stryker (talk | contribs) (Updated the DXSDK info to match the 2003 compiling page)
Jump to navigation Jump to search

Introduction

By no means do I consider myself an expert. These are just the steps and fixes from myself, and the team in the irc.efnet.org channel #opensl. --Fox Diller 16:54, 9 January 2007 (PST)

Prerequisites

Basics

  • 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.
      • If the DirectX SDK paths aren't present, add them to both includes and libraries.
  • ActivePython 2.3x
  • ActivePerl
  • Cygwin
    • When you run the cygwin setup utility make sure you have selected to install patchutil, flex, and bison (all located under "devel") which are not part of the default install.

Fmod

  • Download & extract fmod 3.75 api for win32.
  • Copy "fmodapi375win\api\inc\fmod.h" to "libraries\include"
  • Copy "fmodapi375win\api\inc\fmod_errors.h" to "libraries\include"
  • Copy "fmodapi375win\api\lib\fmodvc.lib" to "libraries\i686-win32\lib_release"
  • Copy "fmodapi375win\api\lib\fmodvc.lib" to "libraries\i686-win32\lib_debug"
  • Copy "fmodapi375win\api\fmod.dll" to "indra\newview"

gl

Quicktime

  • Download & install the Quicktime SDK for Windows
  • Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "\libraries\i686-win32\lib_release".
  • Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "\libraries\i686-win32\lib_debug".
  • Copy the contents of "QuicktimeSDK\CIncludes" into "\libraries\i686-win32\include\quicktime".

First Steps

Enviroment Setup

  • Open the \indra\indra_complete\indra_complete.sln solution in Visual Studio 2005.
  • If 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.
  • Set newview to be the startup project.
  • Right click on each project in the solution, with the exception of lscript_compile_fb, and follow these steps for each:
    • 1. (screen shot) Under Configuration Properties, C/C++, General, change Treat Warnings As Errors to "No"
    • 2. (screen shot) Under Configuration Properties, C/C++, PreProcessor, insert the line ";_CRT_SECURE_NO_DEPRECATE"
    • 3. (screen shot) Under Configuration Properties, C/C++, Language, change Treat wchar_t as Built-in Type to "No (/Zc:wchar_t-)"
    • 4. Under Configuration Properties, C/C++, PreProcessor, insert the line ";_CRT_NONSTDC_NO_DEPRECATE"

for the llwindow project an additional define is required

    • 5. Under Configuration Properties, C/C++, PreProcessor, insert the line ";_CRT_NON_CONFORMING_SWPRINTFS"

Code Editing

  • In linden\indra\llcommon\llstringtable.h @ line 103
--103: typedef std::hash_multimap<U32, LLStringTableEntry *> string_hash_t;
++103: typedef stdext::hash_multimap<U32, LLStringTableEntry *> string_hash_t;
  • In linden\indra\llcommon\llerror.h @ line 38, and linden\indra\win_updater\updater.cpp @ line 40
++#if LL_WINDOWS
++# if (_MSC_VER >= 1400)
++#  pragma warning(disable : 4996)
++# endif
++#endif
  • In linden\indra\llcommon\u64.cpp @ line 36
--36: char *aptr = strpbrk(str,"0123456789");
++36: const char *aptr = strpbrk(str,"0123456789");
  • linden\indra\llprimitive\llprimitive.cpp @ line 1200
--1200: exception_faces |= (1 << i);
++1200: exception_faces |= ((U64)1 << i);
  • linden\indra\llui\llsliderctrl.cpp @ line 218
--218: F32 displayed_value = (F32)(floor(getValueF32() * pow(10, mPrecision) + 0.5) / pow(10, mPrecision));
++218: F32 displayed_value = (F32)(floor(getValueF32() * pow(10.0, mPrecision) + 0.5) / pow(10.0, mPrecision));
  • linden\indra\llui\llspinctrl.cpp @ line 251
--251: F32 displayed_value = (F32)floor(getValue().asReal() * pow(10, mPrecision) + 0.5) / (F32)pow(10, mPrecision);
++251: F32 displayed_value = (F32)floor(getValue().asReal() * pow(10.0, mPrecision) + 0.5) / (F32)pow(10.0, mPrecision);
  • linden\indra\newview\llstartup.cpp @ line 1459
--1459: gUTCOffset = (server_utc_time - now);
++1459: gUTCOffset = (server_utc_time - (S32)now);
  • linden\indra\newview\llpaneldirevents.cpp @ line 137, and line 169
--137: internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
++137: internal_time = utc_to_pacific_time((S32)utc_time, gPacificDaylightTime);
--169: internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
++169: internal_time = utc_to_pacific_time((S32)utc_time, gPacificDaylightTime);
  • linden\indra\newview\llfloaterreporter.cpp @ line 668
--668: msg->addU32Fast(_PREHASH_Time, mcd->mTime);
++668: msg->addU32Fast(_PREHASH_Time, (U32)mcd->mTime);
  • linden\indra\newview\llfloaterland.cpp @ line 2609, and line 2878
--2609: S32 now = time(NULL);
++2609: S32 now = (S32)time(NULL);
--2878: S32 now = time(NULL);
++2878: S32 now = (S32)time(NULL);
  • linden\indra\newview\llfloaterbump.cpp @ line 120
--120: timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime);
++120: timep = utc_to_pacific_time((S32)mcd->mTime, gPacificDaylightTime);
  • linden\indra\newview\viewer.cpp @ line 2510
--2510: srand(time(NULL));
++2510: srand((U32)time(NULL));

  • linden\indra\newview\llurlwhitelist.cpp @ line 43
--43: mUrlListIter ( 0 )
++43: mUrlListIter ( LLUrlWhiteList::mUrlListIter )

Misc. Code Editing

  • linden\indra\llinventory\llinventory.cpp @ line 1433
++1433: @ (S32)now

Rebuild Boost Regex Library for Visual Studio C++ 8.0

  • Download & extract Boost source for win32.
  • Open the Visual Studio 2005 Command Prompt
  • cd "boost_1_33_1\libs\regex\build\"
  • run "nmake -fvc8.mak"
  • Get Coffee
  • Copy "boost_1_33_1\libs\regex\build\vc80\libboost_regex-vc80-mt-s-1_33_1.lib" to "\linden\libraries\i686-win32\lib_release\libboost_regex-vc80-mt-s-1_33_1.lib"
  • Copy "boost_1_33_1\libs\regex\build\vc80\libboost_regex-vc80-mt-s-1_33_1.lib" to "\linden\libraries\i686-win32\lib_debug\libboost_regex-vc80-mt-s-1_33_1.lib"
  • Right click on the newview project, and select Properties
  • (screen shot) Under Configuration Properties, Linker, Input
    • find and change "libboost_regex-vc71-mt-s.lib"(screen shot) to "libboost_regex-vc80-mt-s-1_33_1.lib"(screen shot) in the Additional Dependencies
  • Done!

Cannot open include file: 'windows.h' problem


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%

Disable llMozLib

  • linden\indra\llcommon\llpreprocessor.h @ line 51
--51: #define LL_LIBXUL_ENABLED		1
++51: #define LL_LIBXUL_ENABLED		0

Ready, Set, Build!

  • Build either ReleaseNoOpt (for debugging) or ReleaseForDownload (for production).
  • newview.exe will be built in \indra\newview\ReleaseNoOpt or \indra\newview\ReleaseForDownload
  • Create a shortcut to newview, and change the start location to \indra\newview\ (all the .dll will be found there.)