Difference between revisions of "Compiling the viewer (MSVS2003)"

From Second Life Wiki
Jump to navigation Jump to search
(+big warning at the top of the page)
 
(83 intermediate revisions by 22 users not shown)
Line 1: Line 1:
{{CompileNav}}
{{CompileNav}}
{{Warning|These instructions will not work with newer versions of the viewer.  See [[Microsoft Windows Builds]] for building the latest version of the viewer.}}


The following instructions are for compiling the Second Life viewer on Windows.  For other platforms, see [[Compiling the viewer]].  If you get lost, or these instructions are incomplete, email ben@lindenlab.com - I'll try to get them fixed.
The following instructions are for compiling the Second Life viewer on Windows for Visual Studio .Net 2003If you are using more recent versions of Visual Studio, see [[Compiling the viewer (MSVS2005)]]. For other platforms including MacOS and Linux, see [[Compiling the viewer]].


=== Windows ===
If you get lost, or these instructions are incomplete, see [[communication tools]] for a list of ways to get in touch with people that can help.
==== Development Environment ====
The following dev environment is what LL uses for Windows development.  There is no reason that the Second Life viewer can not be built using other environments, but it will take some extra work.  We should soon have instructions for building the viewer using Microsoft's Visual Studio .NET 2005 Express, which at the time of writing, was freely available.


