Difference between revisions of "Linux Build Environment"

From Catznip
Jump to navigation Jump to search
(Autobuild configure & build)
(Install Build Environment)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
The following instructions have been tested on both Ubuntu and Linux Mint, 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.
+
'''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.
 
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 (squeeze)$ are to be run inside the schroot.''' Don't type the $ or (squeeze)$.
+
'''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==
  
==Schroot==
+
===Debian / Ubuntu / Mint Host===
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.
 
 
 
 
Install schroot and debootstrap.
 
Install schroot and debootstrap.
 
<pre>
 
<pre>
 
$ sudo apt-get install schroot debootstrap
 
$ sudo apt-get install schroot debootstrap
 
</pre>
 
</pre>
 +
 +
===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'.
 +
<pre>
 +
# groupadd crontab
 +
# groupadd sudo
 +
# groupadd staff
 +
# emerge schroot debootstrap
 +
</pre>
 +
 +
==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'''...
 
Configure the schroot. Edit ''''/etc/schroot/schroot.conf'''' so it looks like the following, making sure to change '''YOUR_USER_NAME'''...
 
<pre>
 
<pre>
[squeeze]
+
[jessie]
description=Debian Squeeze
+
description=Debian Jessie
 
type=directory
 
type=directory
directory=/schroot/squeeze
+
directory=/schroot/jessie
 
users=YOUR_USER_NAME
 
users=YOUR_USER_NAME
 
groups=sbuild
 
groups=sbuild
Line 29: Line 42:
 
<pre>
 
<pre>
 
$ sudo mkdir /schroot
 
$ sudo mkdir /schroot
$ sudo mkdir /schroot/squeeze
+
$ sudo mkdir /schroot/jessie
 
</pre>
 
</pre>
  
 
+
==Ubuntu Trusty==
==Debian Squeeze==
+
We build using Debian Jessie, for fewer headaches you should too. There are other distributions you could use in your schroot, good luck!
We build using Debian Squeeze, for fewer headaches you should too. There are other distributions you could use in your schroot, good luck!
 
 
<pre>
 
<pre>
$ sudo debootstrap  --arch i386 squeeze /schroot/squeeze http://ftp.de.debian.org/debian
+
$ sudo debootstrap  --arch i386 trusty /schroot/jessie tuhttp://ftp.debian.org/debian
 
</pre>
 
</pre>
  
 
Enter the new schroot..
 
Enter the new schroot..
 
<pre>
 
<pre>
$ sudo schroot -c squeeze -u root
+
$ sudo schroot -c jessie -u root
 
</pre>
 
</pre>
 
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.
 
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.
 
<pre>
 
<pre>
(squeeze)root@tetsuo:/home/trinity#
+
(trusty)root@tetsuo:/home/trinity#
 
</pre>
 
</pre>
  
Install a load of things needed to build the viewer. '''Yes, that is one single huge command'''.
+
===Install Build Environment===
 +
Next we install a load of things needed to build the viewer including Linden Lab's Autobuild.
 
<pre>
 
<pre>
(squeeze)# apt-get install sudo cmake bison flex python g++ make bzip2 \
+
(trusty)# apt-get update
ccache libc6-dev libstdc++6 libx11-dev libxrender-dev \
+
(trusty)# apt-get install software-properties-common
libgl1-mesa-dev libglu1-mesa-dev zlib1g-dev libssl-dev libogg-dev \
+
</pre>
libpng12-dev libdbus-glib-1-dev libgtk2.0-dev libxml2-dev wget mercurial
+
This next bit is one long command, just copy and paste as provided, it will work fine.
 +
<pre>
 +
(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
 +
</pre>
 +
Now Install Linden Lab's Autobuild system wide.
 +
<pre>
 +
(trusty)#pip install 'hg+https://bitbucket.org/lindenlab/autobuild-1.0#egg=autobuild'
 +
</pre>
 +
If all went to plan then you should be able to type #autobuild --version' and see the following.
 +
<pre>
 +
(trusty)root@TETSUO:/home/trinity# autobuild --version
 +
autobuild 1.0
 
</pre>
 
</pre>
  
 
We're done here. Exit the schroot.
 
We're done here. Exit the schroot.
 
<pre>
 
<pre>
(squeeze)# exit
+
(trusty)# exit
 
</pre>
 
</pre>
 
  
 
==Setting up==
 
==Setting up==
Line 72: Line 97:
 
<pre>
 
<pre>
 
$ cd ~/SecondLife-Dev
 
$ cd ~/SecondLife-Dev
$ schroot -c squeeze
+
$ schroot -c trusty
 
</pre>
 
</pre>
  
 
If you have done everything correct you should be presented with something like the following.
 
If you have done everything correct you should be presented with something like the following.
 
<pre>
 
<pre>
(squeeze)trinity@tetsuo:~/SecondLife-Dev$
+
(trusty)trinity@tetsuo:~/SecondLife-Dev$
 
</pre>
 
</pre>
===Autobuild===
 
Fetch Linden Lab's autobuild..
 
<pre>
 
(squeeze)$ hg clone http://hg.secondlife.com/autobuild
 
  
build
+
Unlike previous versions of this guide we do not need to update cmake.
destination directory: autobuild
 
requesting all changes
 
adding changesets
 
adding manifests
 
adding file changes
 
added 557 changesets with 1105 changes to 98 files
 
updating to branch default
 
67 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
</pre>
 
===CMAKE===
 
The version of cmake that ships with debian squeeze is 2.8.2, for now we need 2.8.11.2
 
<pre>
 
(squeeze)$ mkdir ~/SecondLife-Dev/cmake
 
(squeeze)$ cd ~/SecondLife-Dev/cmake
 
</pre>
 
  
Download cmake 2.8.11.2
 
<pre>
 
(squeeze)$ wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2-Linux-i386.sh
 
</pre>
 
 
Install.. tap space to get though the licence and then enter '''Y''' followed by '''N'''.
 
<pre>
 
(squeeze)$ /bin/sh cmake-2.8.11.2-Linux-i386.sh
 
</pre>
 
 
===Catznip Source===
 
===Catznip Source===
 
We do not release source code for a viewer until we have released it to the public.
 
We do not release source code for a viewer until we have released it to the public.
  
 
<pre>
 
<pre>
(squeeze)$ cd ~/SecondLife-Dev
+
(trusty)$ cd ~/SecondLife-Dev
 
</pre>
 
</pre>
  
 
Fetch the source from our [http://hg.catznip.com/ bitbucket] repository. This may take some time ...
 
Fetch the source from our [http://hg.catznip.com/ bitbucket] repository. This may take some time ...
 
<pre>
 
<pre>
(squeeze)$ hg clone http://hg.catznip.com/Catznip-R9
+
(trusty)$ hg clone http://hg.catznip.com/Catznip-R10
 
</pre>
 
</pre>
  
 
<pre>
 
<pre>
(squeeze)$ cd ~/SecondLife-Dev/Catznip-R9
+
(trusty)$ cd ~/SecondLife-Dev/Catznip-R10
 
</pre>
 
</pre>
  
Line 135: Line 132:
 
<pre>
 
<pre>
 
$ cd ~/SecondLife-Dev
 
$ cd ~/SecondLife-Dev
$ schroot -c squeeze
+
$ schroot -c trusty
 
</pre>
 
</pre>
===Add cmake to the PATH===
 
This could be set up automatically, but for the purposes of this guide you need to enter this every time you enter the schroot to build the viewer.
 
<pre>
 
(squeeze)$ export PATH=~/SecondLife-Dev/cmake/bin:$PATH
 
(squeeze)$ cmake -version
 
  
cmake version 2.8.11.2
+
 
</pre>
 
 
===Autobuild configure & build===
 
===Autobuild configure & build===
 
Change to the source directory..
 
Change to the source directory..
 
<pre>
 
<pre>
(squeeze)$ cd ~/SecondLife-Dev/Catznip-R9
+
(trusty)$ cd ~/SecondLife-Dev/Catznip-R10
 
</pre>
 
</pre>
  
 
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).
 
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).
 
<pre>
 
<pre>
(squeeze)$ ../autobuild/bin/autobuild configure -c ReleaseOS -- -DFMODEX:BOOL=OFF \
+
(trusty)$ autobuild configure -c ReleaseOS -- -DFMODEX:BOOL=OFF \
 
-DVIEWER_CHANNEL="\"Catznip Homebrew\"" -DGCC_DISABLE_FATAL_WARNINGS:BOOL=ON \
 
-DVIEWER_CHANNEL="\"Catznip Homebrew\"" -DGCC_DISABLE_FATAL_WARNINGS:BOOL=ON \
 
-DLL_TESTS:BOOL=OFF
 
-DLL_TESTS:BOOL=OFF
 
</pre>
 
</pre>
  
There are a number of compilation options you are free to explore but they are beyond the scope of this document.
+
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).
 
Compile the viewer .. depending on hardware this could take a significant amount of time (over an hour on an i5).
 
<pre>
 
<pre>
(squeeze)$ ../autobuild/bin/autobuild build -c ReleaseOS --verbose
+
(trusty)$ autobuild build -c ReleaseOS --verbose
 
</pre>
 
</pre>
  
The build and all working files will be placed inside '''~/SecondLife-Dev/Catznip-R9/build-linux-i686'''. This folder should be removed if you wish to run configure again or to save disk space on older source trees.
+
The build and all working files will be placed inside '''~/SecondLife-Dev/Catznip-{{CurrentVersion}}/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==
 
