Difference between revisions of "Developers Documentation"

From Ghpsdr3 SDR project
Jump to: navigation, search
(Installing codec2 low bit rate audio encoding and decoding)
 
(43 intermediate revisions by 5 users not shown)
Line 11: Line 11:
  
  
== Installing portaudio19-dev with jackd2 ==
+
= Installing portaudio19-dev with jackd2 =
  
Portaudio19-dev depends on having a copy of libjack-dev installed and if the libkjack-jackd2-dev package is installed befor portaudio19-dev it's dependency will be satisfied and it will not uninstall jackd2 and install jackd1. If you have already installed jackd1 with portaudio19-dev then the following procedure will fix the problem ...
+
Portaudio19-dev depends on having a copy of libjack-dev installed and if the libkjack-jackd2-dev package is installed before portaudio19-dev it's dependency will be satisfied and it will not uninstall jackd2 and install jackd1 if you have already installed jackd2 on your system.
 +
 
 +
== If jackd1 and portaudio19-dev already installed ==
  
 
<pre>From Synaptic
 
<pre>From Synaptic
Line 20: Line 22:
 
Uninstall jackd1
 
Uninstall jackd1
 
Install Jackd2
 
Install Jackd2
Install libkjack-jackd2-dev
+
Install libjack-jackd2-dev
 
Install portaudio19-dev
 
Install portaudio19-dev
 
</pre>
 
</pre>
  
Of course if you are starting from scratch then this is all you need
+
== If you are starting from scratch ==
 +
 
  
 
<pre>From Synaptic
 
<pre>From Synaptic
  
 
Install Jackd2
 
Install Jackd2
Install libkjack-jackd2-dev
+
Install libjack-jackd2-dev
 
Install portaudio19-dev
 
Install portaudio19-dev
 
</pre>
 
</pre>
  
  
== Installing Qt5 ==
+
The following commands install all the environment needed (Debian/Ubuntu):
You need to add the unsupported packages to your system. It will exist as a stand alone system separate from any other version of qt or creator etc. that you may have installed.
+
  
=== 1. Adding the qt5 “Canonical Qt5 Edgers” ppa to your system ===
 
 
In a terminal, copy and paste ...
 
 
<pre>
 
<pre>
sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-daily
+
sudo apt-get install jackd2 libjack-jackd2-dev portaudio19-dev
 +
 
 +
sudo apt-get install make gcc g++ autoconf automake autotools-dev libtool git subversion
 +
sudo apt-get install libusb-0.1-4 libusb-dev libfftw3-dev libpulse-dev libsamplerate0-dev
 +
sudo apt-get install libusb-1.0-0-dev libconfig8-dev xdg-utils libortp-dev
 +
sudo apt-get install libevent-dev
 +
 
 
</pre>
 
</pre>
Your system will now fetch the PPA's key. This enables your Ubuntu system to verify that the packages in the PPA have not been interfered with since they were built.
 
  
Now, as a one-off, you should tell your system to pull down the latest list of software from each archive it knows about, including the PPA you just added:  
+
'''If the machine doesn't have an OpenGL aware accelerated video card, please install also the following packages:'''
 +
 
 
<pre>
 
<pre>
sudo apt-get update
+
sudo apt-get install mesa-utils
 +
sudo apt-get install mesa-common-dev
 +
sudo apt-get install libgl1-mesa-dev
 +
sudo apt-get install x11proto-xext-dev
 +
sudo apt-get install libxrender-dev
 
</pre>
 
</pre>
Now you're ready to start installing software from the PPA!
 
  
=== 2. Installing from the ppa ===
+
Note: in at least one case (thanks to Pierluigi iw4blg), even if the machine was running with an NVidia card and proprietary NVidia device drivers, the test for Qt in configure did fail, as well did the example programs enclosed in qt5 package, complaining that both GL/gl.h and libGL were missing. Installing all the above packages the problem was solved.
  
You will be installing the packages from the daily build of qt5 and the version date etc. could change but it is important to check that you have marked for install the package corresponding to the qt5 build as some of the packages may also be installed for qt 4.8.x A good check is to open the url for the Edgers and compare your selection to their file list at [https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-daily canonical-qt5-edgers]
+
==== Installing codec2 low bit rate audio encoding and decoding ====
  
