gr-gsm on RPi

1,076 views
Skip to first unread message

Matej Kovacic

unread,
Jan 8, 2016, 11:15:02 AM1/8/16
to gr-gsm
Hi,

I am trying to compile gr-gsm on RaspberryPi.

I came to make command, and at the end I run into an error:

[ 68%] Built target gnuradio-grgsm
[ 70%] Built target _grgsm_swig_doc_tag
[ 74%] Built target grgsm_swig_swig_doc
[ 75%] Built target _grgsm_swig_swig_tag
[ 82%] Built target grgsm_swig_swig_2d0df
[ 84%] Building CXX object
swig/CMakeFiles/_grgsm_swig.dir/grgsm_swigPYTHON_wrap.cxx.o
virtual memory exhausted: Cannot allocate memory
swig/CMakeFiles/_grgsm_swig.dir/build.make:58: recipe for target
'swig/CMakeFiles/_grgsm_swig.dir/grgsm_swigPYTHON_wrap.cxx.o' failed
make[2]: ***
[swig/CMakeFiles/_grgsm_swig.dir/grgsm_swigPYTHON_wrap.cxx.o] Error 1
CMakeFiles/Makefile2:304: recipe for target
'swig/CMakeFiles/_grgsm_swig.dir/all' failed
make[1]: *** [swig/CMakeFiles/_grgsm_swig.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

It seems there is not enough memory on a target system.

Any idea how to solve this?

Regards,

M.
--
PGP Fingerprint: 3B74 637D 8409 53F9 A704 F27C BEA5 286D A9CF 4A88
PGP Key:
https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xBEA5286DA9CF4A88

Tomcsányi, Domonkos

unread,
Jan 8, 2016, 11:54:03 AM1/8/16
to Matej Kovacic, gr-gsm
You need to cross compile it. There is probably a cross compiler available for RPi.
It is a nice idea to try running gr-gsm on an rpi, a little bit crazy :D

Good luck!
Domi

Az iPhone-omról küldve
> --
> Otrzymujesz tę wiadomość, ponieważ subskrybujesz grupę dyskusyjną Google o nazwie „gr-gsm”.
>
> Aby anulować subskrypcję tej grupy i przestać otrzymywać od niej wiadomości, wyślij e-maila na gr-gsm+un...@googlegroups.com.
> Aby zamieszczać posty w tej grupie, wyślij e-mail na adres gr-...@googlegroups.com.
> Aby wyświetlić tę dyskusję w internecie, odwiedź stronę https://groups.google.com/d/msgid/gr-gsm/568FE083.4040309%40owca.info.
> Więcej opcji znajdziesz na https://groups.google.com/d/optout

Matej Kovacic

unread,
Jan 8, 2016, 1:01:24 PM1/8/16
to gr-...@googlegroups.com
Hi,

> You need to cross compile it. There is probably a cross compiler available for RPi.
> It is a nice idea to try running gr-gsm on an rpi, a little bit crazy :D

In fact I tried to crosscompile it, I will post my recipes later, but I
was unsuccessfull.

Anyway, I increased swap file size:
- sudo nano /etc/dphys-swapfile, set CONF_SWAPSIZE=1024 and then
- sudo /etc/init.d/dphys-swapfile stop
- sudo /etc/init.d/dphys-swapfile start

After that compile was successfull!!!

I also did sudo ldconfig.

But now I am getting segmentation fault:

pi@raspberrypi:~/gr-gsm/build $ airprobe_rtlsdr_scanner.py -p 25
linux; GNU C++ version 4.9.1; Boost_105500; UHD_003.007.003-0-unknown

Segmentation fault

Any idea?

P. S. I want to create a network of RPi gr-gsm sensors to constant
monitor GSM networks and do some anomaly analysis. Tha is why I would
like to run gr-gsm on RPi - it is cheap and could be mass deployed. :-)

Regards,

Matej

Tomcsányi, Domonkos

unread,
Jan 8, 2016, 1:13:06 PM1/8/16
to Matej Kovacic, gr-...@googlegroups.com
Good idea to increase the swap size, shame that you have that weird error.
I'm not sure about the processing power if the rpi maybe you would be better of simply forwarding the raw data from the air and do the post processing on a PC. I think there was some kind of rtl-sdr forwarder that worked over the network, and maybe there was an input module for it in gnuradio, but I'm not sure.
Just my 2 cents :)

Cheers,
Domi

