Difference between revisions of "QtRadio Installation"

From Ghpsdr3 SDR project
Jump to: navigation, search
(VIRTUALBOX)
(VIRTUALBOX)
Line 590: Line 590:
  
 
   openssl x509 -req -days 365 -in cert.req -signkey pkey -out cert
 
   openssl x509 -req -days 365 -in cert.req -signkey pkey -out cert
After generating the keys, you should be able to log out and log back in and your server should be running, if all is well.  You should then be able to connect with QtRadio or glSDR.  Be sure to set the server IP address in the client (QtRadio, or glSDR).  Some notes about running the [[Hermes]] server might be helpful to review.
+
After generating the keys, you should be able to log out and log back in and your server should be running, if all is well.  You should then be able to connect with QtRadio or glSDR.  Be sure to set the server IP address in the client (QtRadio, or glSDR).   
  
If you want to change or add the automatically started programs, see [http://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login this web page].
+
If you want to change or add the automatically started programs, see [http://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login this web page].  If you want to change things the helpful notes about running the [[Hermes]] server on the [[Hermes]] page might be good to review.  They explain the commands started automatically upon login.
  
 
I must make one note about running the software from a pre-prepared VirtualBox Image.  It is a way an attacker could gain access to your computer and network.  I used a pre-prepared Ubuntu 12.10 image from [http://virtualboxes.org/images/ubuntu/ VirtualBoxImages].  I believe it to be virgin, but you have to realize that it is possible that some rogue software is running on this image.  If you use the image I provide, you must be solely responsible for whatever happens. I (Rob Frohne, KL7NA) did not put anything on the image, but the ghpsdr3-alex and the tools and packages needed to build it.  As always, there is a trade off between ease of use, and security.
 
I must make one note about running the software from a pre-prepared VirtualBox Image.  It is a way an attacker could gain access to your computer and network.  I used a pre-prepared Ubuntu 12.10 image from [http://virtualboxes.org/images/ubuntu/ VirtualBoxImages].  I believe it to be virgin, but you have to realize that it is possible that some rogue software is running on this image.  If you use the image I provide, you must be solely responsible for whatever happens. I (Rob Frohne, KL7NA) did not put anything on the image, but the ghpsdr3-alex and the tools and packages needed to build it.  As always, there is a trade off between ease of use, and security.

Revision as of 13:29, 26 August 2013

Installation on Linux

The instructions below are for Debian based distributions like Ubuntu but you should be able to compile on any Linux distribution with the correct libraries installed.



Installation from Git

Installing from git involves building or compiling from source. This is required if you want to use one of the various branches to work the "bleeding edge" branches like Alex's rxtx-event branch where the current (Nov 12 2011) TX work is being done. The PPA install is never more than a few days behind master so there is not much to gain from building from git unless you want to work with the source code your self.

Installing compiler and autotool

First off, install the compiler; depending on which distribution are you using, some or all of this stuff could be already installed:

Ubuntu/Debian
sudo apt-get install make gcc g++
sudo apt-get install autoconf automake autotools-dev libtool git subversion
Fedora
sudo yum install gcc gcc-c++ man-pages autoconf automake subversion libtool git

Installing prerequisite packages

Ubuntu 12.04 and newer

First of all, you have to check that the universe repository is enabled. Click on the gear shaped icon (bottom into left side bar): the System Settings menu will shown, click on Software Sources and finally check the Community-maintained Open Source Software (universe) tick. Next, submit the following commands into a terminal window:

sudo apt-get update
sudo apt-get install \
libqt4-opengl-dev \
qtmobility-dev \
libusb-0.1-4 \
libusb-dev \
libfftw3-dev \
portaudio19-dev \
libpulse-dev \
libsamplerate0-dev \
libusb-1.0-0-dev \
libconfig8-dev \
xdg-utils \
libortp-dev \
gcc-multilib \
libssl-dev \
libevent-dev \
libglu1-mesa-dev \
freeglut3-dev

You will need qt5 installed to complete the build.

Visit: http://qt-project.org/downloads

download the current package for your system.

To build Qt5 on a RaspberryPi visit: http://qt-project.org/wiki/RaspberryPi

After downloading it go to the download directory and do:

$ chmod +x the-name-of-the-downloaded-file
$ sudo ./the-name-of-the-downloaded-file

Simply click on the installer and follow the prompts, take note of were qt5 is installed. Don't open the readme or start QtCreator when the installer asks. It will make some files in your home directory owned by root, and that will give you trouble later. After the install has completed, from a terminal:

$ export PATH=/opt/Qt5.1.0/5.1.0/gcc_64/bin:/opt/Qt5.1.0/Tools/QtCreator/bin:$PATH

In the above make sure you put in the correct path for your version of Qt. This is due because the several packages from Qt sources and binary repositories web sites are not really installed in the system but simply copied on it. Therefore the autotools build system should search virtually over the whole filesystem. In any case please remember that the export above is effective only into the current terminal windows, if you open another window and/or reboot the system, you have to resubmit again the command if you want to make permanent it, you have to add the export into the right configuration shell, suitable for the shell that you are currently using. For the bash it is typically ~/.bashrc In any case, after you issue the export, please test it.

qmake -v
QMake version 2.01a
Using Qt version 4.8.0 in /home/andrew/QtSDK4.8x/Desktop/Qt/4.8.0/gcc/lib
Ubuntu 11.04 and older

First of all, you have to check that the universe repository is enabled. Please see the procedure in the previous section #graphical installation .

Next, you will need the following packages installed:

sudo apt-get update
sudo apt-get install \
libqt4-opengl-dev \
qtmobility-dev \
libusb-0.1-4 \
libusb-dev \
libfftw3-dev \
portaudio19-dev \
libpulse-dev \
libsamplerate0-dev \
libusb-1.0-0-dev \
libconfig8-dev \
libortp-dev
Ubuntu 11.10

First of all, you have to check that the universe repository is enabled. Click on the gear shaped icon (bottom into left side bar): the System Settings menu will shown, click on Software Sources and finally check the Community-maintaned Open Source Software (universe) tick. Next, submit the following commands into a terminal window:

sudo apt-get update
sudo apt-get install \
libqt4-opengl-dev \
qtmobility-dev \
libusb-0.1-4 \
libusb-dev \
libfftw3-dev \
portaudio19-dev \
libpulse-dev \
libsamplerate0-dev \
libusb-1.0-0-dev \
libconfig8-dev \
xdg-utils \
libortp-dev
Fedora 16
sudo yum install fftw fftw-devel 
sudo yum install libusb-devel libusb1-devel 
sudo yum install portaudio-devel
sudo yum install libconfig-devel
sudo yum install libsamplerate-devel
sudo yum install pulseaudio-libs-devel
sudo yum install jack-audio-connection-kit  jack-audio-connection-kit-devel
sudo yum install qt4-devel


Cloning the repository

How to build the latest master branch on Ubuntu 11.04

First a new libevent will need to be downloaded and installed, then the actual QtRadio source can be downloaded and built.

Obtaining an up-level libevent library

$ sudo apt-get install libevent-dev

If the version is older than 2.0.5, go to synaptic and completely remove the stock libevent from Ubuntu. (Completely remove is an uninstall option in Synaptic. Additional dependent libraries may also be removed)

Then download the new version from:

http://libevent.org/

libevent-2.0.16-stable.tar.gz

wget https://github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gz

Move the tarball from the Downloads directory to a working directory. A suggestion is to create a src directory within your home directory and move it there. Uncompress and follow the instructions to build and install:

cd
tar -zxvf libevent-2.0.16-stable.tar.gz
cd libevent-2.0.16-stable
./configure
make
sudo make install
sudo ldconfig

On Fedora, in order to use the library above, export the LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/usr/local/lib

Installing codec2 low bit rate audio encoding and decoding

We are adding a low bit rate audio codec called codec 2 to QtRadio/dspserver. You need to download and build the codec2 library. See:

http://www.rowetel.com/blog/?page_id=452

Now go get codec2 using subversion

cd
svn co https://freetel.svn.sourceforge.net/svnroot/freetel/codec2-dev codec2-dev
cd codec2-dev
autoreconf -i
./configure
make
sudo make install
sudo ldconfig

On Fedora, in order to use the library above, export the LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/usr/local/lib

Building the master branch

This branch is the latest code that contains both RX and TX capability.

Create a new directory or cd to the ~/src directory created for libevent and cd into it.

git clone git://github.com/alexlee188/ghpsdr3-alex

Depending on your Internet connection thorughput, it will take several minute to download. cd into the new directory ghpsdr3-alex:

cd ghpsdr3-alex
git checkout master

You are now working with Alex's latest and greatest!

First set the path to the version of qt you are using. E.g. for qt5:

$ export PATH=/opt/qt5/bin:$PATH

Then:

autoreconf -i
./configure
make -j4 all
sudo make install

The default configure above builds with debug and default Qt4 version in your PC. For optimized executable, you need to specify options specific to your system. See the sample shell scripts that replaces the above ./configure step:

./alex-avx-conf.sh		for building with i3,i5 and i7 cpu's supporting Advanced Vector Extensions (AVX)
./alex-openmp-conf.sh		for building with i3,i5 and i7 cpu's and OpenMP support
./alex-sse3-conf.sh		for building with SSE3 capable cpu's
./alex-openmp-sse3-conf.sh	for building with SSE3 cpaable cpu's and OpenMP support

(If you do not want to actually install the executable binaries, skip the sudo make install and just cd into the following directories and run them from there)

Terminal 1
$ cd ghpsdr3-alex/trunk/src/softrock
$ ./softrock ...options ...

Terminal 2
$ cd ghpsdr3-alex/trunk/src/dspserver
$ ./dspserver  ..options...

Terminal 3
$ cd ghpsdr3-alex/trunk/src/QtRadio
$ ./QtRadio

Building the Perseus extensions

In order to build the Microtelecom Perseus server you need to switch to the master or iw0hdv branch.

First off, install the prerequisite library and wget package:

sudo apt-get install libboost-all-dev wget

Next download, compile and install the library libperseus-sdr:

cd
wget http://libperseus-sdr.googlecode.com/files/libperseus_sdr-0.6.tar.gz
tar -zxvf libperseus_sdr-0.6.tar.gz
cd libperseus_sdr-0.6/
./configure && make
sudo make install
sudo ldconfig


If you already build in your sandbox some other branch, is strongly advisable, before you start the build, to do a full cleanup:

cd ~/ghpsdr3-alex
make distcheck && sh cleanup.sh

Otherwise, if you are starting from scratch, you have to clone the repository:

git clone git://github.com/alexlee188/ghpsdr3-alex

Finally, you can switch to the master branch and rebuild everything; you don't need anymore to explicitly enable the perseus server feature, the configure script automatically selects it when the libperseus_sdr is found.

cd ~/ghpsdr3-alex
git checkout master
autoreconf -i && ./configure && make -j4
sudo make install

In order to run it you have two choices, the first one being the plain command line:

xterm -e 'perseus_server -d3 -s96000 ' &
sleep 3
xterm -e 'dspserver --lo 0 --nocorrectiq' &
sleep 5
$( QtRadio 127.0.0.1 ) 

In QtRadio, Receiver menu, select Configure item, Server tab: here add the local host using the 127.0.0.1 IP address. Pressing the key C, you start the receiver.

The second choiche is to use the ghpsdr3-mgr.py script (available in menu Applications, Hamradio as ghpsdr3launcher): clicking on the Perseus icon the three processes should start and the QtServer automatically connects to Perseus Server.

Building USRP enabled version

Building the UHD package
Install the prerequisite packages (Ubuntu 11.10):
sudo apt-get install liboost-all-dev
sudo apt-get install python-cheetah
Build & Install UHD -- FOR UHD-3.3.1 AND GREATER --:
cd
git clone git://ettus.sourcerepo.com/ettus/uhd.git
cd uhd/host/
mkdir build
cd build
cmake ../
make
make test
sudo make install
sudo ldconfig

If you already build in your sandbox some other branch, is strongly advisable, before you start the build, to do a full cleanup:

cd ~/ghpsdr3-alex
make distcheck && sh cleanup.sh

Otherwise, if you are starting from scratch, first clone the repository:

git clone git://github.com/alexlee188/ghpsdr3-alex

Finally, you can switch to the master branch and rebuild everything, enabling the usrp server feature:

cd ~/ghpsdr3-alex
git checkout usrp-server
autoreconf -i && ./configure --enable-usrp=yes && make -j4
sudo make install

Refresh to a Newer Version

To pull a new version to build

$ git pull
$ make -j4 all
$ sudo make install

If extensive changes have occurred or if you get errors during the make, you may want to do a clean build

$ git pull
$ make distclean
$ sh cleanup.sh
$ autoreconf -i
$ ./configure
$ make -j4 all
$ sudo make install

If you continue to get errors, please report the whole ./configure output and the config.log to the mailing list.

Installation on Windows

See QtRadio on Windows

Network settings

If you are behind a firewall/NAT-router and want to be able to connect to your dspserver over the Internet you have to open up port tcp/8000. If you are using the client in RTP mode you have to open up udp/5004 and udp/5005.



Installing ghpsdr3-alex on Raspberry Pi

==== HARDWARE ====
      • THIS SECTION DEALS WITH Raspberry Pi DIFFERENCES *** IT DOES NOT CIRCUMVENT THE INSTRUCTIONS STARTING AT STEP 1 OF THE QtRadio Installation. ***

I recommend installing either the raspbian or raspbian pisces (debian) distributions as there is no Ubuntu release to date.

      • All the pre-requisite packages needed for Ubuntu must be installed on raspbian or respbian pisces using the same "apt-get install" commands so it's necessary to follow the QtRadio-Installation

document from the beginning after installing raspbian or raspbian pisces.


       The RasPi USB subsystem is sensitive to power supply voltage levels - A supply of 5.5V at 2A is recommended. 

With the power supply output at +5.17V I was getting on-board Ethernet errors and system hangs when one more device besides keyboard and mouse were plugged in to the on-board USB ports or an outboard powered USB HUB.

Measuring the voltage across TP1 and TP2 on the Raspberry Pi and increased it to +4.97V (P.S output +5.59V).

I also ran "rpi-update" which install new firmware.

I shorted out the polyfuses F1 and F2 on the Pi and USB is much more stable but still limited.

With keyboard, mouse, gigabit USB Ethernet, SB Live! 24 USB and RTL-SDR dongle it runs for some hours before it freezes.

Removing the RTL-SDR dongle from the powered hub made a great difference with a current uptime heading for 3 days. The latest ghpsdr3-alex master branch build successfully completed while I was in bed.

root@pisces:/usr/src/GHPSDR3_HIGH_SPEED_MASTER/ghpsdr3-alex# date

Sun Sep 9 13:00:49 BST 2012

root@pisces:/usr/src/GHPSDR3_HIGH_SPEED_MASTER/ghpsdr3-alex# uptime

13:00:56 up 2 days, 20:46,  8 users,  load average: 0.81, 1.01, 0.67



******       Do not use power from a USB PC port or from a USB Hub. ********


Once it's up and running, some details that may help in setting up the hardware for use - I'm currently overclocking at 855MHz (Previously was set to 1GHz):-

Keyboard, mouse, usb sound card, RTL-SDR TV dongle and USB Gigabit Ethernet fully operational using the 7-port powered USB hub.

root@pisces:~# lsusb

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.

Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.

Bus 001 Device 004: ID 04cc:1521 ST-Ericsson USB 2.0 Hub

Bus 001 Device 011: ID 04f3:0103 Elan Microelectronics Corp.

Bus 001 Device 006: ID 047d:1022 Kensington Orbit Optical

Bus 001 Device 007: ID 1d19:1101 Dexatek Technology Ltd. DK DVB-T Dongle

Bus 001 Device 008: ID 041e:3040 Creative Technology, Ltd SoundBlaster Live! 24-bit External SB0490

Bus 001 Device 009: ID 0b95:1780 ASIX Electronics Corp. AX88178 root@pisces:~# ifconfig

eth0 Link encap:Ethernet HWaddr b8:27:eb:2c:07:c9

        inet addr:192.168.10.31  Bcast:192.168.10.255 Mask:255.255.255.0
        inet6 addr: fe80::ba27:ebff:fe2c:7c9/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:410 errors:0 dropped:0 overruns:0 frame:0
        TX packets:377 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:28905 (28.2 KiB)  TX bytes:35938 (35.0 KiB)

eth1 Link encap:Ethernet HWaddr 00:10:14:00:9f:fa

        inet addr:192.168.2.199  Bcast:192.168.2.255 Mask:255.255.255.0
        inet6 addr: fe80::210:14ff:fe00:9ffa/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:5 errors:0 dropped:0 overruns:0 frame:0
        TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:230 (230.0 B)  TX bytes:592 (592.0 B)

lo Link encap:Local Loopback

        inet addr:127.0.0.1  Mask:255.0.0.0
        inet6 addr: ::1/128 Scope:Host
        UP LOOPBACK RUNNING  MTU:16436  Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@pisces:~# cat /proc/asound/cards

0 [ALSA           ]: BRCM bcm2835 ALSbcm2835 ALSA - bcm2835 ALSA
                     bcm2835 ALSA
1 [External       ]: USB-Audio - SB Live! 24-bit External
                     Creative Technology SB Live! 24-bit External at usb-bcm2708_usb-1.2.2, full spe



It's running at 855MHz with this config.txt file. root@pisces:~# cat /boot/config.txt

over_voltage=6

arm_freq=855

core_freq=500

sdram_freq=500


root@pisces:~# cat /etc/network/interfaces

   Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
   /usr/share/doc/ifupdown/examples for more information. 

auto lo


iface lo inet loopback


   File: ifcfg-eth0

auto eth0

iface eth0 inet static

address 192.168.10.31

netmask 255.255.255.0

gateway 192.168.10.103


auto eth1

iface eth1 inet static

address 192.168.2.199

netmask 255.255.255.0


root@pisces:~# cat /etc/modules

   /etc/modules: kernel modules to load at boot time.
   This file contains the names of kernel modules that should be loaded
   at boot time, one per line. Lines beginning with "#" are ignored.
   Parameters can be specified after the module name. 

loop

snd-bcm2835


One problem remains, no sound from the on-board chip.

VIRTUALBOX

It is possible to run the server software (and QtRadio) under VirtualBox. It has been tested with HPSDR Hermes hardware. A VirtualBox Ubuntu 12.10 image is available that automatically starts the server software for those who are running Windows, or don't feel they have the hardware, expertise or time to setup a Linux machine to act as a server. The Dspserver.conf file needs to be edited, and you will need to run the dspserver once within a terminal to get the instructions on setting up an SSL key pair. To do that download the VirtualBox image, start VirtualBox, select new for the new machine, and when it asks you about the hard drive, say use existing hard drive, and select the image you just downloaded as the hard drive. After it boots up, you need to start a terminal and dspserver.

$ dspserver
Reading conf file /home/frohro/dspserver.conf
Country Lookup is On
gHPSDR rx 0 (Version 0.7)
dspserver string: 20130609;-master
getSoundcardId: HPSDR id=8
setSoundcard: 8
setSoundcard -41.000000 -48.000000
etup sdr thread 0: done
setup sdr thread 1: done
setup sdr thread 2: done
client_thread
[2013-08-26 10:15:12] client_thread: listening on port 8000
Couldn't read 'pkey' or 'cert' file.  To generate a key
and self-signed certificate, run:
 openssl genrsa -out pkey 2048
 openssl req -new -key pkey -out cert.req
 openssl x509 -req -days 365 -in cert.req -signkey pkey -out cert
client ctx init failed: No such file or directory
 

Note the message about the SSL keys ("Couldn't read 'pkey' or 'cert' file.") not being set up. This is a process you do once. The three commands to set up the SSL keys are just what the dspserver response above told you to do.

 openssl genrsa -out pkey 2048
 openssl req -new -key pkey -out cert.req
 openssl x509 -req -days 365 -in cert.req -signkey pkey -out cert

After generating the keys, you should be able to log out and log back in and your server should be running, if all is well. You should then be able to connect with QtRadio or glSDR. Be sure to set the server IP address in the client (QtRadio, or glSDR).

If you want to change or add the automatically started programs, see this web page. If you want to change things the helpful notes about running the Hermes server on the Hermes page might be good to review. They explain the commands started automatically upon login.

I must make one note about running the software from a pre-prepared VirtualBox Image. It is a way an attacker could gain access to your computer and network. I used a pre-prepared Ubuntu 12.10 image from VirtualBoxImages. I believe it to be virgin, but you have to realize that it is possible that some rogue software is running on this image. If you use the image I provide, you must be solely responsible for whatever happens. I (Rob Frohne, KL7NA) did not put anything on the image, but the ghpsdr3-alex and the tools and packages needed to build it. As always, there is a trade off between ease of use, and security.

SOFTWARE

          • START AT THE BEGINNING WHEN BUILDING THE SOFTWARE -- i.e Section 1 and install all the packages recommended and do the pulseaudio setup.

If you build ghpsdr3-alex already it's a case of following the same procedure with the following caveats that apply to the RasPi ARM architecture. What follows is a blow by blow account of how I did it for the iw0hdv branch which supports my HiQSDR+Preselector. The same steps are needed for building any other branch.

Subject: [n2adr-sdr] Raspberry Pi running ghpsdr3-alex

The changes made by Andrea have been merged into the master branch. These changes allow samplerates >192K but the Pi doesn't have the power to run these high samplerates - I am running hiqsdr-server at 960K samplerate on a 8-core x84_64 box.


  autoreconf -i 
   ./configure CFLAGS='-O3 -pipe -march=armv6 -mfpu=vfp -mfloat-abi=hard' CXXFLAGS='-O3 -pipe -march=armv6 -mfpu=vfp -mfloat-abi=hard' 
        • Additional steps needed when building rtlsdr-server. Do these before running make ******
  1. export ac_cv_func_malloc_0_nonnull=yes
  2. export ac_cv_func_realloc_0_nonnull=yes


   make all && make all install 


Sound on the Raspberry Pi is still a problem I have not been able to solve.

Terry (WB4JFI) suggested the following that work for him but I have had no luck with it.

"amixer cset numid=3 1"

Other valid numid's are 0=auto, 1=headphones and 2=hdmi.


QtRadio running on another box using the connection from the server list. Sound is a touch distorted, quite distorted on start up of QtRadio and spectrum is always a little bit slow.

When a slave connected and tried changing frequency, dspserver crashed - dspserver can be a bit crash happy.

The first thing I tried on the Pi was QtRadio standalone, spectrum and waterfall were OK but no sound.

Just now a client using glSDR (5) is attempting to change frequency, sound went quite distorted then dspserver crashed.

Restarted dspserver and QtRadio sound started very distorted before it settled down to reasonable.