The packages will be identified with similar to
 
  5.0-2012xxx ubuntu5 Zoltan Balogh (2012-04-05)
 
I have shown the example on the first entry in the list only.
 
  
Open Synaptic and use the quick find to look for and mark for install each of the packages in the following list ...
+
To download and build the codec2 library. See:
 +
 
 +
http://www.rowetel.com/blog/?page_id=452
 +
<p>
 +
Now go get codec2 using subversion
 +
 
 
<pre>
 
<pre>
qt-components-qtquick2    5.0-2012xxx ubuntu5 Zoltan Balogh (2012-04-05)
+
cd
qt3d
+
svn co https://freetel.svn.sourceforge.net/svnroot/freetel/codec2
qtbase
+
cd codec2
qtdeclarative
+
mkdir build
qtdoc
+
cd build
qtjsbackend
+
cmake ..
qtmultimedia
+
qtquick1
+
qtscript
+
qtsvg
+
qttools
+
qtwebkit
+
qtxmlpatterns
+
  
These packages will install by default in /opt/qt5
+
If cmake complains it will ask you to remove ../CMakelists.txt and may be the ../CMakeFiles directory.
 +
After removal of those.
 +
cmake ..
 +
make
 +
sudo make install
 +
sudo ldconfig
 
</pre>
 
</pre>
note: there are a couple of packages which you do not need to install.
 
  
=== 3. Setting the path to qt5 ===
+
*** The codec2 developers have warned that codec2-dev is the development version which may or may not work, codec2 is the stable branch.
 +
 
 +
= Installing Qt5 =
 +
 
 +
http://qt-project.org/downloads
 +
 
 +
U should download the Qt5.0.0 libraries file.  64 bit for x86_64 and 32 bit for x86 PC etc.
 +
 
 +
** Download the latest file from the above URL - it will not be 5.0.0 but the instructions that follow are to be amended according to the version downloaded.
 +
** For ARM follow Andrea's instructions in the ODROID section of this wiki as there are no binaries available for ARM platforms.
 +
 
 +
After downloading you go to the download directory and do:
 +
 
 +
$ chmod +x the-name-of-the-downloaded-file
 +
 
 +
$ sudo ./the-name-of-the-downloaded-file
 +
 
 +
After that you should have something installed in /opt/Qt5.0.0
 +
 
 +
== Setting the path to qt5 ==
  
 
From a terminal
 
From a terminal
 
<pre>
 
<pre>
$ export PATH=/opt/qt5/bin:$PATH
+
$ export PATH=/opt/Qt5.0.0/5.0.0/gcc_64/bin:/opt/Qt5.0.0/Tools/QtCreator/bin:$PATH
 
</pre>
 
</pre>
=== 4. Compiling QtRadio ===
+
 
 +
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.
 
<pre>
 
<pre>
$ cd to the location of ghpsdr3-alex
+
qmake -v
 +
QMake version 2.01a
 +
Using Qt version 4.8.0 in /home/andrew/QtSDK4.8x/Desktop/Qt/4.8.0/gcc/lib
 +
</pre>
 +
 
 +
== Compiling QtRadio ==
 +
<pre>
 +
cd
 +
git clone https://github.com/alexlee188/ghpsdr3-alex.git
 +
cd ghpsdr3-alex
 +
git checkout master
 +
 
 +
sh ./cleanup.sh
 +
autoreconf -i
 +
 
 +
sh ./alex-conf.sh
  
$ sh cleanup
 
$ autoreconf -i
 
$ ./configure CXXFLAGS = '-O3 -fopenmp'
 
(for those of us with older machines use the line below instead)
 
$ ./configure CXXFLAGS='-O3 -msse2 -fopenmp'
 
$ make
 
$ sudo make install
 
 
</pre>
 
</pre>
=== 5. Setting QtCreator to use the qt5 libraries ===
+
 
 +
Last, build everything:
 +
 
 +
<pre>
 +
make
 +
sudo make install
 +
</pre>
 +
 
 +