Az iPhone-omról küldve
> --
> Otrzymujesz tę wiadomość, ponieważ subskrybujesz grupę dyskusyjną Google o nazwie „gr-gsm”.
>
> Aby anulować subskrypcję tej grupy i przestać otrzymywać od niej wiadomości, wyślij e-maila na gr-gsm+un...@googlegroups.com.
> Aby zamieszczać posty w tej grupie, wyślij e-mail na adres gr-...@googlegroups.com.
> Aby wyświetlić tę dyskusję w internecie, odwiedź stronę https://groups.google.com/d/msgid/gr-gsm/568FF970.4010106%40owca.info.

Matej Kovacic

unread,
Jan 9, 2016, 2:06:31 AM1/9/16
to gr-...@googlegroups.com
Hi,

> I'm not sure about the processing power if the rpi maybe you would be better of simply forwarding the raw data from the air and do the post processing on a PC. I think there was some kind of rtl-sdr forwarder that worked over the network, and maybe there was an input module for it in gnuradio, but I'm not sure.
Huh, that would be an iteresting problem for me, since I am not a
programmer... However, running gr-gsm on RPi alone means greater
independence. So it is a worth to try. :-)

BTTW, Kalibrate is working, so I assume gr-gsm could also be working.

Anyway, I run a strace and got this:

read(17, "", 1024) = 0
close(17) = 0
munmap(0xb6fa1000, 4096) = 0
write(1, "Using Volk machine: generic_orc\n", 32) = 32
write(2, "VOLK: Error allocating memory (p"..., 51) = 51
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV +++
Segmentation fault


It seems there is a problem with VOLK machine.

I found this thread:
https://gnuradio.org/redmine/issues/692

Any idea?

Regards,

M.

Matej Kovacic

unread,
Jan 9, 2016, 3:18:47 AM1/9/16
to gr-...@googlegroups.com
Hi,

here is my receipt for cooking gr-gsm on RPi. I hope someone else find
it useful.


1. Prepare base system
======================
Install Debian/Raspbian Jessie (2015-11-21) on RPi
Connect to device via ssh, change password (passwd), upgrade device
(sudo apt-get update && sudo apt-get upgrade), extend space on a SD card
(sudo raspi-config - Expand space; sudo reboot), optionally add VNC
access (sudo apt-get install tightvncserver, tightvncserver, run it:
vncserver :1 -geometry 1024x728 -depth 24 // kill it: vncserver -kill :1)


2. Install Kalibrate
====================
sudo apt-get install librtlsdr0 librtlsdr-dev
sudo apt-get install libtool autoconf automake libfftw3-dev
git clone https://github.com/asdil12/kalibrate-rtl.git
cd kalibrate-rtl
git init
git checkout arm_memory
./bootstrap
./configure
make
sudo make install


3. Set access to USB device
===========================
lsusb
Bus 001 Device 004: ID 0bda:2832 Realtek Semiconductor Corp. RTL2832U DVB-T
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

sudo nano /etc/udev/rules.d/20.rtlsdr.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2832",
GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

sudo reboot


4. Kalibrate
============
kal -s GSM900

Found 1 device(s):
0: Generic RTL2832U

Using device 0: Generic RTL2832U
Found Rafael Micro R820T tuner
Exact sample rate is: 270833.002142 Hz
kal: Scanning for GSM-900 base stations.
GSM-900:
chan: 1 (935.2MHz - 33.430kHz) power: 55085.23
chan: 3 (935.6MHz - 34.130kHz) power: 63242.36
...
chan: 124 (959.8MHz - 32.429kHz) power: 247404.23


kal -c 112

...
average absolute error: 25.197 ppm


5. Install prerequisites for gr-gsm
===================================
sudo apt-get install cmake libboost-all-dev libcppunit-dev swig doxygen
liblog4cpp5-dev python-scipy
sudo apt-get install gnuradio
sudo apt-get install build-essential libtool shtool autoconf automake
git-core pkg-config make gcc
sudo apt-get install libpcsclite-dev
sudo apt-get install libtalloc-dev
git clone git://git.osmocom.org/libosmocore.git
cd libosmocore/
autoreconf -i
./configure
make
sudo make install
sudo ldconfig -i
cd ..
sudo apt-get install gnuradio gr-osmosdr rtl-sdr


6. Install gr-gsm
=================
git clone https://github.com/ptrkrysik/gr-gsm.git
cd gr-gsm
mkdir build
cd build
cmake ..


sudo nano /etc/dphys-swapfile

CONF_SWAPSIZE=1024

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start

free -m

make
sudo make install

sudo ldconfig


7. Run GSM scanner
==================
airprobe_rtlsdr_scanner.py -p 25


Regards,

Matej

Tomcsányi, Domonkos

unread,
Jan 9, 2016, 4:20:29 AM1/9/16
to Matej Kovacic, gr-...@googlegroups.com
Well how did you get GNUradio installed? From a repo? What version?

According to the thread your bug is patched in some versions already :).