* Visual Studio .NET 2003 Professional
== Development Environment ==
** [http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en Microsoft Platform SDK]
The following dev environment is what LL uses for Windows developmentThere is no reason that the Second Life viewer can not be built using other environments, but it will take some extra work.
** NEED NEWER DIRECTX [http://www.microsoft.com/downloads/details.aspx?FamilyID=9216652f-51e0-402e-b7b5-feb68d00f298&displaylang=en 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 versionInstalling the new SDK "on top" of an older version may cause problems.
** Set up the project globals:
*** Start Visual C++
*** Go to Tools/Options/Projects/VC++ Directories
*** Make sure that the '''includes''' and '''libraries''' paths have the DirectX SDK paths first, then the Platform SDK paths, and then the Visual C++ paths.
* [http://www.activestate.com/Products/ActivePython/?mp=1 ActivePython 2.3x]
* [http://www.activestate.com/Products/ActivePerl/?mp=1 ActivePerl]
* [http://www.cygwin.com/ 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.


==== Libraries ====
(Instructions for building the viewer using Microsoft's Visual Studio .NET 2005 Express can be found [[Compiling the viewer (MSVS2005)|on another page]]. At the time of writing, Express was freely available.)


If you have downloaded the library directory from LL, extract it, and copy the files to your code directory, maintaining the same directory structure. We have included all the libraries we can ship in this file, but we can not distribute the source to the following , and you will need to follow the instructions to acquire below:
=== Visual Studio .NET 2003 Professional ===
* Setup [[Microsoft Visual Studio]].


Fmod
* Optional: If you wish to save disk space, consider the below. Otherwise, the default VS2003 install options are fine:
  It is not necessary to install every possible VS2003 component to compile the client source.
 
  For the installation prerequisites, it is not necessary to install the Internet Information Server (IIS) or SQL Server 2000.
 
  Only the following components are absolutely needed in VS2003:
 
  Visual Studio .NET Professional (Required)<br>
  1.2 Visual C++ .NET<br>
  1.2.1 Visual C++ Class & Template Libraries<br>
  1.2.2 Visual C++ Run-Time Libraries<br>
  1.2.2.1 Visual C++ Dynamic CRT Libraries<br>
  1.2.2.2 Visual C++ CRT Source Code<br>
  1.2.2.3 Visual C++ Static Single-Threaded CRT Libraries<br>
  1.2.2.4 Visual C++ Static Multi-Threaded CRT Libraries<br>
  1.2.3 Visual C++ Tools<br>
  1.2.3.2 Spy++<br>
  1.2.3.5 Visual C++ Error Lookup<br>
  1.6 Tools for Redistributing Applications<br>
  1.6.1 Graphics Library<br>
  1.6.2 Redistributable Merge Modules


gl
=== Other Development Tools ===
You will also need some open source development tools.
==== Required ====
* [http://www.cmake.org/ CMake 2.4.8]
* [http://www.cygwin.com/ 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. Older releases (< r79209) had several hardcoded references that expect Cygwin to be installed at '''C:\cygwin''' in the project files, however current releases rely on the build environment configuration instead.
* [http://www.activestate.com/Products/ActivePython/?mp=1 ActivePython 2.3x or later] - Latest Version is 2.5.1.1
** You should install this if compiling 1.18 or later viewers, or else hack the prebuild .bat files as in [http://jira.secondlife.com/browse/VWR-1267 VWR-1267].
==== Optional ====
* ActivePerl was recommended for previous versions on this Wiki, but it currently appears that it is not strictly necessary unless you are planning to build your own version of all libraries (which most likely you don't want to do).  So for a start it may be safe to skip it.
*: [http://www.activestate.com/Products/ActivePerl/?mp=1 ActivePerl]


Quicktime
== Source Code ==
The easiest way to get this working is to get '''source''', '''artwork''' and '''libraries''' for the same version 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''.
'''Note:''' Avoid folder names with spaces in them (this means avoid putting the project into your ''My Documents'' folder).


In the source directory, there are several empty placeholder folders for libraries which the Second Life viewer relies upon. This section describes how to acquire the code, and how to install it. It is a good idea to install in order, as some libraries will rely on previous installs (ie, libcurl needs opensll and zlib).
== Open Source Libraries ==


===== Boost =====
Some libraries can be distributed with the SL source and there is a library package available with the source. As mentioned above (about the source), you can simply extract the '''library''' archive and copy the files to your code directory, maintaining the same directory structure.
* Download & extract [http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041 Boost] source for win32.
* Copy the "boost_X_XX_X\boost" folder to "libraries\include\".
* Run "boost_X_XX_X\tools\build\jam_src\build".
* Copy "boost_X_XX_X\tools\build\jam_src\bin.ntx86\bjam.exe" to "boost_X_XX_X\".
* Using the command prompt, build the static libraries:
** cd linden\libraries\include\boost-X_XX_X\
** set PYTHON_ROOT=C:\Python23
** set PYTHON_VERSION=2.3
** bjam stage
* copy "boost_X_XX_X\stage\lib\libboost_python-vc71-mt.lib" to "\libraries\i686-win32\lib_release\"
* copy "boost_X_XX_X\stage\lib\libboost_python-vc71-mt-gd.lib" to "\libraries\i686-win32\lib_release\libboost_python-vc71-mt.lib"
* copy "boost_X_XX_X\stage\lib\libboost_regex-vc71-mt-s.lib" to "\libraries\i686-win32\lib_release\"
* copy "boost_X_XX_X\stage\lib\libboost_regex-vc71-mt-sgd.lib" to "\libraries\i686-win32\lib_release\libboost_regex-vc71-mt-s.lib"


===== Expat =====
If instead you are interested in compiling these libraries from their source (instead of using the above zip file of precompiled libraries provided by Linden Lab), see [[Compiling the viewer libraries (MSVS 2003)]]
* Download and run [http://sourceforge.net/project/showfiles.php?group_id=10127 Expat Win32 Binary]
* copy "Expat-X.X.X\Source\lib\expat.h" to "libraries\include\expat\".
* copy "Expat-X.X.X\Source\lib\expat_external.h" to "libraries\include\expat\".
* copy "Expat-X.X.X\StaticLibs\libexpatMT.lib" to "libraries\i686-win32\lib_release\".
* copy "Expat-X.X.X\StaticLibs\libexpatMT.lib" to "libraries\i686-win32\lib_debug\".


===== ZLib =====
== Other Libraries ==
* Download & extract [http://www.zlib.net/ Zlib]
* copy "zlibXXX\zlib.h" to "libraries\include\zlib\".
* copy "zlibXXX\zconf.h" to "libraries\include\zlib\".
* Using the command prompt, build the static libraries:
** "C:\Program Files\Microsoft Visual Studio .net 2003\Common7\Tools\vsvars32.bat"
** cd %ZLIB_FOLDER%
** nmake -f win32/Makefile.msc
* copy "zlibXXX\zlib.lib" to "libraries\i686-win32\lib_release\".
* copy "zlibXXX\zlib.lib" to "libraries\i686-win32\lib_debug\".


===== Apache Portable Runtime =====
Linden Lab included all the libraries/includes they can ship with their source, but we can not distribute the source to the following, and you will need to follow the instructions to acquire them, below.
* Take out XML dependancies, move expat headers!!!!
* Download & extract [http://apr.apache.org/download.cgi apr, apr-util, and apr-iconv].
* For simplicity  place all three in a parallel directory structure, and rename the directories:
** C:\work\apr\
** C:\work\apr-iconv\
** C:\work\apr-util\
* Open the "\apr-util\aprutil.dsp" project in VS2003.
* For the apr, apr-util & apr-iconv projects, change the Runtime Library from Multi-threaded DLL to Multi-threaded:
** Right click each project in the Solution Explorer, choose properties.
** In the C/C++ folder, choose Code Generation.
** Change the Runtime Library to Muli-threaded.
** Repeat for both debug and release.
* Remove the apr-util's dependency on xml:
** Right click the apr-util project, and choose dependencies.
** Uncheck xml.
** Right click the xml project in the Solution Explorer.
** Choose Remove.
* copy "Expat-X.X.X\Source\lib\expat.h" to "apr\apr-util\xml".
* copy "Expat-X.X.X\Source\lib\expat_external.h" to "apr\apr-util\xml\".
* Build Solution for Debug, and build solution for release.
* copy "\apr-util\LibR\aprutil-1.lib" to "libraries\i686-win32\lib_release".
* copy "\apr-util\LibR\aprutil_src.pdb" to "libraries\i686-win32\lib_release".
* copy "\apr\LibR\apr-1.lib" to "libraries\i686-win32\lib_release".
* copy "\apr\LibR\apr_src.pdb" to "libraries\i686-win32\lib_release".
* copy "\apr-util\LibD\aprutil-1.lib" to "libraries\i686-win32\lib_debug".
* copy "\apr-util\LibD\aprutil_src.pdb" to "libraries\i686-win32\lib_debug".
* copy "\apr\LibD\apr-1.lib" to "libraries\i686-win32\lib_debug".
* copy "\apr\LibD\apr_src.pdb" to "libraries\i686-win32\lib_debug".
* copy header files:
** copy the contents of "apr\include" to "libraries\i686-win32\include\apr-1".
** in "libraries\i686-win32\include\apr-1\arch\" only the "win32" dir and "apr_private_common.h" are required.
** copy the contents of "apr-util\include" to "libraries\i686-win32\include\apr-1".


===== Freetype =====
These steps are cumbersome and will have to be repeated for each new release (if you keep the source for each release in it's own folder). It is a good idea to build an empty directory tree for the files below, then copy these library files there. Once completed, copy the whole tree to the actual source folder (like ''XCOPY  olibs  sl_1_16_0_5 /S''). You will then only need to repeat the last step for each new release, reusing the tree you have already created.
* Download and run [http://gnuwin32.sourceforge.net/packages/freetype.htm FreeType for Windows].
* copy the contents of "GnuWin32\include\freetype2\freetype" into "\libraries\include\freetype"
* copy "GnuWin32\lib\freetype.lib" to "libraries\i686-win32\lib_release".  
* copy "GnuWin32\lib\freetype.lib" to "libraries\i686-win32\lib_debug".
* copy "GnuWin32\include\ft2build.h" to "libraries\include".


===== gl =====
If you do not want to do this, of course you can just copy the files directly into the linden source paths.
* Download [http://oss.sgi.com/projects/ogl-sample/sdk.html glext.h, glxext.h, and wglext.h]
* Copy them to "libraries\i686-win32\include\GL"


===== OpenSSL =====
rem OLIBS.CMD to build a folder tree for 3rd party libraries and includes
* Download and extract: http://www.openssl.org/source/
md olibs
* Using the command prompt, build the static libraries:
md olibs\linden\
** cd %PATH%
md olibs\linden\libraries
** perl Configure VC-WIN32
md olibs\linden\libraries\include
** ms\do_masm
md olibs\linden\libraries\i686-win32
* Edit openssl-X.X.Xy\ms\nt.mak
md olibs\linden\libraries\i686-win32\lib_release
** Change /MD to /MT in CFLAGS
md olibs\linden\libraries\i686-win32\lib_debug
* back in the command prompt:
md olibs\linden\libraries\i686-win32\include
** nmake -f ms\nt.mak
md olibs\linden\libraries\i686-win32\include\GL
** copy all the ".lib" files from "openssl-X.X.Xy\out32" to "libraries\i686-win32\lib_release"
md olibs\linden\libraries\i686-win32\include\quicktime
md olibs\linden\indra
md olibs\linden\indra\newview


===== cURL =====
==== Fmod ====
* Download & extract the [http://curl.haxx.se/download.html curl source].
* Download & extract [http://www.fmod.org/index.php/download fmod 3.75 api for win32] (''not'' 4.12).
* Edit "curl-X.XX.X\lib\Makefile.vc6"
* Copy "fmodapi375win\api\inc\fmod.h" to "linden\libraries\include"
** Change OPENSSL_PATH to ../../../openssl-<version>
* Copy "fmodapi375win\api\inc\fmod_errors.h" to "linden\libraries\include"
** Change the ZLIB_PATH to ../../../zlib-<version>/src
* Copy "fmodapi375win\api\lib\fmodvc.lib" to "linden\libraries\i686-win32\lib_release" (or ...\lib\release, as applicable)
** Change RTLIB to /MT
* Copy "fmodapi375win\api\lib\fmodvc.lib" to "linden\libraries\i686-win32\lib_debug" (or ...\lib\debug, as applicable)
** Change RTLIBD to /MTd
* Copy "fmodapi375win\api\fmod.dll" to "linden\indra\newview"
* Using the command prompt, build the static libraries:
** "C:\Program Files\Microsoft Visual Studio .net 2003\Common7\Tools\vsvars32.bat"
** cd %PATH%\lib\
** nmake /f Makefile.vc6 CFG=release-ssl-zlib
** Copy "curl-X.XX.X\lib\release-ssl-zlib\libcurl.lib" to "libraries\i686-win32\lib_debug"
** Copy "curl-X.XX.X\lib\release-ssl-zlib\libcurl.lib" to "libraries\i686-win32\lib_release"
** Copy all the header files in "curl-X.XX.X\include\curl" to "libraries\include\curl"  


===== XMLRPC-epi =====
==== gl (pre-1.20) ====
 
* Download [http://oss.sgi.com/projects/ogl-sample/sdk.html glext.h, glxext.h, and wglext.h]
**Download and Extract [http://xmlrpc-epi.sourceforge.net/ xmlrpc-epi].
* Copy them to "linden\libraries\i686-win32\include\GL"
**Get the patch 1 & 3 from [[Patch_xmlrpc-epi]]
*Using cygwin:
<pre>$ tar xvzf xmlrpc-epi-0.51
$ cd xmlrpc-epi-0.51
$ patch -p1 < ../remove_iconv.patch
$ patch -p1 < ../excise_expat.patch
$ rm -rf expat
$ mkdir expat
$ cp $FOO expat
    Where $FOO is either
        /tmp/expat/include/* -- if you built expat recently
    or  ../../expat-1.95.8/src/lib/expat*.h -- if you haven't
    in this later case you'll need to have CVS gotten the expat
    lib, and expanded it's src.tar.gz file there
</pre>
*Copy over the Visual Studio files:
<pre>
$ cp ../src/xmlrpcepi.* .
</pre>
*Open the xmlrpcepi.sln file and build


===== Vorbis & Ogg =====
Note: From 1.20 forward, LL have found suitable redistributable equivalents and ship them in the source
* Download & extract [http://www.xiph.org/downloads/ libvorbis].
* Download & extract [http://www.xiph.org/downloads/ libogg].
* Build & copy libogg first:
** Open "libogg-X.X.X\win32\ogg_static.dsp" in visual studio.
** Build both debug and release solutions.
** Copy "libogg-X.X.X\include\ogg" into "libvorbis-X.X.X\include"
** Copy "libogg-X.X.X\include\ogg\ogg.h" to "libraries\include\ogg"
** Copy "libogg-X.X.X\include\ogg\os_types.h" to "libraries\include\ogg"
** Copy "libogg-X.X.X\win32\Static_Release\ogg_static.lib" to "libraries\i686-win32\lib_release"
** Copy "libogg-X.X.X\win32\Static_Debug\ogg_static_d.lib" to "libraries\i686-win32\lib_debug\ogg_static.lib"
* Build & copy libvorbis:
** Build release & debug "libvorbis-X.X.X\win32\vorbis_static.dsp"
** Build release & debug "libvorbis-X.X.X\win32\vorbisfile_static.dsp"
** Build release & debug "libvorbis-X.X.X\win32\vorbisenc_static.dsp"
** copy "libvorbis-X.X.X\include\vorbis\codec.h" to "libraries\include\vorbis"
** copy "libvorbis-X.X.X\include\vorbis\vorbisfile.h" to "libraries\include\vorbis"
** copy "libvorbis-X.X.X\include\vorbis\vorbisenc.h" to "libraries\include\vorbis"
** copy "libvorbis-1.1.2\win32\Vorbis_Static_Release\vorbis_static.lib" to "libraries\i686-win32\lib_release"
** copy "libvorbis-1.1.2\win32\VorbisEnc_Static_Release\vorbisenc_static.lib" to "libraries\i686-win32\lib_release"
** copy "libvorbis-1.1.2\win32\VorbisFile_Static_Release\vorbisfile_static.lib" to "libraries\i686-win32\lib_release"
** copy "libvorbis-1.1.2\win32\Vorbis_Static_Debug\vorbis_static_d.lib" to "libraries\i686-win32\lib_debug\vorbis_static.lib"
** copy "libvorbis-1.1.2\win32\VorbisEnc_Static_Debug\vorbisenc_static_d.lib" to "libraries\i686-win32\lib_debug\vorbisenc_static.lib"
** copy "libvorbis-1.1.2\win32\VorbisFile_Static_Debug\vorbisfile_static_d.lib" to "libraries\i686-win32\lib_debug\vorbisfile_static.lib"


===== JPEGlib =====
* Download & extract [http://www.ijg.org/ jpeglib] - download the file 'jpegsrc.v6b.tar.gz'.
* Copy "jpegsr6\jpeg-6b\makefile.vc" to the file "jpegsr6\jpeg-6b\Makefile"
* Copy "jpegsr6\jpeg-6b\jconfig.vc" to "jpegsr6\jpeg-6b\jconfig.h"
* At the command prompt:
** "C:\Program Files\Microsoft Visual Studio .net 2003\Common7\Tools\vsvars32.bat"
** cd %ZLIB_FOLDER%
** nmake -f Makefile
* copy "jconfig.h", "jerror.h", "jmorecfg.h", "jpeglib.h", and "jinclude.h" from * to "libraries\include\jpeglib"
* copy "jpegsr6\jpeg-6b\libjpeg.lib" to "libraries\i686-win32\lib_release"
* copy "jpegsr6\jpeg-6b\libjpeg.lib" to "libraries\i686-win32\lib_debug"
* [[Patch jpeglib]]


===== Fmod =====
* Download & extract [http://www.fmod.org/ifmoddownload.html 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"


===== Quicktime =====
==== Quicktime (Optional) ====
* '''Note:''' Quicktime download can be skipped '''if you can live with a build that does not play in-world movies''' (some minor modifications to the project are necessary then, see "QuickTime removal" on the build instructions for [[Compiling the viewer (MSVS2005)|Visual Studio 2005]]).
* Download & install the [http://developer.apple.com/quicktime/download/ Quicktime SDK for Windows]
* Download & install the [http://developer.apple.com/quicktime/download/ Quicktime SDK for Windows]
* Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "\libraries\i686-win32\lib_release".
* Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "linden\libraries\i686-win32\lib_release".
* Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "\libraries\i686-win32\lib_debug".
* Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "linden\libraries\i686-win32\lib_debug".
* Copy the contents of "QuicktimeSDK\CIncludes" into "\libraries\i686-win32\include\quicktime".
* Copy the contents of "QuicktimeSDK\CIncludes" into "linden\libraries\i686-win32\include\quicktime".
 
===== OpenJPEG =====
* Download and extract [http://www.openjpeg.org/index.php?menu=download openjpeg for win32].
* Copy "openjpeg10_win32\openjpeg.h" to ""\libraries\include\openjpeg"
* Copy "openjpeg10_win32\LibOpenJPEG.lib" to "\libraries\i686-win32\lib_release".
* Copy "openjpeg10_win32\LibOpenJPEG.lib" to "\libraries\i686-win32\lib_debug".
 
===== TUT =====
* Download and extract [http://tut-framework.sourceforge.net/download/ tut]
* Copy "tut.h", "tut_reporter.h", and "tut_restartable.h" to "libraries\include\tut"
 
===== LLMozLib =====
These instructions describe how to build the Windows version of LLMozLib for use within the Second Life client. They have been tested using Microsoft Visual Studio 7.1 - apparently, things do work with other versions of the Microsoft compiler but they have not been tried or tested.
 
LLMozLib currently uses code from the 1.8.0 branch of the Mozilla codebase - similar to what is used in Firefox 1.5. At some point in the future we will switch to the 1.8.1 branch - the one used to build Firefox 2.0.
 
The steps required to generate LLMozLib and associated run-time files are:
 
* Set up your environment for building the Mozilla source code. (these instructions are specific to the Mozilla branch we are using - building the trunk is different)
 
http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites_on_the_1.7_and_1.8_Branches
 
* Checkout the Mozilla source code from their CVS repository. Let's assume you are using the <code>c:\mozilla</code> directory to build in.
  c:
  cd \
  cvs login (the password is 'anonymous')
  cvs checkout -r FIREFOX_1_5_0_9_RELEASE mozilla/client.mk
  cd c:\mozilla
  make -f client.mk checkout MOZ_CO_PROJECT=xulrunner
 
:Note: the CVS tag will change as Mozilla release updates. Version 1.5.0.9 is current as of writing.
 
* Apply a patch which enables certain features that are required for the Second Life client.
 
:The patch can be found in the <code>build_mozilla</code> directory.
 
:Copy the patch into the directory where you are building Mozilla and apply the patch:
 
patch -p0 < linden_updates.patch
 
* Build optimized (release) and debug versions of a XULRunner configuration of the Mozilla codebase.
 
:The <code>build_mozilla</code> directory contains 2 Mozilla configuration files - one for a debug build and one for an optimized build.
 
:Copy both files into the directory where you are building Mozilla and then:
 
copy .mozconfig.debug .mozconfig
make -f client.mk build
 
copy .mozconfig.optimized .mozconfig
make -f client.mk build
 
* Copy a subset of the header files and libraries you built into the LLMozLib tree
 
:There is a batch file in the LLMozLib directory to help you.
 
:You may need to edit the paths at the top if your Mozilla source directory is different.
 
copy_products_windows.bat
 
* Build LLMozLib using Microsoft Visual Studio 7.1
 
:Open the LLMozLib solution file <code>llmozlib.sln</code>.
 
:Build the Debug and Release configurations in the normal fashion.
 
* Copy the LLMozLib files to the Second Life client branch
 
:There is a batch file in the LLMozLib directory to help you.


:You may need to edit the paths at the top if your Second Life client directory is different.


copy_llmozlib_to_branch.bat


* That completes the LLMozLib build - the files that are copied (relative to the Second Life client directory) are:
== Building ==
* '''For Viewer build versions 1.21 and newer,''' go into the '''indra''' folder, and run the '''develop.py''' script. (This step does not apply to build version 1.20 and older.)
* Open the '''indra\build-vc71\SecondLife.sln''' solution in Visual Studio
* Build either '''ReleaseNoOpt''' (for debugging) or '''Release''' (for running or debugging production code).  See [[#Configurations/Debugging Info]] for details on these configurations.
** Note that the Release build also contains debug information, and can be run in the debugger.
* To run the executable 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.
* There were additional steps required in version 1.15 which seem to be fixed now.  If you are trying to build 1.15 see an [https://wiki.secondlife.com/w/index.php?title=Compiling_the_viewer_%28MSVS2003%29&oldid=23026 older version of this page].


Header file (llmozlib.h) in libraries\include\
== Errors while building? ==
See [[Common compilation problems]] if you run into errors while building.


Static library (llmozlib.lib) (debug) in libraries\i686-win32\lib_debug\
== Configurations/Debugging Info ==
Static library (llmozlib.lib) (release) in libraries\i686-win32\lib_release\
* You will usually compile/debug the '''RelWithDebInfo''' or Release configuration ('''Debug''' should also work but should not really be necessary).
* '''RelWithDebInfo''' 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.
* '''Release''' runs fine in the debugger, but times you may miss debugger access to some local variables or the debugger may even show wrong values for objects and members, because it is confused by the optimizations.
* '''RelWithDebInfo''' comes with a seperate debugging console window opens and stays open for the duration of your session.
* You can see the last few lines from the debugger console also by pressing Shift+Ctrl+4 in the viewer (all builds).
* The debug log (usually in application data) can also be redirected to a more file if you add "-log secondlife.log" to the command line (Newview, Properties, Debugging, Command line arguments).
* If you want to build a '''Debug''' configuration, see the specific section with compile instructions on [[Finding_leaks]]


  Runtime DLLs (debug) in libraries\i686-win32\lib_debug\
== Problems Running? ==
  Runtime DLLs (release) in libraries\i686-win32\lib_release\
* Viewer Error: '''Second Life is unable to access a file that it needs.''':  Did you neglect to download the Artworks archive from the [[source downloads]] page?  It is in the Viewer column, below the OS-specific Viewer archives.
* '''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 reopen it, before you can connect to the selected grid).
* '''Inventory errors''': If you're getting errors while trying to load your inventory, try [[Help:Stuck logging in|clearing your cache and deleting other temporary files]].
* If you want to connect to the beta grid, add '''--aditi''' to the command line (Newview, Properties, Debugging, Command line argument).
* '''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".
* '''assert with star_brightness''' and/or '''Black Screen''' under '''Windlight''': Current distributions of the Windlight source are missing files from the app_settings/windlight folder. Download the Linden Windlight viewer, install it and copy the files (and subfolders) into your development environment (linden/indra/newview/app_settings/windlight)


Runtime misc files (debug) in indra\newview\app_settings\mozilla_debug\
== Submit Patches ==
Runtime misc files (release) in indra\newview\app_settings\mozilla_release\
This is probably far down the road, but if you make changes to the source and want to submit them, see the page about [[Submitting patches|submitting patches]].


=== Building ===
[[Category:Compiling viewer]]
* Open the \indra\indra_complete\indra_complete.sln solution in Visual Studio.
* Set newview to be the startup project.
* 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.)

Latest revision as of 12:05, 6 February 2009

Warning!

These instructions will not work with newer versions of the viewer. See Microsoft Windows Builds for building the latest version of the viewer.


The following instructions are for compiling the Second Life viewer on Windows for Visual Studio .Net 2003. If you are using more recent versions of Visual Studio, see Compiling the viewer (MSVS2005). For other platforms including MacOS and Linux, see Compiling the viewer.

If you get lost, or these instructions are incomplete, see communication tools for a list of ways to get in touch with people that can help.

Development Environment

The following dev environment is what LL uses for Windows development. There is no reason that the Second Life viewer can not be built using other environments, but it will take some extra work.

(Instructions for building the viewer using Microsoft's Visual Studio .NET 2005 Express can be found on another page. At the time of writing, Express was freely available.)

Visual Studio .NET 2003 Professional

  • Optional: If you wish to save disk space, consider the below. Otherwise, the default VS2003 install options are fine:
  It is not necessary to install every possible VS2003 component to compile the client source.
  
  For the installation prerequisites, it is not necessary to install the Internet Information Server (IIS) or SQL Server 2000.
  
  Only the following components are absolutely needed in VS2003:
  
  Visual Studio .NET Professional (Required)
1.2 Visual C++ .NET
1.2.1 Visual C++ Class & Template Libraries
1.2.2 Visual C++ Run-Time Libraries
1.2.2.1 Visual C++ Dynamic CRT Libraries
1.2.2.2 Visual C++ CRT Source Code
1.2.2.3 Visual C++ Static Single-Threaded CRT Libraries
1.2.2.4 Visual C++ Static Multi-Threaded CRT Libraries
1.2.3 Visual C++ Tools
1.2.3.2 Spy++
1.2.3.5 Visual C++ Error Lookup
1.6 Tools for Redistributing Applications
1.6.1 Graphics Library
1.6.2 Redistributable Merge Modules

Other Development Tools

You will also need some open source development tools.

Required

  • CMake 2.4.8
  • 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. Older releases (< r79209) had several hardcoded references that expect Cygwin to be installed at C:\cygwin in the project files, however current releases rely on the build environment configuration instead.
  • ActivePython 2.3x or later - Latest Version is 2.5.1.1
    • You should install this if compiling 1.18 or later viewers, or else hack the prebuild .bat files as in VWR-1267.

Optional

  • ActivePerl was recommended for previous versions on this Wiki, but it currently appears that it is not strictly necessary unless you are planning to build your own version of all libraries (which most likely you don't want to do). So for a start it may be safe to skip it.
    ActivePerl

Source Code

The easiest way to get this working is to get source, artwork and libraries for the same version 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. Note: Avoid folder names with spaces in them (this means avoid putting the project into your My Documents folder).

Open Source Libraries

Some libraries can be distributed with the SL source and there is a library package available with the source. As mentioned above (about the source), you can simply extract the library archive and copy the files to your code directory, maintaining the same directory structure.

If instead you are interested in compiling these libraries from their source (instead of using the above zip file of precompiled libraries provided by Linden Lab), see Compiling the viewer libraries (MSVS 2003)

Other Libraries

Linden Lab included all the libraries/includes they can ship with their source, but we can not distribute the source to the following, and you will need to follow the instructions to acquire them, below.

These steps are cumbersome and will have to be repeated for each new release (if you keep the source for each release in it's own folder). It is a good idea to build an empty directory tree for the files below, then copy these library files there. Once completed, copy the whole tree to the actual source folder (like XCOPY olibs sl_1_16_0_5 /S). You will then only need to repeat the last step for each new release, reusing the tree you have already created.

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 (not 4.12).
  • 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" (or ...\lib\release, as applicable)
  • Copy "fmodapi375win\api\lib\fmodvc.lib" to "linden\libraries\i686-win32\lib_debug" (or ...\lib\debug, as applicable)
  • Copy "fmodapi375win\api\fmod.dll" to "linden\indra\newview"

gl (pre-1.20)

Note: From 1.20 forward, LL have found suitable redistributable equivalents and ship them in the source


Quicktime (Optional)

  • Note: Quicktime download can be skipped if you can live with a build that does not play in-world movies (some minor modifications to the project are necessary then, see "QuickTime removal" on the build instructions for Visual Studio 2005).
  • Download & install the Quicktime SDK for Windows
  • Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "linden\libraries\i686-win32\lib_release".
  • Copy "QuicktimeSDK\Libraries\QTMLClient.lib" to "linden\libraries\i686-win32\lib_debug".
  • Copy the contents of "QuicktimeSDK\CIncludes" into "linden\libraries\i686-win32\include\quicktime".


Building

  • For Viewer build versions 1.21 and newer, go into the indra folder, and run the develop.py script. (This step does not apply to build version 1.20 and older.)
  • Open the indra\build-vc71\SecondLife.sln solution in Visual Studio
  • Build either ReleaseNoOpt (for debugging) or Release (for running or debugging production code). See #Configurations/Debugging Info for details on these configurations.
    • Note that the Release build also contains debug information, and can be run in the debugger.
  • To run the executable 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.
  • There were additional steps required in version 1.15 which seem to be fixed now. If you are trying to build 1.15 see an older version of this page.

Errors while building?

See Common compilation problems if you run into errors while building.

Configurations/Debugging Info

  • You will usually compile/debug the RelWithDebInfo or Release configuration (Debug should also work but should not really be necessary).
  • RelWithDebInfo 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.
  • Release runs fine in the debugger, but times you may miss debugger access to some local variables or the debugger may even show wrong values for objects and members, because it is confused by the optimizations.
  • RelWithDebInfo comes with a seperate debugging console window opens and stays open for the duration of your session.
  • You can see the last few lines from the debugger console also by pressing Shift+Ctrl+4 in the viewer (all builds).
  • The debug log (usually in application data) can also be redirected to a more file if you add "-log secondlife.log" to the command line (Newview, Properties, Debugging, Command line arguments).
  • If you want to build a Debug configuration, see the specific section with compile instructions on Finding_leaks

Problems Running?

  • Viewer Error: Second Life is unable to access a file that it needs.: Did you neglect to download the Artworks archive from the source downloads page? It is in the Viewer column, below the OS-specific Viewer archives.
  • 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 reopen it, before you can connect to the selected grid).
  • Inventory errors: If you're getting errors while trying to load your inventory, try clearing your cache and deleting other temporary files.
  • If you want to connect to the beta grid, add --aditi to the command line (Newview, Properties, Debugging, Command line argument).
  • 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".
  • assert with star_brightness and/or Black Screen under Windlight: Current distributions of the Windlight source are missing files from the app_settings/windlight folder. Download the Linden Windlight viewer, install it and copy the files (and subfolders) into your development environment (linden/indra/newview/app_settings/windlight)

Submit Patches

This is probably far down the road, but if you make changes to the source and want to submit them, see the page about submitting patches.