Difference between revisions of "Viewer 2 Microsoft Windows Builds"

From Second Life Wiki
Jump to navigation Jump to search
Line 31: Line 31:
#*:Note: Version 2.7.1 has been reported to work with the build scripts.
#*: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])
#*Mercurial (either [http://tortoisehg.bitbucket.org/ TortoiseHg] or [http://mercurial.selenic.com/ Mercurial Hg])
#*To deal with fmod, you will need [http://www.7-zip.org/download.html/ 7zip] and [http://www.pc-tools.net/win32/md5sums/ md5sums] (if you don't already have these, or equivalents)
#*[http://gnuwin32.sourceforge.net/downlinks/unzip.php Unzip]
#*''(optional)'' [http://notepadplusplus.org/ Notepad++]
#*''(optional)'' [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]].
#*: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]].

Revision as of 05:36, 31 May 2011

KBwarning.png 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.png Note: 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, but only needs to be done once.

  1. Install Visual Studio 2010 (Express is OK)
    Click here to download Visual C++ Express - current version is VS2010
  2. Run 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 to go to update.microsoft.com and not update.windows.com that is the default update service for XP.
  3. Install Windows SDK for Windows 7 and .NET Framework 4 (ISO) or Windows SDK for Windows 7 and .NET Framework 4 (Web Install)
    • Note: You may need to install the .net 4 framework first found on Microsoft Update or here: Web install and Full install.
  4. Install DirectX SDK (June 2010)
  5. Install other development tools
    • Unicode NSIS (Nullsoft Scriptable Install System)
      This is the package installer used to build Setup.exe.
    • 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.
    • Cygwin
      When you run the cygwin setup utility make sure you have selected to install unzip (under "Archive"), patchutils, flex, bison (all located under "devel"), and curl (under "Web") 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 Standard Python or ActivePython)
      Note: Version 2.7.1 has been reported to work with the build scripts.
    • Mercurial (either TortoiseHg or Mercurial Hg)
    • Unzip
    • (optional) 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.
KBnote.png Note: If the installer for a particular package does not update your PATH environment setting you will have to do this manually.


  • Needed modifications to CMake to correct improper flag usage (until this is corrected by the makers of CMake). These changes will also help keep CMake backwards compatible for those who are still working on older code base viewers (non-VS2010 build). (Added by WolfPup Lowenhar 17:56, 26 May 2011 (PDT))
 Edit Windows-cl.cmake and change the following:
 (this is file is located in 32-bit > C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\Platform
                             64bit> C:\Program Files(x86)\CMake 2.8\share\cmake-2.8\Modules\Platform )
 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 /GX /GR")
 ELSEIF(NOT MSVC10)
   SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
 ENDIF(MSVC10)
 
 replce line 184 with :
 
 IF(MSVC10)
   SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /GX /GR")
 ELSEIF(NOT MSVC10)
   SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
 ENDIF(MSVC10)

Configure VS2010

Instructions needed here to set up internal paths

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 viewer-development). Do not have any spaces in this path.
  • Go into that directory
  • Do hg init
  • Do hg pull http://hg.secondlife.com/viewer-development
  • Example: ((specific snapshot example TBD))

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 viewer-development (or whatever you named the master source tree copy)
  • Do hg pull
  • Do hg update
  • Move up one level from viewer-development
  • Do hg clone viewer-development VWR-nnnnn (where nnnnn is the jira number, or clone to a name of your choosing if there is not jira number)

Set up Autobuild

  • Install Autobuild
  • Modify your path statement to include the autobuild bin directory

Instructions for setting up Fmod

--Eamon Mayo 16:51, 30 May 2011 (PDT)