== Setting QtCreator to use the qt5 libraries ==
  
 
If you want to use Qt Creator (you use the same Qt Creator as with Qt4), you need to configure it to use Qt5 as one of the options:
 
If you want to use Qt Creator (you use the same Qt Creator as with Qt4), you need to configure it to use Qt5 as one of the options:
Line 106: Line 159:
 
Click on the Qt Versions panel
 
Click on the Qt Versions panel
 
Click on Add button
 
Click on Add button
Navigate to /opt/qt5/bin
+
Navigate to /opt/Qt5.0.0/5.0.0/gcc_64/bin
 
Click on qmake
 
Click on qmake
 
Click on open
 
Click on open
 
Click on Apply then OK
 
Click on Apply then OK
 
</pre>
 
</pre>
You need to point to the qmake file which is found in /opt/qt5/bin
+
You need to point to the qmake file which is found in /opt/Qt5.0.0/5.0.0/gcc_64/bin
  
=== 6. Choosing the build library in QtCreator ===
+
== Choosing the build library in QtCreator ==
  
 
you need to (re)import your QtRadio project and then you will be able to select Qt5 (or the previous Qt4.8 etc.) for building the application.
 
you need to (re)import your QtRadio project and then you will be able to select Qt5 (or the previous Qt4.8 etc.) for building the application.
(I have not got this to work yet so there is some more to go here when I get it sorted.)
+
 
 +
It may be necessary to edit the project file (QtRadio.pro) to choose which version of Qt Creator you are using which can be the SDK directly from Nokia, or the Ubuntu install of Creator. The line "_UsingSDK" needs to be set to true or false as appropriate.
 +
 
 +
== Qt5.0.0 bug ==
 +
 
 +
There is likely to be a bug in the Qt5.0.0 release that leads to QtRadio hangs when you click on the menu after running QtRadio for a while when a buffer underun has occured.
 +
 
 +
This happens only one some PC's, but not others.
 +
 
 +
If it does, you can revert to an older Qt5 BETA:
 +
 
 +
On my one of 3 PC's with the QtRadio lockup problem (when you click on any menu items after running QtRadio for a while, especially after a buffer underflow), I rebuild QtRadio using Qt5 from the Edgers ppa (which is a late BETA version), and the problem disappears completely :-)
 +
 
 +
https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-daily
 +
 
 +
To get it to build in the Edgers, you just have to set the path to the Edgers directory. E.g. in mine, it is:
 +
 
 +
<pre>
 +
$ export PATH=/opt/qt5/bin:$PATH
 +
</pre>
 +
 
 +
Use these commands to create symbolic links in the qt5 library (which you have to do only once):
 +
 
 +
<pre>
 +
$ cd /opt/qt5/lib
 +
$ sudo ln -s libQtMultimedia.so.5.0.0 libQt5Multimedia.so
 +
$ sudo ln -s libQtMultimedia.so.5.0.0 libQt5Multimedia.so.5
 +
$ sudo ln -s libQtMultimedia.so.5.0.0 libQt5Multimedia.so.5.0
 +
</pre>
 +
 
 +
then you should be able to do the usual build steps.

Latest revision as of 12:29, 3 September 2014

Most of the development discussion has been taking place on the sdr-widget google group.


Installing portaudio19-dev with jackd2

Portaudio19-dev depends on having a copy of libjack-dev installed and if the libkjack-jackd2-dev package is installed before portaudio19-dev it's dependency will be satisfied and it will not uninstall jackd2 and install jackd1 if you have already installed jackd2 on your system.

If jackd1 and portaudio19-dev already installed

From Synaptic

Uninstall portaudio19-dev
Uninstall jackd1
Install Jackd2
Install libjack-jackd2-dev
Install portaudio19-dev

If you are starting from scratch

From Synaptic

Install Jackd2
Install libjack-jackd2-dev
Install portaudio19-dev


The following commands install all the environment needed (Debian/Ubuntu):

sudo apt-get install jackd2 libjack-jackd2-dev portaudio19-dev

sudo apt-get install make gcc g++ autoconf automake autotools-dev libtool git subversion
sudo apt-get install libusb-0.1-4 libusb-dev libfftw3-dev libpulse-dev libsamplerate0-dev 
sudo apt-get install libusb-1.0-0-dev libconfig8-dev xdg-utils libortp-dev
sudo apt-get install libevent-dev

