Build the Viewer on Linux: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Some better formatting.
Leviathan Linden (talk | contribs)
Update requirements list.
 
(458 intermediate revisions by 66 users not shown)
Line 1: Line 1:
{{Multi-lang}}
{{CompileNav}}
{{CompileNav}}
{{TOC}}


These are raw notes. Will prettify them later.
==Step 0. Review BUILD.LINUX.md==
Paths and package names are based on Ubuntu 6.06.
There is a [https://github.com/secondlife/viewer/blob/develop-linux/doc/BUILD.LINUX.md BUILD.LINUX.md] markdown file in the active '''develop-linux''' branch (see '''Step 2''') which will eventually become the primary documentation for building the SL viewer on Linux. In the meantime the instructions below may also be helpful.


* install scons [scons]
==Step 1. Install Requirements==
* install boost [libboost-dev]
* install boost-regex [libboost-regex-dev]
* install apr-1 [libapr1.0-dev]
* install aprutil-1 [libaprutil1.0-dev]
* install xmlrpc-epi 0.51 <http://xmlrpc-epi.sourceforge.net/>
** note: not xmlrpc-c
* install jpeglib [libjpeg62-dev]
* install SDL [libsdl1.2-dev]
* install Vorbis [libvorbis-dev]
* install libgtk2 [libgtk2.0-dev]
* unpack FMOD 3 <http://www.fmod.org/>
* build ELFIO <http://sourceforge.net/projects/elfio/>
* build OpenJPEG <http://www.openjpeg.org/>


<code>
* Python 3.7+
$ cp -a /usr/include/apr-1.0/ ${SLSRC}/libraries/i686-linux/include/apr-1
* [https://git-scm.com/downloads Git]
* [https://cmake.org/download/ CMake] 3.20+ (need to be able to handle <code>--config</code> option)
* Native packages and tools (this list may be incomplete, please update as new dependencies are discovered):
  libfontconfig-dev libglib2.0-dev libglvnd-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libosmesa6-dev libvlc-dev libwayland-dev libx11-dev ninja-build python3-venv
* [[Autobuild]] (probably best installed in a [https://docs.python.org/3/library/venv.html virtual environment])


$ mkdir ${SLSRC}/libraries/i686-linux/include/expat
===Intermediate Check===
$ cp -a /usr/include/expat*.h ${SLSRC}/libraries/i686-linux/include/expat


  $ mkdir ${SLSRC}/libraries/i686-linux/include/zlib
Confirm things are installed properly so far by typing the following in a terminal:
  $ cp -a /usr/include/zlib*.h ${SLSRC}/libraries/i686-linux/include/zlib/
cmake --version
python3 --version
  git --version
  autobuild --version


$ mkdir ${SLSRC}/libraries/i686-linux/include/openjpeg
If everything reported sensible values and not "Command not found" errors, then you are in good shape!
$ cp ${OPENJPEG}/libopenjpeg/openjpeg.h ${SLSRC}/libraries/i686-linux/include/openjpeg/
$ cp ${OPENJPEG}/libopenjpeg.a ${SLSRC}/libraries/i686-linux/lib_release_client/


$ cp ${FMOD}/api/inc/* ${SLSRC}/libraries/i686-linux/include/
==Step 2. Checkout Code==
$ cp ${FMOD}/api/libfmod-3.75.so ${SLSRC}/libraries/i686-linux/lib_release_client/


$ mkdir ${SLSRC}/libraries/i686-linux/include/ELFIO
===Viewer===
$ 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
Open a terminal and checkout the viewer source code:
  $ cp -a /usr/include/j*.h ${SLSRC}/libraries/i686-linux/include/jpeglib/
  git clone https://github.com/secondlife/viewer.git
$ touch ${SLSRC}/libraries/i686-linux/include/jpeglib/jinclude.h


$ mkdir ${SLSRC}/libraries/i686-linux/include/llfreetype2
Until it is merged into the '''develop''' branch you need to checkout '''develop-linux''':
  $ cp -a /usr/include/freetype2/freetype/ ${SLSRC}/libraries/i686-linux/include/llfreetype2/
  cd viewer
  $ cp -a /usr/include/ft2build.h ${SLSRC}/libraries/i686-linux/include/llfreetype2/freetype/
  git checkout develop-linux


$ cp -a /usr/include/atk-1.0 ${SLSRC}/libraries/i686-linux/include/
===Build Variables===
$ 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:
See [[Building the Viewer with Autobuild#Select Build Variables]]
$ cp -a /usr/include/cairo/* ${SLSRC}/libraries/i686-linux/include/
</code>
------------------------


BUILDING
==Step 3. Configure==


<code>
Be sure you have the following environment variables set before continuing:
$ cd indra
$ scons DISTCC=no BTARGET=client BUILD=release
</code>
* resulting unstripped binary is then newview/secondlife-i686-bin


------------------------
AUTOBUILD_ADDRSIZE=64
AUTOBUILD_VARIABLES_FILE=<path to autobuild viewer variables>


RUNNING FROM INSIDE THE TREE
Configuring and building with '''autobuild''' works the same on all platforms.  Full instructions may be found at [[Build_Viewer_With_Autobuild]].


* preparing to run 'in-tree'
autobuild configure -c RelWithDebInfoOS
** ensure you have indra/newview/app_settings/static_*.db2 - if not, you'll find it in the 'binary-common' package.
<code>
$ cp ../../scripts/messages/message_template.msg app_settings/
</code>


* running it!
==Step 4. Build==
<code>
$ ( cd newview && LD_LIBRARY_PATH=../../libraries/i686-linux/lib_release_client:${LD_LIBRARY_PATH}:/usr/local/lib  ./secondlife-i686-bin )
</code>
------------------------


PACKAGING
autobuild build


Doesn't work 'out of the box' as an automated process right now.
===Running your newly built viewer===


==Step 5. Run==


=== OLD Ubuntu build notes - may be incorrect ===
To launch the '''viewer''' you built, from your source tree root directory, run:


Ubuntu 5.10 and higher uses a newer version of libc6 with a bug fix that breaks our codebase.
  build-linux-x86_64/newview/packaged/secondlife
If you see errors of the form:
 
<code>
==Step 6. Optional==
    obj_dat.c:(.text+0x857): undefined reference to `__ctype_b'
 
</code>
===Running Unit Tests===
...when you try to build our codebase then you need to enable the CTYPE_WORKAROUND.  If you use 'make' or 'dmake', add the
 
following lines to your ~/.bashrc file:
TODO: provide instructions for running unit tests.
<code>
 
    export SIMULATOR_CPPFLAGS="-DCTYPE_WORKAROUND"
===Optional: Installing Proprietary Libraries===
    export RPCSERVER_CPPFLAGS="-DCTYPE_WORKAROUND"
 
    export DATASERVER_CPPFLAGS="-DCTYPE_WORKAROUND"
Some builds of the the Viewer depends on proprietary libraries (alternative open source libraries are also provided for developers who prefer or are not licensed to use the proprietary libraries). Lindens do not distribute these libraries, so you will need to fetch and install these even if you download the libraries packages.  (This is due to licensing restrictions.  Don't ask, Lindens already did, and can't get permissionSo you do have to get them yourself.)
    export USERSERVER_CPPFLAGS="-DCTYPE_WORKAROUND"
 
    export TEST_CPPFLAGS="-DCTYPE_WORKAROUND"
TODO: provide instructions for building proprietary libraries.
</code>
 
If you use 'scons', add the follow line to your ~/.bashrc file:
==Handling Problems==
<code>
 
    export SERVER_CPPFLAGS="-DCTYPE_WORKAROUND"
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.
</code>
 
Source your ~/.bashrc, or open a new terminal, and build again.
You may find the solution in any of these resources:
* [[{{TALKPAGENAME}}|This talk page]] (Report useful experiences there)
* [[#Common_Issues.2FBugs.2FGlitches_And_Solutions|Issue list below]] (If new issues, please add it to talk page above instead of there)
* [[Talk:Microsoft_Windows_Builds|Old talk page]]
* [[Common compilation problems]] (Rather old)
* [[Issue tracker]]
 
* Fix it: [[Modifying CMake Files‎]] and please, submit a patch!
 
===Getting Help===
 
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 get 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.
 
----
[[Category:Compiling viewer]]

Latest revision as of 09:37, 5 January 2026

Step 0. Review BUILD.LINUX.md

There is a BUILD.LINUX.md markdown file in the active develop-linux branch (see Step 2) which will eventually become the primary documentation for building the SL viewer on Linux. In the meantime the instructions below may also be helpful.

Step 1. Install Requirements

  • Python 3.7+
  • Git
  • CMake 3.20+ (need to be able to handle --config option)
  • Native packages and tools (this list may be incomplete, please update as new dependencies are discovered):
 libfontconfig-dev libglib2.0-dev libglvnd-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libosmesa6-dev libvlc-dev libwayland-dev libx11-dev ninja-build python3-venv

Intermediate Check

Confirm things are installed properly so far by typing the following in a terminal:

cmake --version
python3 --version
git --version
autobuild --version

If everything reported sensible values and not "Command not found" errors, then you are in good shape!

Step 2. Checkout Code

Viewer

Open a terminal and checkout the viewer source code:

git clone https://github.com/secondlife/viewer.git

Until it is merged into the develop branch you need to checkout develop-linux:

cd viewer
git checkout develop-linux

Build Variables

See Building the Viewer with Autobuild#Select Build Variables

Step 3. Configure

Be sure you have the following environment variables set before continuing:

AUTOBUILD_ADDRSIZE=64
AUTOBUILD_VARIABLES_FILE=<path to autobuild viewer variables>

Configuring and building with autobuild works the same on all platforms. Full instructions may be found at Build_Viewer_With_Autobuild.

autobuild configure -c RelWithDebInfoOS

Step 4. Build

autobuild build

Running your newly built viewer

Step 5. Run

To launch the viewer you built, from your source tree root directory, run:

 build-linux-x86_64/newview/packaged/secondlife

Step 6. Optional

Running Unit Tests

TODO: provide instructions for running unit tests.

Optional: Installing Proprietary Libraries

Some builds of the the Viewer depends on proprietary libraries (alternative open source libraries are also provided for developers who prefer or are not licensed to use the proprietary libraries). Lindens do not distribute these libraries, so you will need to fetch and install these even if you download the libraries packages. (This is due to licensing restrictions. Don't ask, Lindens already did, and can't get permission. So you do have to get them yourself.)

TODO: provide instructions for building proprietary libraries.

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.

You may find the solution in any of these resources:

Getting Help

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 get help.