UnixCompile

From RetroShare
Jump to: navigation, search

This documents how to compile the latest sources from Retroshare subversion repository on Linux.

Contents

Dependencies

First you need to install the packages needed for compiling RetroShare.

Debian/Ubuntu/Raspbian

sudo apt-get install g++ make libgnome-keyring-dev libqt4-dev libxss-dev libssl-dev \
libupnp-dev subversion libbz2-dev libprotobuf-dev protobuf-compiler cmake

If you just want to build retroshare-gui, you won't need "libprotobuf-dev", "protobuf-compiler", "cmake" and "libbz2-dev".

If you want to compile the VOIP plugin, you will need to also install qtmobility-dev as:

sudo apt-get install qtmobility-dev

If you want to compile latest GXS/0.6, which is what is downloaded when using svn:

sudo apt-get install libsqlite3-dev libspeex-dev libspeexdsp-dev libcurl4-openssl-dev libxslt1-dev 

Arch Linux

pacman -S pkg-config subversion openssl libupnp libgnome-keyring libxss qt4 protobuf cmake
  • bzip2 is in the "base" package, and thus should be installed already.
  • pkg-config is in "base-devel" and is likely to be installed, too. (Using the Raspberry-Pi-Arch-Image it seems to be necessary to install it.)
  • If you just want to build retroshare-gui, you won't need "protobuf" and "cmake".

Centos/Redhat

NOTE: Building RPMs should NEVER be done with the root user. It should ALWAYS be done with an unprivileged user. Building RPMs as root might damage your system. You have been warned.

The build process is very similar to that for Debian/Ubuntu, except for:

  • package manager is called "yum"
  • if you just want retroshare-gui compiled, you do not need to download/install "protobuf" and "cmake"
  • Qt version >= 4.8
  • CentOS version = 6.5
sudo yum install rpm-build mod_dav_svn subversion openssl-devel libupnp-devel \
libgnome-keyring libXScrnSaver-devel qt4

NOTE: Please advise of any issues with this information via message.

Additional dependencies

You will need libsqlite3 (should be included in your distro) and the sqlcipher extension library. Check that you have the correct version of the sqlite libraries, as follows:

  md5sum /usr/include/sqlcipher/sqlite3.h

If you have the correct version, you will see:

  2d5a25b608dd3e046173ed45245dee67  /usr/include/sqlcipher/sqlite3.h

To build sqlcipher, you must have at least TCL 8.5 installed, as it is used by the Makefiles for generating code.

sqlcipher

You will need sqlcipher library for encrypting the gxs local storage.

Usually you need to compile sqlcipher on your own but if your distro provides a prebuild version or a manual (AUR for Arch users) you can use this version, too. See Arch Linux (AUR)

Before building, ensure that you have at least TCL 8.5 installed, which is used by the Makefiles for generating code.

Building sqlcipher

Using the same directory structure as above:

cd ~/lib/
git clone https://github.com/sqlcipher/sqlcipher.git
cd sqlcipher/
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
make -j2
sudo make install

If it doesn't work, try changing the linker flags to LDFLAGS="/usr/lib/libcrypto.a" (change the path to the location of "libcrypto.a" on your distribution).

Arch Linux

There is a packet in the AUR you can use. The -git version seems not to work.
If you decide to use it you'll have to edit some files since the link to the self compiled version is hardcoded and an installed version will not be detected:

  • ~/retroshare/retroshare-gui/src/retroshare-gui.pro
  • ~/retroshare/retroshare-nogui/src/retroshare-nogui.pro

(if you don't need the nogui version you don't need to edit it)

Search for

# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
LIBS += ../../../lib/sqlcipher/.libs/libsqlcipher.a 

and replace it with

LIBS += -lsqlcipher

if you prefer to use an explicit link, replace it with

LIBS += /usr/lib/libsqlcipher.so

Building pegmarkdown

cd ~/retroshare/supportlibs/pegmarkdown
qmake && make clean && make -j2

Build Retroshare

Note: In the this section, you can use another directory instead of ~, too.

Note: The -j parameter to make is the number of cores used, and should be changed accordingly to fasten compilation.

Obtain latest retroshare sources from SVN

To obtain the current trunk version (0.6.*):

cd ~
svn co svn://svn.code.sf.net/p/retroshare/code/trunk retroshare06

To obtain 0.5.* branch (which is not forward compatible with 0.6.*):

cd ~
svn checkout svn://svn.code.sf.net/p/retroshare/code/branches/v0.5.5/ retroshare05

You can keep the checked-out source code up-to-date by running

svn up

Now, continue with next step: Build

Build

Notes:

  • replace the "qmake" command with "qmake-qt4" on Arch Linux (and maybe other distros)
  • "make -j2" tells make to use two threads - if you have more/less CPU cores/threads feel free to change the value

libraries

Both GUI and NOGUI need these:

cd ~/retroshare/libbitdht/src && qmake && make clean && make -j2
cd ~/retroshare/openpgpsdk/src && qmake && make clean && make -j2
cd ~/retroshare/libretroshare/src && qmake && make clean && make -j2

retroshare-gui

cd ~/retroshare/retroshare-gui/src && qmake && make clean && make -j2

retroshare-nogui

retroshare-nogui depends on the libssh library 0.5.4, which is used for the RPC via SSH protocol.

If your distribution already provides the current libssh version, you can install the libssh-dev package from your distribution. If your distribution does not have it, you need to download and build this library yourself:

