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

From Second Life Wiki
Jump to navigation Jump to search
Line 85: Line 85:
* Open the \indra\indra_complete\indra_complete.sln solution in Visual Studio.
* Open the \indra\indra_complete\indra_complete.sln solution in Visual Studio.
* Set newview to be the startup project.
* Set newview to be the startup project.
* Build either ReleaseNoOpt (for debugging) or ReleaseForDownload (for running/debugging production code).
* Build either '''ReleaseNoOpt''' (for debugging) or '''ReleaseForDownload''' (for running/debugging production code).
* Note that the ReleaseForDownload build also contains debug information and can be run in the debugger.
* Note that the ReleaseForDownload build also contains debug information and can be run in the debugger.
* newview_noopt.exe will be built in \indra\newview\ReleaseNoOpt, or
* newview_noopt.exe will be built in \indra\newview\ReleaseNoOpt, or SecondLife.exe will be built in \indra\newview\ReleaseForDownload
* SecondLife.exe will be built in \indra\newview\ReleaseForDownload
* 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.)
* 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.
* Alternately copy the exe (possibly rename it) to your "c:\program files\second life" folder.


== Additional Steps For 1.15 ==
== Additional Steps For 1.15 ==

Revision as of 07:23, 10 June 2007

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

  • 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)
    • 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.
    • Upon installing, it is sufficient to install the include and libraries part. Other DX development tools are not necessary.
  • Set up the project globals:
    • Start Visual C++
    • Go to Tools/Options/Projects/VC++ Directories
    • Make sure that the includes and libraries paths are there (or otherwise add them) in the following order: 1) Platform SDK paths, 2) DirectX SDK paths, 3) Visual C++ paths
    • If you are adding DirectX SDK paths, be aware that later versions of the DirectX SDK have subfolders inside the lib directory. With those make sure you select lib/x86, not just lib.

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 (which most likely you don't want to do). So for a start it may be safe to skip these.

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 zipfile 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 below.

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 olibs 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.
  • 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"
  • Copy "fmodapi375win\api\lib\fmodvc.lib" to "linden\libraries\i686-win32\lib_debug"
  • Copy "fmodapi375win\api\fmod.dll" to "linden\indra\newview"

gl

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

  • 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 running/debugging production code).
  • Note that the ReleaseForDownload build also contains debug information and can be run in the debugger.
  • newview_noopt.exe will be built in \indra\newview\ReleaseNoOpt, or SecondLife.exe will be built in \indra\newview\ReleaseForDownload
  • 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.

Additional Steps For 1.15

There are several resource files missing from the 1.15.0.2 source code distribution that are required for building. To fix this, download the latest 1.14 source and copy the files from linden\indra\newview\res\ into the same spot in your 1.15 distro except for the files resource.h and newViewRes.rc.

Several files are also missing which are needed for running the program after it has been built:

  • Copy static_index.db2 and static_data.db2 from C:\Program Files\SecondLife\app_settings\ into linden\indra\newview\app_settings\.
  • Copy the character and skins folder located in c:\program files\secondlife\ into your distro's linden\indra\newview\ folder being careful not to overwrite any files that have a newer version.
  • nss3.dll, smime3.dll, softokn3.dll, and ssl3.dll must be copied from c:\program files\secondlife into linden\indra\newview\.


Errors while building?

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


Debugging Info/Configurations

  • You can either debug the ReleaseNoOpt, ReleaseForDownload configuration (Debug should also work).
  • ReleaseNoOpt compiles faster and has more debugging information, but this comes at a penalty of about 50% of your FPS in busy areas, compared to ReleaseForDownload build.
  • ReleaseForDownload 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
  • 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 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 far down the road, but if you make changes to the source and want to submit them, see the page about submitting patches.