Linux Build Environment

From Catznip
Jump to navigation Jump to search

Instructions updated January 2016 for Catznip R10, source download step will not function till after the public release

The following instructions have been tested on both Ubuntu, Mint and Gentoo. You will need at least 1 GB of free disk space on your root partition for the build environment, and 5 GB in your home folder for the source code and compilation results, and at least 4GB of memory. We do not recommend you do this on removable / usb based storage.

Setting up the environment is relatively straight forward, compiling can take several hours depending on hardware.

Commands starting with a $ are to be run on the host, commands starting with (jessie)# are to be run inside the schroot. Don't type the $ or (trusty)#.

Installing Schroot & Debbootstrap

Debian / Ubuntu / Mint Host

Install schroot and debootstrap.

$ sudo apt-get install schroot debootstrap

Gentoo Host

Add some groups Debian expects and install schroot and debootstrap from portage. Where sudo is used in this guide, su to root then run the command omitting 'sudo'.

# groupadd crontab
# groupadd sudo
# groupadd staff
# emerge schroot debootstrap

Setup the Schroot

This guided uses a schroot to provide a static build environment that is separate from your running install, a Linux inside a Linux. Once set up this can be easily backed up and copied between machines.

Configure the schroot. Edit '/etc/schroot/schroot.conf' so it looks like the following, making sure to change YOUR_USER_NAME...

[jessie]
description=Debian Jessie
type=directory
directory=/schroot/jessie
users=YOUR_USER_NAME
groups=sbuild
root-groups=root
personality=linux32

Make some folders..

$ sudo mkdir /schroot
$ sudo mkdir /schroot/jessie

Ubuntu Trusty

We build using Debian Jessie, for fewer headaches you should too. There are other distributions you could use in your schroot, good luck!

$ sudo debootstrap  --arch i386 trusty /schroot/jessie tuhttp://ftp.debian.org/debian

Enter the new schroot..

$ sudo schroot -c jessie -u root

If you have done everything right to this point your prompt will change to look something like the following, ignore any 'failed to change directory' warnings.

(trusty)root@tetsuo:/home/trinity#

Install Build Environment

Next we install a load of things needed to build the viewer including Linden Lab's Autobuild.

(trusty)# apt-get update
(trusty)# apt-get install software-properties-common

This next bit is one long command, just copy and paste as provided, it will work fine.

(trusty)# apt-get install --install-recommends bison bzip2 cmake curl flex g++ m4 \
nano mercurial python python-dev python-pip libc6-dev libgl1-mesa-dev libglu1-mesa-dev \
libstdc++6 libxcursor-dev libX11-dev libxinerama-dev libxml2-dev libxrender-dev wget

Now Install Linden Lab's Autobuild system wide.

(trusty)#pip install 'hg+https://bitbucket.org/lindenlab/autobuild-1.0#egg=autobuild'

If all went to plan then you should be able to type #autobuild --version' and see the following.

(trusty)root@TETSUO:/home/trinity# autobuild --version
autobuild 1.0

We're done here. Exit the schroot.

(trusty)# exit

Setting up

When you switch into a schroot the host OS home folder is fully accessible, for simplicity that's where we're going to viewer source.

$ cd
$ mkdir ./SecondLife-Dev

Enter the schroot and fetch some source code (you could just as easily do this with tools installed on the host OS).

$ cd ~/SecondLife-Dev
$ schroot -c trusty

If you have done everything correct you should be presented with something like the following.

(trusty)trinity@tetsuo:~/SecondLife-Dev$

Unlike previous versions of this guide we do not need to update cmake.

Catznip Source

We do not release source code for a viewer until we have released it to the public.

(trusty)$ cd ~/SecondLife-Dev

Fetch the source from our bitbucket repository. This may take some time ...

(trusty)$ hg clone http://hg.catznip.com/Catznip-R10
(trusty)$ cd ~/SecondLife-Dev/Catznip-R10

Update the tip (if you were to build without doing this you will get the base Linden viewer).

(squeeze)$ hg update tip

Compiling the Viewer

Enter the Schroot (if you aren't already from the steps above).

$ cd ~/SecondLife-Dev
$ schroot -c trusty


Autobuild configure & build

Change to the source directory..

(trusty)$ cd ~/SecondLife-Dev/Catznip-R10

Run autobuild, setting the viewer channel to Catznip Homebrew will get you the homebrew branding, logos and start up screen when you're done (for R9 or later).

(trusty)$ autobuild configure -c ReleaseOS -- -DFMODEX:BOOL=OFF \
-DVIEWER_CHANNEL="\"Catznip Homebrew\"" -DGCC_DISABLE_FATAL_WARNINGS:BOOL=ON \
-DLL_TESTS:BOOL=OFF

There are a number of compilation options you are free to explore but that's beyond the scope of this document.

Compile the viewer .. depending on hardware this could take a significant amount of time (over an hour on an i5).

(trusty)$ autobuild build -c ReleaseOS --verbose

The build and all working files will be placed inside ~/SecondLife-Dev/Catznip-R12.2/build-linux-i686. This folder should be removed if you wish to run configure again or to save disk space on older source trees.

Running the Viewer

The completed viewer will be placed in ~/SecondLife-Dev/catznip-R12.2/build-linux-i686/newview and can be run in place without needing to install.

Exit from the schroot (or open a new terminal).

(trusty)$ exit

Change to the directory ...

$ cd ~/SecondLife-Dev/Catznip-R10/build-linux-i686/newview/packaged

.. and run. No installation or messing about required, menu entries will be created.

$ ./catznip

The viewer will have it's own configuration file ~/.catznip/user_settings/settings_homebrew.xml

Deep Notes

That's it, you have set up a build environment and built the viewer.

These instructions do not cover creating the FMOD / FMODEX packages so there will be no streaming audio. Instructions on how to create these packages yourself may follow ....

We are bound by the terms of the havok sub licence and as such can not provide libraries or instructions on how to build havok into the viewer. Mesh upload will not function and the pathfinding nav mesh will not be visible.

Configuration options to explore include -DCMAKE_CXX_FLAGS:STRING="\" ..... \"" and -DCMAKE_EXE_LINKER_FLAGS:STRING="\" .... \"".

To compile any changes you make to the source, you only have to run ../autobuild/bin/autobuild build -c ReleaseOS --verbose as detailed above.

If run out of the build folder the viewer XUI files will be loaded from ~/SecondLife-Dev/Catznip-R9/indra/newview/skins/default/ rather than those in location you're running the viewer from. Editing XUI files while running is a good source of crashes, so is messing up the XUI.