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

From Second Life Wiki
Jump to navigation Jump to search
m (→‎Building: some organization)
(some cleanup)
Line 4: Line 4:


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.
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.
<br />
 
<br />
== Development Environment ==
== 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.
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 [[Compiling the viewer (MSVS2005)|on another page]]. At the time of writing, Express was freely available.)
(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.)
<br />
 
=== Visual Studio .NET 2003 Professional ===
=== Visual Studio .NET 2003 Professional ===
* Setup [[Microsoft Visual Studio]].
* Setup [[Microsoft Visual Studio]].
Line 26: Line 25:
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''.
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).
'''Note:''' Avoid folder names with spaces in them (this means avoid putting the project into your ''My Documents'' folder).
<br />
 
<br />
<br />
== Open Source Libraries ==
== 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.   
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)]]
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)]]
<br />
 
<br />
== Other Libraries ==
== 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.
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.


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).
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.
If you do not want to do this, of course you can just copy the files directly into the linden source paths.
Line 80: Line 76:
* Copy the contents of "QuicktimeSDK\CIncludes" into "linden\libraries\i686-win32\include\quicktime".
* Copy the contents of "QuicktimeSDK\CIncludes" into "linden\libraries\i686-win32\include\quicktime".


==== ares (viewer 1.18.4 ... for later releases first check if the ares.h and .lib files are already in the Linden library package) ====
====1.18.4====
Releases after 1.18.4 may already include the following libraries in the Linden-provided library package (see details below for how to find out):
 
===== ares =====
This is primarily for 1.18.4.  If you have a later version, first check whether the ares.h and .lib files are already in the Linden library package.
* download c-ares 1.4 from [http://daniel.haxx.se/projects/c-ares/ here] and unpack it somewhere
* download c-ares 1.4 from [http://daniel.haxx.se/projects/c-ares/ here] and unpack it somewhere
* open vc.dsw from the c-ares/vc folder
* open vc.dsw from the c-ares/vc folder
Line 91: Line 91:
* copy vc\areslib\Release\*lib to linden\libraries\i686-win32\lib_release
* copy vc\areslib\Release\*lib to linden\libraries\i686-win32\lib_release


==== openjpeg (viewer 1.18.4 ... for later releases first check if the openjpeg.lib files are already in the Linden library package) ====
===== openjpeg =====
This is primarily for 1.18.4. If you have a later version, first check whether the openjpeg.lib files are already in the Linden library package.
* download the latest OpenJPEG from [http://www.openjpeg.org/ here]
* download the latest OpenJPEG from [http://www.openjpeg.org/ here]
* open the libopenjpeg.dsw, let it convert and compile it (you'll need the files from the dllopenjpeg sub-project)  
* open the libopenjpeg.dsw, let it convert and compile it (you'll need the files from the dllopenjpeg sub-project)  
Line 97: Line 98:
* copy release\openjpeg.lib to linden\libraries\i686-win32\lib_release
* copy release\openjpeg.lib to linden\libraries\i686-win32\lib_release
* copy release\openjpeg.dll to linden\indra\newview
* copy release\openjpeg.dll to linden\indra\newview
<br />
<br />


== Building ==
== Building ==
* Open the '''indra\indra_complete\indra_complete.sln''' solution in Visual Studio (Note: If you plan to work with multiple versions over time, you will find it useful to rename '''indra_complete.sln''' to something which contains the version number, e.g. '''indra_1_17_0_11.sln''' before opening)
* Open the '''indra\indra_complete\indra_complete.sln''' solution in Visual Studio (Note: If you plan to work with multiple versions over time, you will find it useful to rename '''indra_complete.sln''' to something which contains the version number, e.g. '''indra_1_17_0_11.sln''' before opening)
* 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 or debugging production code).  See [[#Configurations/Debugging Info]] for details on these configurations.
** 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 SecondLife.exe will be built in \indra\newview\ReleaseForDownload
** newview_noopt.exe will be built in \indra\newview\ReleaseNoOpt, or SecondLife.exe will be built in \indra\newview\ReleaseForDownload
Line 112: Line 111:
== Errors while building? ==
== Errors while building? ==
See [[Common compilation problems]] if you run into errors while building.
See [[Common compilation problems]] if you run into errors while building.
<br />
 
<br />
<br />
== Configurations/Debugging Info ==
== Configurations/Debugging Info ==
* You will usually compile/debug the '''ReleaseNoOpt''' or ReleaseForDownload configuration ('''Debug''' should also work but should not really be necessary).
* You will usually compile/debug the '''ReleaseNoOpt''' or ReleaseForDownload configuration ('''Debug''' should also work but should not really be necessary).
Line 123: Line 120:
* 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).
* 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]]
* If you want to build a '''Debug''' configuration, see the specific section with compile instructions on [[Finding_leaks]]
<br />
 
<br />
== Problems Running? ==
== 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.
* 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 repoen it, before you can connect to the selected grid).
* '''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]].
* '''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).
* 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".
* '''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)
* '''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)
<br />
<br />


== Submit Patches ==
== 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|submitting 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|submitting patches]].

Revision as of 16:49, 8 March 2008

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

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

gl

glh (Windlight only)

There are currently (as of Windlight 1.18.6.75762) glh-include files missing from the source distribution. You should be able to grab them here or download a patch from the JIRA. The files need to go into linden/libraries/include/glh/*.h

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".

1.18.4

Releases after 1.18.4 may already include the following libraries in the Linden-provided library package (see details below for how to find out):

ares

This is primarily for 1.18.4. If you have a later version, first check whether the ares.h and .lib files are already in the Linden library package.

  • download c-ares 1.4 from here and unpack it somewhere
  • open vc.dsw from the c-ares/vc folder
  • remove the adig and ahost projects from the vc workspace
  • add ares_getnameinfo.c to the areslib project
  • for areslib right-click, properties, Code Generation and set Runtime Library to /MT (release) and /MTd (debug)
  • compile debug and release
  • copy all c-ares\*.h files to linden\libraries\include\ares\*.h
  • copy vc\areslib\Debug\*lib to linden\libraries\i686-win32\lib_debug
  • copy vc\areslib\Release\*lib to linden\libraries\i686-win32\lib_release
openjpeg

This is primarily for 1.18.4. If you have a later version, first check whether the openjpeg.lib files are already in the Linden library package.

  • download the latest OpenJPEG from here
  • open the libopenjpeg.dsw, let it convert and compile it (you'll need the files from the dllopenjpeg sub-project)
  • copy debug\openjpeg.lib to linden\libraries\i686-win32\lib_debug
  • copy release\openjpeg.lib to linden\libraries\i686-win32\lib_release
  • copy release\openjpeg.dll to linden\indra\newview

Building

  • Open the indra\indra_complete\indra_complete.sln solution in Visual Studio (Note: If you plan to work with multiple versions over time, you will find it useful to rename indra_complete.sln to something which contains the version number, e.g. indra_1_17_0_11.sln before opening)
  • Set newview to be the startup project.
  • Build either ReleaseNoOpt (for debugging) or ReleaseForDownload (for running or debugging production code). See #Configurations/Debugging Info for details on these configurations.
    • 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 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 ReleaseNoOpt or ReleaseForDownload configuration (Debug should also work but should not really be necessary).
  • 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 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.
  • 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 (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.