Skip to main content

Building from Source on Linux

Preparation

Packages listed here may be needed to compile Singularity, they are more geared toward 32-bit compiles, but don't let that discourage you, there should be 64-bit packages of these available, perhaps even under the same name. Flex and Bison are no longer necessary. Neither is Mercurial/hg.

You'll need to have git and Ninja.

For Arch Linux, you'll need to get python2, python3 will not work. We have an aged script called scripts/build-deps.sh that may hep you find the dependencies you need as well. GCC version 4(minimum 4.9) is required as GCC version 5 will not work.

Get autobuild by running:

sudo pip install "git+https://git.alchemyviewer.org/alchemy/autobuild"

Refer to Building the FMOD Studio Package to create the FMOD package the viewer requires for audio.

Now clone and configure the viewer source:

git clone git://github.com/singularity-viewer/SingularityViewer.git singularity
cd singularity/
autobuild configure -c_Configuration_ -A_Architecture_ -- -DPACKAGE=OFF

Architecture can be either 32 or 64. Configuration can be either Release (equivalent to our releases) or RelWithDebInfo (if you'd like assist us with resolving crash bugs).

Arch Linux users, and developers who wish their systems to have default versions of programs other than our requisites, may need to:

  • To have the right python used, specify python2 for pip like so
sudo python2 `which pip` install...
  • Append -DCMAKE_C_COMPILER=gcc-4.9 -DCMAKE_CXX_COMPILER=g++-4.9 to ensure use of GCC 4.

Compiling

cd build-linux-*
ninja -v
  • Note: Append -j followed by the number of threads you wish to dedicate to compiling, unless you want to use all.

This is pretty much it. The viewer will be in the newview/packaged subdirectory.

Known issues and how to handle them If you use an Ubuntu/Debian based distribution and get a linker error: /usr/bin/ld: error: cannot find -lfoo It may be solved by running: locate libfoo.so If the output shows nothing, you're missing a package, ask your package manager for it. If it shows something like /usr/lib/[arch]/libfoo.so.b.a.r or /usr/lib/[arch]/libfoo.so.b but not /usr/lib/[arch]/libfoo.so, you'll need to create a link, run sudo ln -s /usr/lib/[arch]/libfoo.so.b /usr/lib/[arch]/libfoo.so and your problem shall be solved.

The make command may error out the first time, just run it again. If this still doesn't quite work, file a JIRA.

Running the debugger

If you run singularity as ASCENDED_DEVELOPER=1 ./singularity it will start in debugger. The debugger will take a few seconds to load and present you with a command prompt. Enter run or short r to start Singularity Viewer. If there is an error, the debugger will stop Singularity Viewer and require entry. Examine the situation quickly. If the program was stopped because of SIGPIPE, you can simply continue execution by entering cont. If it was stopped because of SIGSEGV, we have a genuine crash on our hands! First thing that you will be able to see is which module we have crashed in. If it's in your graphics card driver, such as libnvidia-glcore.so, there is probably not much information you can gain this way, and can quit or kill and run again.

If the crash was elsewhere, preferably in our code or libc, more information can get gained from it! You can do the following to produce a bunch of output which will hopefully make sense to me:

set pagination 0
set log on
info registers
where
where full
thread apply all where full

After you quit, you will find gdb.txt containing all output. Please send that to me :)

Updating

Open a terminal to the repository you cloned and check if there's an update by running:

git fetch

If there is an update, there will be output from the command as it receives changesets. To receive the update run:

git pull

To have the build number change for certain:

touch indra/newview/CMakeLists.txt

Finally, repeat the Compiling step to update your build.