Cheers,
Domi
> --
> Otrzymujesz tę wiadomość, ponieważ subskrybujesz grupę dyskusyjną Google o nazwie „gr-gsm”.
>
> Aby anulować subskrypcję tej grupy i przestać otrzymywać od niej wiadomości, wyślij e-maila na gr-gsm+un...@googlegroups.com.
> Aby zamieszczać posty w tej grupie, wyślij e-mail na adres gr-...@googlegroups.com.
> Aby wyświetlić tę dyskusję w internecie, odwiedź stronę https://groups.google.com/d/msgid/gr-gsm/5690B174.1060002%40owca.info.

Piotr Krysik

unread,
Jan 9, 2016, 4:41:04 AM1/9/16
to gr-...@googlegroups.com
W dniu 08.01.2016 o 19:01, Matej Kovacic pisze:
> Hi,
>
>> You need to cross compile it. There is probably a cross compiler available for RPi.
>> It is a nice idea to try running gr-gsm on an rpi, a little bit crazy :D
>
> In fact I tried to crosscompile it, I will post my recipes later, but I
> was unsuccessfull.
>
> Anyway, I increased swap file size:
> - sudo nano /etc/dphys-swapfile, set CONF_SWAPSIZE=1024 and then
> - sudo /etc/init.d/dphys-swapfile stop
> - sudo /etc/init.d/dphys-swapfile start
>
> After that compile was successfull!!!
>
> I also did sudo ldconfig.
>
> But now I am getting segmentation fault:
>
> pi@raspberrypi:~/gr-gsm/build $ airprobe_rtlsdr_scanner.py -p 25
> linux; GNU C++ version 4.9.1; Boost_105500; UHD_003.007.003-0-unknown
>
> Segmentation fault
>
> Any idea?
>

Hi Matej,

I was getting many Segmentation faults recently. I've found out that the
reason was that I had another version of rtl-sdr related libraries
installed on my computer from repository. Probably gr-osmosdr was trying
to use this library, but it was built with use of another version of the
library that was compiled from source.

Maybe you got into similar problem?

Best Regards,
Piotr

Matej Kovacic

unread,
Jan 9, 2016, 4:45:39 AM1/9/16
to gr-...@googlegroups.com
Hi,

> I was getting many Segmentation faults recently. I've found out that the
> reason was that I had another version of rtl-sdr related libraries
> installed on my computer from repository. Probably gr-osmosdr was trying
> to use this library, but it was built with use of another version of the
> library that was compiled from source.
>
> Maybe you got into similar problem?

Hmm, should I try to compile and install gr-osmosdr from the source?

Regards,

M.

Piotr Krysik

unread,
Jan 9, 2016, 5:00:55 AM1/9/16
to gr-...@googlegroups.com
W dniu 09.01.2016 o 10:45, Matej Kovacic pisze:
> Hi,
>
>> I was getting many Segmentation faults recently. I've found out that the
>> reason was that I had another version of rtl-sdr related libraries
>> installed on my computer from repository. Probably gr-osmosdr was trying
>> to use this library, but it was built with use of another version of the
>> library that was compiled from source.
>>
>> Maybe you got into similar problem?
>
> Hmm, should I try to compile and install gr-osmosdr from the source?
>

No, you should check in /usr/local if you don't have installed in there
dependencies of gr-gsm that are also installed from distribution's
repository.

--
Best Regards,
Piotr Krysik

Matej Kovacic

unread,
Jan 9, 2016, 9:10:02 AM1/9/16
to gr-...@googlegroups.com
Hi,

> No, you should check in /usr/local if you don't have installed in there
> dependencies of gr-gsm that are also installed from distribution's
> repository.

This is what I have there:

ls /usr/local/include/ -lha
total 16K
drwxrwsr-x 4 root staff 4.0K Jan 8 16:49 .
drwxrwsr-x 11 root staff 4.0K Jan 6 05:46 ..
drwxr-sr-x 8 root staff 4.0K Jan 8 16:49 grgsm
drwxr-sr-x 10 root staff 4.0K Jan 8 10:14 osmocom


BTW, I can connect to RPi via VNC, run gnuradio-companion and open the
file ~/gr_gsm/apps/airprobe_rtlsdr.grc

When I try to execute it, I got error:

VOLK: Error allocating memory (posix_memalign: 22)

Regards,

Matej

Matej Kovacic

unread,
Jan 9, 2016, 3:18:03 PM1/9/16
to gr-...@googlegroups.com
Hi,

> When I try to execute it, I got error:
>
> VOLK: Error allocating memory (posix_memalign: 22)
Hmm, now I installed the VOLK patch:

