Difference between revisions of "Compiling the viewer libraries (MSVS 2003)"

From Second Life Wiki
Jump to navigation Jump to search
Line 15: Line 15:
** set PYTHON_ROOT=C:\Python23
** set PYTHON_ROOT=C:\Python23
** set PYTHON_VERSION=2.3
** set PYTHON_VERSION=2.3
** bjam --toolset=msvc-7.1 stage
** bjam --toolset=msvc-7.1 link=static 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.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_debug\libboost_python-vc71-mt.lib"
* copy "boost_X_XX_X\stage\lib\libboost_python-vc71-mt-gd.lib" to "\libraries\i686-win32\lib_debug\libboost_python-vc71-mt.lib"

Revision as of 03:05, 27 June 2008

This page supplements Compiling the viewer (MSVS2003).

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 openssl and zlib).

Boost

  • Download & extract Boost source for win32.
  • Copy the "boost_X_XX_X\boost" folder to "libraries\include\".

NOTE: the Boost Wiki says to use the Visual Studio command prompt instead of the regular command prompt.

  • Run "boost_X_XX_X\tools\jam\build_dist.bat".
  • Copy "boost_X_XX_X\tools\jam\src\bin.ntx86\bjam.exe" to "boost_X_XX_X\". [NOTE: found in stage directory, not src, in Boost 1.35.0]
  • Using the command prompt, build the static libraries:
    • cd boost_X_XX_X
    • set PYTHON_ROOT=C:\Python23
    • set PYTHON_VERSION=2.3
    • bjam --toolset=msvc-7.1 link=static 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_debug\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_debug\libboost_regex-vc71-mt-s.lib"

Expat

  • Download and run 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

  • Download & extract 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

  • Take out XML dependancies, move expat headers!!!!
  • Download & extract apr, apr-util, and apr-iconv.
  • For simplicity place all three in a parallel directory structure, and rename the directories: (NOTE: if you don't rename from apr-X.X.X to simply apr, you won't be able to open the aprutil.dsw solution.)
    • C:\work\apr\
    • C:\work\apr-iconv\
    • C:\work\apr-util\
  • Open the "\apr-util\aprutil.dsw" 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

  • Download and run 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".

OpenSSL

  • Download and extract: http://www.openssl.org/source/
  • Using the command prompt, build the static libraries:
    • cd %PATH%
    • perl Configure VC-WIN32
    • ms\do_masm
  • Edit openssl-X.X.Xy\ms\nt.mak
    • Change /MD to /MT in CFLAGS
  • back in the command prompt:
    • "C:\Program Files\Microsoft Visual Studio .net 2003\Common7\Tools\vsvars32.bat"
    • nmake -f ms\nt.mak
    • copy all the ".lib" files from "openssl-X.X.Xy\out32" to "libraries\i686-win32\lib_release"

cURL

  • Download & extract the curl source.
  • Edit "curl-X.XX.X\lib\Makefile.vc6"
    • Change OPENSSL_PATH to ../../../openssl-<version>
    • Change the ZLIB_PATH to ../../../zlib-<version>/src
    • Change RTLIB to /MT
    • Change RTLIBD to /MTd
  • 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

$ 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
  • Copy over the Visual Studio files:
$ cp ../src/xmlrpcepi.* .
  • Open the xmlrpcepi.sln file and build

Vorbis & Ogg

  • Download & extract libvorbis.
  • Download & extract 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 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

OpenJPEG

  • Download and extract 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 tut
  • Patch TUT to add test skipping.
  • 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.

Get our snapshot llmozlib from the source downloads page.

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 c:\mozilla directory to build in.
 c:
 cd \
 export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
 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 llmozlib build_mozilla 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 build_mozilla 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 llmozlib.sln.
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:
Header file (llmozlib.h) in libraries\include\
Static library (llmozlib.lib) (debug) in libraries\i686-win32\lib_debug\
Static library (llmozlib.lib) (release) in libraries\i686-win32\lib_release\
Runtime DLLs (debug) in libraries\i686-win32\lib_debug\
Runtime DLLs (release) in libraries\i686-win32\lib_release\
Runtime misc files (debug) in indra\newview\app_settings\mozilla_debug\
Runtime misc files (release) in indra\newview\app_settings\mozilla_release\