Due to licensing issues, Linden cannot distribute the fmod code needed to make sound work. The good news is that you can obtain it yourself (legally), and with a bit of machination, make it a working part of your build.

  1. Download & extract FMOD3.75 API for Windows (http://www.fmod.org/files/fmod3/fmodapi375win.zip)
  2. Now using 7zip or equivalent, re-zip the fmodapi375win folder first into a tar file, and then the tar file into a bz2 file (by invoking 7zip twice)
  3. Create a top level directory, e.g., C:\FMOD, and drop fmodapi375win.tar.bz2 there.
  4. Compute the md5 hash of the fmodapi375win.tar.bz2 file using md5sums. Note, the hash is case sensitive, so, for example, the value computed by HashTab is mathematically correct but won't work because of capitalization).
  5. Modify autobuild.xml, as follows:

Replace:

         <key>hash</key>
              <string>d9a9a6ad86895353bcd63374a4c1a91d</string>
        <key>url</key>
              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-fmod-private/rev/221852/arch/CYGWIN/installer/fmod-3.75-windows-20110222.tar.bz2</string>

With:

         <key>hash</key>
             <string>4219e57263975ebceabdf9eefc1a79b1</string>         [NOTE: Insert your hash value here]
         <key>url</key>
             <string>file:///FMOD/fmodapi375win.tar.bz2</string>       [NOTE: Insert your directory name here; this example assumes C:\FMOD]

Configuring and compiling the viewer

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. C:\linden\VWR-12345\) run:

autobuild configure -c [CONFIGURATION]

where [CONFIGURATION] is one of those listed at Building the Viewer with Autobuild#Build a desired configuration (ReleaseOS, RelWithDebInfoOS, DebugOS)

Then 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
autobuild build -c ReleaseOS --no-configure
KBnote.png Note: 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 using the VS C++ Express IDE

--Eamon Mayo 17:26, 30 May 2011 (PDT)

The autobuild configure step will create the build-vc100 directory at the root of the source tree which contains the SecondLife.sln solution file. The solution is fully configured and (almost) ready to be built inside the IDE. Proceed as follows:

  1. From build-vc100\packages\fmodapi375win\api\inc\, copy fmod.h and fmod_errors.h to build-vc100\packages\include.
  2. Go to the build-vc100 directory, and open the SecondLife.sln file. It will take a bit of time preparing itself; wait for this to complete.
  3. Right-click on Build-All and select Build. This process will take a while, and will ultimately fail, but several needed directories will be created and populated (almost).
  4. Copy needed files to the appropriate directories, as follows:
    • From build-vc100\packages\fmodapi375win\api\lib\, copy fmodvc.lib to build-vc100\packages\release\ and build-vc100\packages\debug\, and rename fmodvc.lib to fmod.lib in each location.
    • From build-vc100\packages\fmodapi375win\api\, copy fmod.dll to build-vc100\packages\release\ and build-vc100\packages\debug\
    • From C:\Windows\System32\, copy msvcr100.dll and msvcp100.dll to build-vc100\sharedlibs\Release\
    • From C:\Windows\System32\, copy msvcr100d.dll and msvcp100d.dll to build-vc100\sharedlibs\Debug\

(No doubt there is a more elegant way to have the msvc* files included directly, but this way is easy, and legal, since Microsoft has made these dlls explicitly redistributable.)

  1. Now Right-click on Build-All and select Build again. This time you should only have one error related to SecondLife.sln (an artifact of VS C++ Express that we can safely ignore).
  2. Now at the top of the VS window, select Release instead of Debug, and rebuild. You should now have working Debug and Release versions that can be installed anywhere. These live in build-vc100\newview\Release and build-vc100\newview\Debug. For example, if you copy the contents of newview\release to another machine, SL will run from that directory, or you can actually install it by running the included Second_Life_2-6-3-0_LindenDeveloper_Setup.exe.

Iteratively fix things until the compile succeeds

If you encounter errors during building or configuration, check the talk page and report useful experiences there.

Running your newly built viewer

  • Make a shortcut for Drive:\your-path\build-vc100\newview\Release\secondlife-bin.exe
  • Right-click the shortcut, Properties, and set "Start in:" to Drive:\your-path\indra\newview

Common Issues/Bugs/Glitches And Solutions

  • Getting help:
    • Subscribe to OpenSource-Dev Mailing List (subscribe) and post your question there.
    • For faster response, find a free IRC client program and join #opensl on freenode, the general open source viewer discussion and development channel. Hopefully a helpful person is online when you ask your question.

References