==Running the Viewer==
Line 172: Line 163:
 
Exit from the schroot (or open a new terminal).
 
Exit from the schroot (or open a new terminal).
 
<pre>
 
<pre>
(squeeze)$ exit
+
(trusty)$ exit
 
</pre>
 
</pre>
  
 
Change to the directory ...
 
Change to the directory ...
<code>
+
<pre>
$ cd ~/SecondLife-Dev/catznip-{{CurrentVersion}}/build-linux-i686/newview/packaged
+
$ cd ~/SecondLife-Dev/Catznip-R10/build-linux-i686/newview/packaged
</code>
+
</pre>
  
 
.. and run. No installation or messing about required, menu entries will be created.
 
.. and run. No installation or messing about required, menu entries will be created.
Line 186: Line 177:
  
 
The viewer will have it's own configuration file '''~/.catznip/user_settings/settings_homebrew.xml'''
 
The viewer will have it's own configuration file '''~/.catznip/user_settings/settings_homebrew.xml'''
 
  
 
==Deep Notes==
 
==Deep Notes==
Line 194: Line 184:
  
 
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.
 
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="\" .... \""'''.
 
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.
 
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-{{CurrentVersion}}/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.
+
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.
 +
 
 +
 
 +
 
 +
 
 +
 
  
 
[[Category:Development]][[Category:Linux]]
 
[[Category:Development]][[Category:Linux]]

Latest revision as of 00:41, 5 November 2016

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.