Difference between revisions of "Build the Viewer on Linux"

From Second Life Wiki
Jump to navigation Jump to search
Line 104: Line 104:
== Packaging the client ==
== Packaging the client ==


This is automatically done as the final step of a 'BUILD=releasefordownload' build as recommended in the 'Compiling' section above; the pristine runtime image now lives in the directory newview/SecondLife_i686_1_X_Y_Z/ and has also been tarred into newview/SecondLife_i686_1_X_Y_Z.tar.bz2
If you substitute 'BUILD=release' with 'BUILD=releasefordownload' in the 'Compiling' section above, then packaging the resulting code, libraries, data and documentation into a tarball for the end-user will be done automatically as the final stage of the build process; the pristine runtime image now lives in the directory newview/SecondLife_i686_1_X_Y_Z/ and has also been tarred into newview/SecondLife_i686_1_X_Y_Z.tar.bz2


The final packaging step may fail if you are not using the <i>slviewer-linux-libs</i> bundle; in this case, if you still wish to end up with an end-user viewer 'package' constructed from your own libraries, you can edit the manifest file found at linux_tools/client-manifest-i686
The final packaging step may fail if you are not using the <i>slviewer-linux-libs</i> bundle; in this case, if you still wish to end up with an end-user viewer 'package' constructed from your own libraries, you can edit the manifest file found at linux_tools/client-manifest-i686

Revision as of 10:49, 29 December 2006

The following are instructions for building the Second Life viewer on linux. This process has only been used on debian and debian based systems like ubuntu. For other platforms, see compiling the viewer.

Installing the required dependancies

The Second Life Viewer has a number of compile/link dependancies on external libraries which need to be put in place first. The Second Life Viewer is not a trivial build, and experience with building large software packages will help you greatly - but don't be daunted, it should be simple once the dependancies are in the right place the first time.

Paths and package names given here are based on Ubuntu 6.06 and may vary according to your Linux distribution.

Fixme - these instructions assume that you don't want to use the 'slviewer-linux-libs' collection of pre-built libraries and headers. I still need to mark the bits which are avoidable if you do.

Prerequisites

  • You will need the SCons build tool [package: scons] and the GCC 3.4 C/C++ compiler [package: g++-3.4]; other GCC versions are not well-tested.
  • You may either use our easy slviewer-linux-libs bundle of pre-built libraries and headers unpacked into the Second Life Viewer source tree, or (for example if you are porting to a new architecture or wish to make a package tailored to your Linux distribution's own libraries) you will have to install the following additional dependancies:

Copy headers and libraries into the source tree

Here is a guide to the sequence of shell commands needed to copy the required headers and libraries into the Second Life Viewer source tree for building. Actual paths to system headers may vary according to Linux distribution.

  • ${SLSRC} refers to the top-level directory of the Second Life Viewer source tree.
  • ${FMOD} refers to the top-level directory into which you unpacked FMOD 3.

##ALWAYS## cp ${FMOD}/api/inc/* ${SLSRC}/libraries/i686-linux/include/
##ALWAYS## cp ${FMOD}/api/libfmod-3.75.so ${SLSRC}/libraries/i686-linux/lib_release_client/

If you are using our easy slviewer-libs-linux bundle then you can skip the rest of this section, otherwise you will also need to perform the following:

  • ${OPENJPEG} refers to the top-level directory of your completed OpenJPEG build.
  • ${ELFIO} refers to the top-level directory of your completed ELFIO build.

cp -a /usr/include/apr-1.0/ ${SLSRC}/libraries/i686-linux/include/apr-1
mkdir ${SLSRC}/libraries/i686-linux/include/expat
cp -a /usr/include/expat*.h ${SLSRC}/libraries/i686-linux/include/expat/
mkdir ${SLSRC}/libraries/i686-linux/include/zlib
cp -a /usr/include/zlib*.h ${SLSRC}/libraries/i686-linux/include/zlib/
mkdir ${SLSRC}/libraries/i686-linux/include/openjpeg
cp ${OPENJPEG}/libopenjpeg/openjpeg.h ${SLSRC}/libraries/i686-linux/include/openjpeg/
cp ${OPENJPEG}/libopenjpeg.a ${SLSRC}/libraries/i686-linux/lib_release_client/
mkdir ${SLSRC}/libraries/i686-linux/include/ELFIO
cp ${ELFIO}/ELFIO/*.h ${SLSRC}/libraries/i686-linux/include/ELFIO/
cp ${ELFIO}/ELFIO/libelfio.so ${SLSRC}/libraries/i686-linux/lib_release_client/
mkdir ${SLSRC}/libraries/i686-linux/include/jpeglib
cp -a /usr/include/j*.h ${SLSRC}/libraries/i686-linux/include/jpeglib/
touch ${SLSRC}/libraries/i686-linux/include/jpeglib/jinclude.h
mkdir ${SLSRC}/libraries/i686-linux/include/llfreetype2
cp -a /usr/include/freetype2/freetype/ ${SLSRC}/libraries/i686-linux/include/llfreetype2/
cp -a /usr/include/ft2build.h ${SLSRC}/libraries/i686-linux/include/llfreetype2/freetype/
cp -a /usr/include/atk-1.0 ${SLSRC}/libraries/i686-linux/include/
cp -a /usr/include/gtk-2.0 ${SLSRC}/libraries/i686-linux/include/
cp -a /usr/lib/gtk-2.0/include/* ${SLSRC}/libraries/i686-linux/include/gtk-2.0/
cp -a /usr/include/glib-2.0 ${SLSRC}/libraries/i686-linux/include/
cp -a /usr/lib/glib-2.0/include/* ${SLSRC}/libraries/i686-linux/include/glib-2.0/
cp -a /usr/include/pango-1.0 ${SLSRC}/libraries/i686-linux/include/

if your GTK is fairly recent and thus needs Cairo:

cp -a /usr/include/cairo/* ${SLSRC}/libraries/i686-linux/include/

Compiling

$ cd indra
$ scons DISTCC=no BTARGET=client BUILD=release

Expect a build time of a couple of hours. The resulting unstripped Second Life Viewer binary is newview/secondlife-i686-bin

Testing the result from inside the tree

  • Preparing to run 'in-tree'
    • ensure that you have indra/newview/app_settings/static_*.db2 - if not, you'll find it in the 'slviewer-linux-libs' download.
    • now, from the indra directory:

$ cp ../scripts/messages/message_template.msg newview/app_settings/

  • Running it! The LD_LIBRARY_PATH stuff ensures that the binary looks for its libraries in the right places. From the indra directory:

$ ( cd newview && LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib  ./secondlife-i686-bin )

Packaging the client

If you substitute 'BUILD=release' with 'BUILD=releasefordownload' in the 'Compiling' section above, then packaging the resulting code, libraries, data and documentation into a tarball for the end-user will be done automatically as the final stage of the build process; the pristine runtime image now lives in the directory newview/SecondLife_i686_1_X_Y_Z/ and has also been tarred into newview/SecondLife_i686_1_X_Y_Z.tar.bz2

The final packaging step may fail if you are not using the slviewer-linux-libs bundle; in this case, if you still wish to end up with an end-user viewer 'package' constructed from your own libraries, you can edit the manifest file found at linux_tools/client-manifest-i686