If the machine doesn't have an OpenGL aware accelerated video card, please install also the following packages:

sudo apt-get install mesa-utils
sudo apt-get install mesa-common-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install x11proto-xext-dev
sudo apt-get install libxrender-dev

Note: in at least one case (thanks to Pierluigi iw4blg), even if the machine was running with an NVidia card and proprietary NVidia device drivers, the test for Qt in configure did fail, as well did the example programs enclosed in qt5 package, complaining that both GL/gl.h and libGL were missing. Installing all the above packages the problem was solved.

Installing codec2 low bit rate audio encoding and decoding

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
cd codec2
mkdir build
cd build
cmake ..

If cmake complains it will ask you to remove ../CMakelists.txt and may be the ../CMakeFiles directory.
After removal of those.
cmake ..
make
sudo make install
sudo ldconfig
      • The codec2 developers have warned that codec2-dev is the development version which may or may not work, codec2 is the stable branch.

Installing Qt5

http://qt-project.org/downloads

U should download the Qt5.0.0 libraries file. 64 bit for x86_64 and 32 bit for x86 PC etc.

    • Download the latest file from the above URL - it will not be 5.0.0 but the instructions that follow are to be amended according to the version downloaded.
    • For ARM follow Andrea's instructions in the ODROID section of this wiki as there are no binaries available for ARM platforms.

After downloading you go to the download directory and do:

$ chmod +x the-name-of-the-downloaded-file

$ sudo ./the-name-of-the-downloaded-file

After that you should have something installed in /opt/Qt5.0.0

Setting the path to qt5

From a terminal

$ export PATH=/opt/Qt5.0.0/5.0.0/gcc_64/bin:/opt/Qt5.0.0/Tools/QtCreator/bin:$PATH

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

Compiling QtRadio

cd
git clone https://github.com/alexlee188/ghpsdr3-alex.git
cd ghpsdr3-alex
git checkout master

sh ./cleanup.sh
autoreconf -i

sh ./alex-conf.sh

Last, build everything:

make
sudo make install

Setting QtCreator to use the qt5 libraries

If you want to use Qt Creator (you use the same Qt Creator as with Qt4), you need to configure it to use Qt5 as one of the options:

From the top line menu of QtCreator ...

Tools > Options > Build & Run
Click on the Qt Versions panel
Click on Add button
Navigate to /opt/Qt5.0.0/5.0.0/gcc_64/bin
Click on qmake
Click on open
Click on Apply then OK

You need to point to the qmake file which is found in /opt/Qt5.0.0/5.0.0/gcc_64/bin

Choosing the build library in QtCreator

you need to (re)import your QtRadio project and then you will be able to select Qt5 (or the previous Qt4.8 etc.) for building the application.

It may be necessary to edit the project file (QtRadio.pro) to choose which version of Qt Creator you are using which can be the SDK directly from Nokia, or the Ubuntu install of Creator. The line "_UsingSDK" needs to be set to true or false as appropriate.

Qt5.0.0 bug

There is likely to be a bug in the Qt5.0.0 release that leads to QtRadio hangs when you click on the menu after running QtRadio for a while when a buffer underun has occured.

This happens only one some PC's, but not others.

If it does, you can revert to an older Qt5 BETA:

On my one of 3 PC's with the QtRadio lockup problem (when you click on any menu items after running QtRadio for a while, especially after a buffer underflow), I rebuild QtRadio using Qt5 from the Edgers ppa (which is a late BETA version), and the problem disappears completely :-)

https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-daily

To get it to build in the Edgers, you just have to set the path to the Edgers directory. E.g. in mine, it is:

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

Use these commands to create symbolic links in the qt5 library (which you have to do only once):

$ cd /opt/qt5/lib
$ sudo ln -s libQtMultimedia.so.5.0.0 libQt5Multimedia.so
$ sudo ln -s libQtMultimedia.so.5.0.0 libQt5Multimedia.so.5
$ sudo ln -s libQtMultimedia.so.5.0.0 libQt5Multimedia.so.5.0
then you should be able to do the usual build steps.