Difference between revisions of "Viewer 2 Microsoft Windows Builds"

From Second Life Wiki
Jump to navigation Jump to search
(Undo revision 1145170 by me (Talk) on Jonathan's request)
m (Redirected page to Visual Studio 2013 Viewer Builds)
 
(204 intermediate revisions by 17 users not shown)
Line 1: Line 1:
{{multi-lang}}
#REDIRECT [[Visual Studio 2013 Viewer Builds]]
{{CompileNav}}
 
{{KBwarning|custom=Work in progress|'''These instructions are not yet complete or  debugged''' as of May 31, 2011.}}
 
When finished, we hope this page will constitute a complete recipe for compiling viewer 2 from source on a Windows machine. 
 
Philosophy: to keep it brief, this page should only include steps we KNOW ARE NEEDED, not random hints.  Extra details or open issues can go on the talk page.
 
{{KBnote|Following this recipe will probably take 6 to 12 hours of wall-clock time, and 2 to 6 hours of your time, if you're starting from a fresh Windows XP/Vista/7 system.}}
 
== Establish your programming environment ==
 
This is needed for compiling any viewer based on the LL open source code and only needs to be done once.
 
=== Install and update Visual Studio and SDKs ===
 
# Install [http://www.microsoft.com/express/download/ Visual Studio 2010] (Express is okay)
#* If you installed VS2010 Express also install [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84&displaylang=en Microsoft Visual C++ 2010 Redistributable Package]
# Install  [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35aeda01-421d-4ba5-b44b-543dc8c33a20 Windows SDK for Windows 7 and .NET Framework 4] (ISO) or [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6B6C21D2-2006-4AFA-9702-529FA782D63B Windows SDK for Windows 7 and .NET Framework 4] (Web Install)
#* Note: You may need to install the .NET 4 framework: [http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992&displaylang=en Web install] or [http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=0a391abd-25c1-4fc0-919f-b21f31ab88b7 Full install].
# Install  [http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba DirectX SDK (June 2010)]
# Run [http://www.update.microsoft.com/microsoftupdate/v6 Microsoft Update], and keep running it until no updates are needed. This may take 6~8 iterations on older versions of windows.
#* Note: For windows Vista and Windows 7, you need to select "Get updates from other Microsoft products" to get the updates for Visual Studio.
#* For Windows XP, use the provided link above.  The Windows Update menu item on your computer is not the correct updater to use.
#* During the update cycles make sure you have picked up Microsoft Visual Studio 2010 Service Pack 1 [http://go.microsoft.com/fwlink/?LinkId=210710 (ISO)] or [http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5 (Web Install)]
 
=== Install required development tools ===
 
{{KBnote|The order of the following installations should not matter.}}
{{KBnote|If the installer for a particular package does not update your PATH environment setting you will have to do this manually.}}
 
# [http://www.cmake.org/files/v2.8/ CMake]
#* This should be version 2.8.4 (or above in the 2.8.x series). Ensure that any older versions aren't in your PATH environment variables.
# [http://www.cygwin.com/ Cygwin]
#* When you run the cygwin setup utility make sure you have selected to install '''patchutils''', '''flex''', '''bison''' (all located under "devel"), '''curl''' (under "Web"), and '''unzip''' (under "Archives"), which are not part of the default install. Do not install Cygwin Python or Mercurial.  You won't need to use the Cygwin shell for anything; just have the binaries accessible to the regular command line via your PATH.
# Python (either [http://www.python.org/download/ Standard Python] or [http://www.activestate.com/activepython/downloads ActivePython])
#* Note: Version 2.7.1 has been reported to work with the build scripts.
# Mercurial (either [http://tortoisehg.bitbucket.org/ TortoiseHg] or [http://mercurial.selenic.com/ Mercurial Hg])
 
=== Install optional development tools ===
 
# [http://code.google.com/p/unsis/downloads/list Unicode NSIS (Nullsoft Scriptable Install System)]
#* This is the package installer used to build <code>Second_Life_<version-code>_LindenDeveloper_Setup.exe</code>. You only need this package if you are going to distribute the viewer you compile or if you want to install it locally.
#: In the [[#Configuring_the_Viewer|Configure VS2010 step]] below you will need to add a line in the '''Executable Directories''' section:
#:* 64 bit systems use <code>%ProgramFiles(x86)%\NSIS\Unicode</code>
#:* 32 bit systems use <code>%ProgramFiles%\NSIS\Unicode</code>
# [http://notepadplusplus.org/ Notepad++]
#* You need to use an editor that conforms to the [[Coding Standard]]. In particular, you must not check in files with DOS line endings except in very limited circumstances; see [[How to avoid DOS line endings in Windows tools]].
 
=== Install Autobuild ===
* Install [[Autobuild]]
* Modify your path statement to include the autobuild <code>\bin</code> directory
 
=== Configure VS2010 ===
While you may choose to use autobuild for all your compiling you still need to establish certain settings internal to VS2010.
 
*Start the IDE
 
*Navigate to '''Tools''' > '''Options''' > '''Projects and Solutions''' > '''Build and Run''' and set '''maximum number of parallel projects builds''' to <code>1</code>.
 
*Check '''Tools''' > '''Settings''' > '''Expert Settings'''.
 
You need to set a number of paths.
 
{{KBnote|The following steps require an open visual studio project.  It does not matter which project you use, as you will only change some global settings used by all projects when they are opened.  The open project itself won't be changed.}}
* Open any existing project you may have or make a New Project.
 
At the bottom on the Solution Explorer you will see three tabs.
*Click the one on the right labeled '''Property Manager'''. (The name may be somewhat truncated.)
 
[[File:VS2010_Property_Manager.PNG|100px]]
[[:File:VS2010_Property_Manager.PNG|Example image]]
 
*On the left side click to expand any project and then click again to expand the '''Release''' folder.
 
[[File:VS2010_Project_Config.PNG|100px]]
[[:File:VS2010_Project_Config.PNG|Example image]]
 
*Right click on '''Microsoft.Cpp.Win32.user'''.
 
*Pick '''Properties''' > '''VC++ Directories'''.
 
This is where the build environment is pulled together into a functional VC2010 build system and also where much hand wringing, hair pulling, and fist pounding frustration takes place.
 
*Set '''Executable Directories''' to:
 
$(ExecutablePath)
$(DXSDK_DIR)
$(WindowsSdkDir)\Bin
C:\cygwin\bin
$(SystemRoot)
 
[[File:32BitExecutableDirectories.png|100px]]
[[:File:32BitExecutableDirectories.png|32 bit Executable Directories example image]]
 
*Set '''Include Directories''' to:
 
$(WindowsSdkDir)\Include
$(WindowsSdkDir)\Include\gl
$(DXSDK_DIR)\Include
 
[[File:32BitIncludeDirectories.png|100px]]
[[:File:32BitIncludeDirectories.png|32 bit Include Directories example image]]
 
*Set '''Library Directories''' to:
 
$(WindowsSdkDir)\Lib
$(DXSDK_DIR)
 
[[File:32BitLibraryDirectories.png|100px]]
[[:File:32BitLibraryDirectories.png|32 bit Library Directories example image]]
 
== Set up your source code tree ==
 
Plan your directory structure ahead of time.  If you are going to be producing changes or patches you will be cloning a copy of an unaltered source code tree for every change or patch you make, so you might want to have all this work stored in it's own directory.
 
To get a copy of the source code tree:
* Open up a DOS/Command window
* Make a directory to contain your build tree (it is strongly suggested to name it <code>viewer-development</code>).  Do not have any spaces in this path.
* Go into that directory
* Do <code>hg init</code>
* Do <code>hg pull <nowiki>http://hg.secondlife.com/viewer-development</nowiki></code>
 
Let's say some time has gone by since you have performed the previous steps and now you want to develop a change or work on a jira.  You will:
* Go into <code>viewer-development</code> (or whatever you named the master source tree copy)
* Do <code>hg pull</code>
* Do <code>hg update</code>
* Move up one level from <code>viewer-development</code>
* Do <code>hg clone viewer-development VWR-nnnnn</code> (where <code>nnnnn</code> is the jira number, or clone to a name of your choosing if there is not jira number)
 
== Prepare third party libraries ==
Most third party libraries needed to build the viewer will be automatically downloaded for you and installed into the build directory within your source tree during the [[#Configuring_the_Viewer|configuration step]] below. Some few need to be manually set up, though, when using an open source developer configuration (<code>Release'''OS'''</code>, <code>RelWithDebInfo'''OS'''</code> or <code>Debug'''OS'''</code>)
{{KBnote|If you are a Linden Lab employee or otherwise have legitimate access to s3-proxy.lindenlab.com, ''all'' third party libraries should be automatically downloaded and installed for you, so you may ignore this section completely. (In that case, make sure to use one of the LL-internal configurations, i.e. one without the <code>OS</code>-suffix in its name.)}}
 
=== Fmod method 1 (using autobuild) ===
 
Create a directory for the 3p-fmod repository and clone it:
hg clone https://bitbucket.org/lindenlab/3p-fmod
 
CD into the <code>3p-fmod</code> directory you created and build it:
autobuild build --all
 
Package the results:
autobuild package
 
Now update autobuild with the filename and hash just displayed.
 
CD to the directory where you cloned viewer-development
 
copy <code>autobuild.xml</code> to <code>my_autobuild.xml</code>
 
Do:
set AUTOBUILD_CONFIG_FILE=my_autobuild.xml
autobuild installables edit fmod platform=windows hash=<hash> url=file:///<fmod-filespec>
 
Example:
autobuild installables edit fmod platform=windows hash=0f196f00e7dff49f22252efb68525658 url=file:///C:/3p-fmod/fmod-3.75-windows-20110531.tar.bz2
 
{{KBnote|Having to copy <code>autobuild.xml</code> and modify the copy from within a cloned repository is a lot of work for every repository you make, but this is the only way to guarantee you pick up upstream changes to <code>autobuild.xml</code> and do not send up a modified <code>autobuild.xml</code> when you do an hg push.}}
 
=== Fmod method 2 (using switches) ===
[To be written up]
 
== Configuring the Viewer ==
 
If you are compiling with Fmod you will need to do:
set AUTOBUILD_CONFIG_FILE=my_autobuild.xml
 
At the command line in the source tree's root directory (presumably a directory you have cloned from viewer-development, as it is not a good idea to work in viewer-development, unless you are only compiling for youself) e.g. <code>C:\linden\VWR-12345\</code>) run:
autobuild configure -c [CONFIGURATION]
where <code>[CONFIGURATION]</code> is one of those listed at [[Building the Viewer with Autobuild#Build a desired configuration]] (<code>ReleaseOS</code>, <code>RelWithDebInfoOS</code>, <code>DebugOS</code>)
 
== Compiling the Viewer ==
=== Compiling the viewer with autobuild ===
You can compile the viewer with either autobuild (the encouraged/supported method) or with the VS IDE.
 
When compiling with autobuild you will have the best chance of success if you:
*Navigate into the VS2010 program menu
*Click on '''Visual Studio Command Prompt (2010)'''
 
{{KBcaution|If you are building with Fmod and have followed the previous Fmod setup instructions AND you are now using a new command window you will need to redo the <code>set AUTOBUILD_CONFIG_FILE{{=}}my_autobuild.xml</code>.}}
 
*Run:
autobuild build -c [CONFIGURATION] --no-configure
 
There are some useful switches to know about, so your commands may look like this:
autobuild configure -c ReleaseOS -- -DLL_TESTS:BOOL=OFF -DPACKAGE:BOOL=OFF -DFMOD:BOOL=TRUE
autobuild build -c ReleaseOS --no-configure
 
{{KBnote|It is possible to use autobuild to do both the configure step (only needed once) and the build step with one command.  I find it is clearer and saves a bit of time if these steps are done separately.}}
 
=== Compiling the viewer with the IDE ===
 
The autobuild configure step created the <code>\build-vc100</code> directory at the root of the source tree.  In here is the <code>SecondLife.sln</code> solution file.
 
Start the IDE and open this solution.
 
You need to adjust the Platform Toolset setting.
* Select all the projects in the Solution Explorer list on the left of the screen.
** Click on the first project and scroll to the bottom of this list and {{K|shift}}-click on the last project.
* Right click on the selected list
* Navigate to '''Properties''' > '''Configuration Properties''' > '''General''' > '''Platform Toolset'''
* Change this value to <code>Windows7.1SDK</code>
 
You might want to change the build type in the drop-down from '''Debug''' to '''Release''' or '''RelWithDebInfo'''.
 
Push {{K|F7}} to start the compiler.
 
== Running your newly built viewer ==
*Make a shortcut for <code>Drive:\your-path\build-vc100\newview\Release\secondlife-bin.exe</code>
 
* Right-click the shortcut, Properties, and set "Start in:" to <code>Drive:\your-path\indra\newview</code>
 
== Handling Problems ==
 
If you encounter errors or run into problems following the instructions above, please first check whether someone else already had the same issue. A solution might be known already. See the [[#Common_Issues.2FBugs.2FGlitches_And_Solutions|issue list below]], check [[{{TALKPAGENAME}}|the talk page]] (and report useful experiences there) and search our [[issue tracker]]. Even when no description of your problem has been written down yet, someone might know about it, so get in touch with the community to [[#Getting_help|get help]].
 
=== Getting help ===
* Subscribe to [[OpenSource-Dev|OpenSource-Dev Mailing List]] ([https://lists.secondlife.com/cgi-bin/mailman/listinfo/opensource-dev subscribe]) and post your question there.
* For faster response, find a free IRC client program and join [irc://irc.freenode.org/opensl #opensl on freenode], the general open source viewer discussion and development channel.  Hopefully a helpful person is online when you ask your question.
 
=== Common Issues/Bugs/Glitches And Solutions ===
 
==== Not being able to find objidl.h in the Microsoft Windows SDK, when compiling llwindow ====
https://lists.secondlife.com/pipermail/opensource-dev/2011-April/006562.html
* Can be caused by path problems or some installation conflicts with the DirectX SDK.
 
==== stdint.h typedef conflicts between Quicktime and VS2010 ====
https://lists.secondlife.com/pipermail/opensource-dev/2011-April/006565.html
*: Can be solved by some small edits to header files to make sure the two don't bash on each other.
 
==== Eliminate depreciated switches messages and use memory more efficiently ====
 
The VS2010 compiler uses a lot of memory while compiling the viewer.  If you run out of memory you will start to page heavily and your compile time will become much longer.  The /Zm1000 switch affects compiler memory usage.
 
You may see this message while compiling
use 'EHsc' instead of 'GX'
 
Here is how to free up some memory the compiler allocates and to eliminate these messages:
 
*Edit <code>\CMake 2.8\share\cmake-2.8\Modules\Platform\Windows-cl.cmake</code>
 
*Replace line 156 with:
  IF(MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /EHsc /GR")
  ELSEIF(NOT MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR")
  ENDIF(MSVC10)
 
*Replace line 172 with: 
  IF(MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /EHsc /GR")
  ELSEIF(NOT MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
  ENDIF(MSVC10)
 
*Replace line 184 with :
  IF(MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /EHsc /GR")
  ELSEIF(NOT MSVC10)
    SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
  ENDIF(MSVC10)
 
== References ==
 
Tip of the hat to Nicky_Perian for [[User:Nicky_Perian/Visual_Studio_10_Autobuild]]
 
[[Category:Compiling viewer]]

Latest revision as of 11:26, 23 April 2015