cd ~
mkdir lib/ && cd lib/
wget https://red.libssh.org/attachments/download/41/libssh-0.5.4.tar.gz
tar zxvf libssh-0.5.4.tar.gz
cd libssh-0.5.4/
mkdir build/ && cd build/
cmake -DWITH_STATIC_LIB=ON ..
make -j2

Now you can build retroshare-nogui:

cd ~/retroshare/rsctrl/src && make -j2
cd ~/retroshare/retroshare-nogui/src && qmake && make clean && make -j2 


You can check your libssh version provided for by your Linux System if it is provided or you need to build it.

Missing DSO on command line error

If when compiling the non-gui, you receive the following message:

//lib/i386-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
/usr/bin/ld: ../../libretroshare/src/lib/libretroshare.a(rsthreads.o): undefined reference to symbol 'pthread_create@@GLIBC_2.1'
//lib/i386-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line

you will need to edit the Makefile created after running qmake (as shown above) and add the LDFLAGS to read as follows:

LFLAGS    =  [whatever options the qmake command puts in]
LDFLAGS   = -lpthread

Run

Run retroshare-nogui

~/retroshare/retroshare-nogui/src/retroshare-nogui

Run retroshare-gui

~/retroshare/retroshare-gui/src/RetroShare


Additional Plugins

After compiling, you need to copy the *so* files produced to ~/.retroshare/extensions (version 0.5.*) or ~/.retroshare/extentions6 (version 0.6.*).

You will then need to restart RetroShare to enable the new plugins and make various settings changes, and then restart again.

Voip

You will find this plugin in
~/retroshare/plugins/VOIP

Call qmake and make

Note: The qtmobility development library is needed on Debian.


In version 0.6.*, there are some additional requirements:

sudo apt-get install libopencv-dev
sudo apt-get install build-essential checkinstall cmake pkg-config yasm
sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev

You may need some or all of these packages to add video capturing/encoding capabilitys to the highgui module.

sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev \
libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev

Note: on some systems libxine-dev is not available.

Packages needed to build the Python wrappers:

sudo apt-get install python-dev python-numpy

Install Intel TBB to enable parallel code in OpenCV.

sudo apt-get install libtbb-dev

Now Download OpenCV Open Source Computer Vision Library from http://sourceforge.net/projects/opencvlibrary/ Compile and Install ( adjust version # if different ).

tar -xvf OpenCV-2.4.0.tar.bz2
cd OpenCV-2.4.0/
mkdir build
cd build
cmake -D WITH_QT=ON -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D BUILD_EXAMPLES=ON ..

Notice, that by adding the -D WITH_QT=ON, the highgui module will use QT instead of GTK. If you want to go with GTK just remove this. For more information on the options, look at the CMakeLists.txt file. When you are happy with the configuration you have, you can start/finish compiling the OpenCV

make
sudo make install

Finally, make sure that your programs can link to the OpenCV library in run-time by adding the following line at the end of your /etc/ld.so.conf:

/usr/local/lib

And then configure the dynamic linker run-time bindings:

sudo ldconfig

Now with the successful compile of the OpenCV Library we can perform some quick tests using some examples in the source as well as possible small test additions.

Now for 0.6.*: (please note that the make clean is important to ensure a new compilation with all new components)

cd ~/retroshare/plugins/VOIP
qmake
make clean
make
cp libVOIP.so ~/.retroshare/extensions6

Reference for OpenCV

OpenCV Open Source Computer Vision Library http://sourceforge.net/projects/opencvlibrary/

LinksCloud

Note: This is not required in the trunk/0.6 branch.

You will find this plugin in

~/retroshare/plugins/LinksCloud

Then, enter the following:

qmake
make clean
make

FeedReader

You will find this plugin in

~/retroshare/plugins/FeedReader

The enter the following:

qmake
make clean
make

What If I Have a Crash?

The developers need your feedback. On Gnu/Linux, you can do this by;

1. build RetroShare as describe elsewhere.

2. Run RetroShare in a special way by
gdb ./RetroShare
3. If and when it crashes, ask for a full stack trace
 bt trace full

If the problem is that your retroshare hangs (due to a deadlock), you might want to:

- either stop it, using Ctrl+C in gdb

- or attach to it with gdb

Find the process id, then launch
gdb
and then type in gdb command line
attach [pid]
replacing [pid] with the process id of RetroShare.

Then you can display all threads at once (necessary for detecting deadlocks) using:

thread apply all bt full 

Read online about advanced gdb usage at https://sourceware.org/gdb/current/onlinedocs/gdb/index.html

If you want a gui for gdb try QtCreator. In QtCreator you don't have to remember line numbers to set breakpoints, you can set them with a single click.

Gnu/Linux Install After Building

Debian

cd ~/retroshare/build_scripts/Debian
sudo ./make.sh
sudo dpkg -i [the package you just made]

If you have issues with required packages missing,

tar zxvf retroshare.tgz
cd retroshare/DEBIAN
[your favourite editor] control

Now change the version numbers of the packages in the Depends: line to suit what you have installed on your system

cd ..
mv retroshare.tgz retroshsare.tgz.orig
tar cxf retroshare.tgz retroshare

Now you need to rerun the the original make and install commands given previously.

Ubuntu

Note - needs to be added.

Redhat/Centos

You can create a rpm install package on Ubuntu computer as follows:

sudo alien -r --scripts Retroshare_Gui_0.6.0.r7577_ubuntu_i686.deb

Please note that some permissions and file ownership settings must be changed before installing.


Arch Linux

Note - needs to be added.

Personal tools
Namespaces

Variants
Actions
Navigation
External websites
Wiki
Toolbox