mkdir gnuradio
cd gnuradio
wget http://gnuradio.org/releases/gnuradio/gnuradio-3.7.5.tar.gz
tar xvzf gnuradio-3.7.5.tar.gz
cd gnuradio-3.7.5

wget
http://gnuradio.org/redmine/attachments/download/821/0001-volk-Fix-volk_malloc-when-alignment-is-1.patch
patch -p1 < *volk*.patch

mkdir build
cd build
cmake -DENABLE_DEFAULT=Off -DENABLE_VOLK=True -Dhave_mfpu_neon=0 ..
make
sudo make install

And now I got a little diferent error running airprobe_rtlsdr_scanner.py
-p 24:

write(1, "Using Volk machine: generic_orc\n", 32) = 32
write(2, "VOLK: Error allocating memory (p"..., 51) = 51
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV +++
Segmentation fault


Tomcsányi Domonkos

unread,
Jan 9, 2016, 4:33:13 PM1/9/16
to Matej Kovacic, gr-...@googlegroups.com
I think the problem is that you installed GNUradio from a repository which contains the wrong Volk machine library. I’m afraid you need to recompile GNUradio against the new, patched version of Volk.

Cheers,
Domi
> --
> Otrzymujesz tę wiadomość, ponieważ subskrybujesz grupę dyskusyjną Google o nazwie „gr-gsm”.
>
> Aby anulować subskrypcję tej grupy i przestać otrzymywać od niej wiadomości, wyślij e-maila na gr-gsm+un...@googlegroups.com.
> Aby zamieszczać posty w tej grupie, wyślij e-mail na adres gr-...@googlegroups.com.
> Aby wyświetlić tę dyskusję w internecie, odwiedź stronę https://groups.google.com/d/msgid/gr-gsm/56916AF7.2040206%40owca.info.

Matej Kovacic

unread,
Jan 12, 2016, 2:23:54 AM1/12/16
to Tomcsányi Domonkos, gr-...@googlegroups.com
Hi,

> I think the problem is that you installed GNUradio from a repository
> which contains the wrong Volk machine library. I’m afraid you need to
> recompile GNUradio against the new, patched version of Volk.

OK, I managed to manually compile and install gnuradio-3.7.9 on RPi.

Now... when I run:
airprobe_rtlsdr_scanner.py -p 25

I get nothing:
linux; GNU C++ version 4.9.1; Boost_105500; UHD_003.007.003-0-unknown


Anyway, running airprobe_rtlsdr.py from VNC console gives me this error:

linux; GNU C++ version 4.9.1; Boost_105500; UHD_003.007.003-0-unknown

Xlib: extension "RANDR" missing on display ":1.0".
gr-osmosdr 0.1.3 (0.1.3) gnuradio 3.7.5
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf
bladerf rfspace airspy
Using device #0 Realtek RTL2838UHIDIR
Found Elonics E4000 tuner
Exact sample rate is: 2000000.052982 Hz
Using Volk machine: generic
Could not find port: constant_msg in:
constant_msg
system

Traceback (most recent call last):
File "/usr/local/bin/airprobe_rtlsdr.py", line 270, in <module>
tb = airprobe_rtlsdr(fc=options.fc, gain=options.gain,
ppm=options.ppm, samp_rate=options.samp_rate, shiftoff=options.shiftoff)
File "/usr/local/bin/airprobe_rtlsdr.py", line 151, in __init__
samp_rate_in=samp_rate,
File "/usr/local/lib/python2.7/dist-packages/grgsm/gsm_input.py", line
51, in __init__
samp_rate_in=samp_rate_in,
File
"/usr/local/lib/python2.7/dist-packages/grgsm/clock_offset_corrector.py", line
64, in __init__
self.msg_connect(self, "ppm_in",
self.gsm_controlled_const_source_f_0, "constant_msg")
File
"/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py",
line 59, in wrapped
func(self, src.to_basic_block(), srcport, dst.to_basic_block(), dstport)
File
"/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py",
line 131, in msg_connect
self.primitive_msg_connect(*args)
File
"/usr/local/lib/python2.7/dist-packages/gnuradio/gr/runtime_swig.py",
line 3043, in primitive_msg_connect
return _runtime_swig.hier_block2_sptr_primitive_msg_connect(self, *args)
RuntimeError: invalid msg port in connect() or disconnect()


If I open airprobe_rtlsdr.grc manually in Gnuradio-companion, I can see
"Missing block key: rtlsdr_source". Gnuradio console says: "Error: Block
key 'rtlsdr_source' not found".

Flow graph error is: "Error 0: Block - blocks_rotator_cc_0 -
Rotator(blocks_rotator_cc): Sink - in(0): Port is not connected.

Any idea?
Reply all
Reply to author
Forward
0 new messages