AIS receiver on a Raspberry Pi with RTL-SDR

The automatic identification system (AIS) is an automatic tracking system that uses transponders on ships and is used by vessel traffic services (VTS). AIS information supplements marine radar, which continues to be the primary method of collision avoidance for water transport.

1. System update

sudo apt-get update
sudo apt-get upgrade

2. RTL-SDR software installation

Install required software for compilation :

sudo apt-get install git cmake libusb-1.0-0-dev build-essential

Clone software from Github :

git clone git://git.osmocom.org/rtl-sdr.git

Move to folder, compile, install and reboot :

cd  rtl-sdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
cd ~
sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
sudo reboot

Then we can test :

rtl_test 

You might have the following issue :

Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM

Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.

usb_claim_interface error -6
Failed to open rtlsdr device #0.

Remove the problematic driver :

sudo modprobe -r dvb_usb_rtl28xxu

Blacklist it by creating the following file :

sudo vi /etc/modprobe.d/rtl-sdr-blacklist.conf

With the following content :

blacklist dvb_usb_rtl28xxu

Then we can test again :

rtl_test 

The output should looks like :

Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
[R82XX] PLL not locked!
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode…
Allocating 15 zero-copy buffers

3. RTL-SDR dongle calibration

Go back to your home folder :

cd ~

Install required software for compilation :

sudo apt install build-essential libtool automake autoconf librtlsdr-dev libfftw3-dev

Clone software from Github :

git clone https://github.com/steve-m/kalibrate-rtl

Move to folder, compile and install :

cd kalibrate-rtl/
./bootstrap && CXXFLAGS='-W -Wall -O3'
./configure
make
sudo make install

Test it a few minutes to get a rough idea of the PPM deviation :

rtl_test -p

Output :

Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
Reporting PPM error measurement every 10 seconds…
Press ^C after a few minutes.
Reading samples in async mode…
lost at least 168 bytes
real sample rate: 2047684 current PPM: -154 cumulative PPM: -154
real sample rate: 2048101 current PPM: 50 cumulative PPM: -52
real sample rate: 2048077 current PPM: 38 cumulative PPM: -22
real sample rate: 2048198 current PPM: 97 cumulative PPM: 8
real sample rate: 2048066 current PPM: 33 cumulative PPM: 13
real sample rate: 2048093 current PPM: 46 cumulative PPM: 18
real sample rate: 2048072 current PPM: 36 cumulative PPM: 21
real sample rate: 2047986 current PPM: -6 cumulative PPM: 17
real sample rate: 2048079 current PPM: 39 cumulative PPM: 20
real sample rate: 2048108 current PPM: 53 cumulative PPM: 23
real sample rate: 2048037 current PPM: 18 cumulative PPM: 23
^CSignal caught, exiting!

User cancel, exiting…
Samples per million lost (minimum): 0

We’ll keep 23 as a rough PPM value at this stage.

Start to search for 900Mhz GSM stations :

kal -s 900 -g 49.6 -e 23

Output :

Found 1 device(s):
0: Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 270833.002142 Hz
[R82XX] PLL not locked!
Setting gain: 49.6 dB
kal: Scanning for GSM-900 base stations.
GSM-900:
chan: 2 (935.4MHz – 16.587kHz) power: 869529.54
chan: 4 (935.8MHz + 38.960kHz) power: 2190452.67
chan: 5 (936.0MHz – 16.799kHz) power: 4623109.31
chan: 15 (938.0MHz + 38.865kHz) power: 815597.24
chan: 16 (938.2MHz – 15.502kHz) power: 2225985.25
chan: 20 (939.0MHz + 38.956kHz) power: 1047025.60
chan: 78 (950.6MHz – 12.733kHz) power: 3137623.08
chan: 123 (959.6MHz – 12.483kHz) power: 1856407.90

Then let’s find the PPM using here the channel 5 (as it is the stronger) :

kal -c 5 -g 49.6 -e 23

Output :

Found 1 device(s):
0: Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 270833.002142 Hz
[R82XX] PLL not locked!
Setting gain: 49.6 dB
kal: Calculating clock frequency offset.
Using GSM-900 channel 5 (936.0MHz)
average [min, max] (range, stddev)
– 11.901kHz [-11934, -11871] (63, 18.615683)
overruns: 0
not found: 0
average absolute error: 35.715 ppm

Our average absolute error is 35.715 ppm !

4. RTL-AIS Software

Go back to your home folder :

cd ~

Clone software from Github :

git clone https://github.com/dgiardini/rtl-ais

Move to folder, compile and install :

cd rtl-ais
make

Then we can run the software :

./rtl_ais -p 35 -n -h 192.168.1.15

-p 35 : Software deviation in PPM found during the previous calibration.
-n : Log AIS messages to console.
-h : Send AIS data to the mentioned IP. Here, our desktop computer with OpenCPN.

Output :

Edge tuning disabled.
DC filter enabled.
RTL AGC disabled.
Internal AIS decoder enabled.
Buffer size: 163.84 mS
Downsample factor: 64
Low pass: 25000 Hz
Output: 48000 Hz
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Log NMEA sentences to console ON
AIS data will be sent to 192.168.1.15 port 10110
Tuner gain set to automatic.
Tuner error set to 35 ppm.
Tuned to 162000000 Hz.
Sampling at 1600000 S/s.
!AIVDM,1,1,,B,6>jCJckfJjOt>db70104@00,0*71
!AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnLv=Q?ih50“`b>:0,0*6A
!AIVDM,1,1,,B,6>jCJckfJjOt>db7@104@00,0*01
!AIVDM,1,1,,A,6>jCJckfJjOt>db70104@00,0*72
!AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnLn=Q?j@50“`b>:0,0*59
!AIVDM,1,1,,B,6>jCJckfJjOt>db70104@00,0*71
!AIVDM,1,1,,A,6>jCJckfJjOt>db5P104@00,0*10
!AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnM4=Q?ih50“`b>:0,0*29
!AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnLv=Q?gh50“`b>:0,0*64
!AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnLm=Q?k050“`b>:0,0*2B
!AIVDM,1,1,,B,6>jCJckfJjOt>db70104@00,0*71
!AIVDM,1,1,,A,33IWVk0Ohvwma3BK1nlAIQ@L01vP,0*64
!AIVDM,1,1,,B,33IWVk0Ohrwma5vK1o2QRQFV00qh,0*27
!AIVDM,1,1,,A,13IWVk0Ohrwma74K1o;iS1Hd0L10,0*6E
!AIVDM,1,1,,B,33IWVk000bwmabjK1pdC8jBj01r0,0*33
!AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnLk=Q?ih50“`b>:0,0*77
!AIVDM,1,1,,A,13IWVk000IwmbLnK1qS8;h6d08<k,0*1A !AIVDM,1,1,,B,6>jCJckfJjOt>db6h104@00,0*28
!AIVDM,1,1,,B,33IWVk0Oh5wmbIJK1qALP@l:01o@,0*31
!AIVDM,1,1,,A,33IWVk0Oh7wmbI8K1qBdEPnB00pP,0*18
!AIVDM,1,1,,B,13IWVk0Oh6wmbHVK1qCdQhpJ087:,0*69
!AIVDM,1,1,,B,33IWVk0Oh7wmbHHK1qEdDPpT013@,0*36
!AIVDM,1,1,,A,13IWVk0Oh7wmbH0K1qFt00rd05C0,0*7E
!AIVDM,1,1,,A,33IWVk0Oh8wmbGJK1qHch0rr00ih,0*26
!AIVDM,1,1,,B,13IWVk1009wmbG:K1qJ;g0s005C0,0*11
!AIVDM,1,1,,A,13IWVk1008wmbFRK1qLKl@wB0<10,0*7A
!AIVDM,1,1,,B,13IWVk1Oh6wmbDPK1qTu0Q<H05C4,0*05 !AIVDM,1,1,,A,13IWVk1Oh5wmbDfK1qW=O1@d00Rp,0*67 !AIVDM,1,1,,A,6>jCJckfJjOt>db5P104@00,0*10
!AIVDM,1,1,,B,13IWVk1Oh4wmbCnK1qadqQE000R@,0*3A
!AIVDM,1,1,,A,13IWVk1Oh3wmbCrK1qcM0iGB08Gw,0*2A
!AIVDM,1,1,,B,13IWVk1Oh3wmbD6K1qeP@1KV05C4,0*0B
!AIVDM,1,1,,A,13IWVk1003wmbChK1qh=<AN40<0w,0*44 !AIVDM,1,1,,B,33IWVk1003wmbC@K1qje;QNH0I70,0*69 !AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnLq=Q?gh50“`b>:0,0*63
!AIVDM,1,1,,A,33IWVk1003wmbCFK1qlej1Rd0AfJ,0*48
!AIVDM,1,1,,A,13IWVk1003wmbCFK1qp@:1WB0000,0*5D
!AIVDM,1,1,,A,13IWVk1Oh1wmbCJK1qru21f40000,0*0C
!AIVDM,1,1,,B,33IWVk1001wmbBLK1qsnP1v80Dhr,0*27
!AIVDM,1,1,,A,33IWVk1000wmbCDK1qeoHAp20E<r,0*0A !AIVDM,1,1,,B,E>jCJcl32bh87ab@87a:1RP0000?rnLq=Q?j@50“`b>:0,0*46
!AIVDM,1,1,,B,6>jCJckfJjOt>db70104@00,0*71
!AIVDM,1,1,,A,E>jCJcl32bh87ab@87a:1RP0000?rnLi=Q?j@50“`b>:0,0*5D
!AIVDM,1,1,,A,6>jCJckfJjOt>db70104@00,0*72
!AIVDM,1,1,,B,6>jCJckfJjOt>db5h104@00,0*2B

This messages could be decoded online, for example here : http://ais.tbsalling.dk/

5. OpenCPN client

Here is my configuration:
– 192.168.1.12 : Raspberry Pi Zero with RTL-SDR dongle
– 192.168.1.15 : Laptop with Ubuntu desktop and OpenCPN software

Desktop OpenCPN configuration :

Using the debug window, we can check that AIS messages are well received by OpenCPN :

And AIS targets are shown on the map :

All done !

30 thoughts on “AIS receiver on a Raspberry Pi with RTL-SDR”

  1. Hello Ronan,
    Everything you write is clear and works fine sometime on the RPI 3B+. I say sometime because i constantly get te row when i use rtl_test or start the RTL_fm row
    “Reading samples in async mode…
    Allocating 15 zero-copy buffers”.
    The Ais give few seconds decoding and stops.
    I try everything to solve this zero-copy problem but no succes.
    Can you help me to solve the zero-copy problem.
    On my other RPI 3b i have no problems.

    Thansk for anwer an greetings Ger

    1. Hi Ger,

      For me the message “Reading samples in async mode…
      Allocating 15 zero-copy buffers” is not an issue and perfectly normal !

      Here is my rtl_test output :

      > rtl_test
      Found 1 device(s):
      0: Realtek, RTL2838UHIDIR, SN: 00000001

      Using device 0: Generic RTL2832U OEM
      Found Rafael Micro R820T tuner
      Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
      [R82XX] PLL not locked!
      Sampling at 2048000 S/s.

      Info: This tool will continuously read from the device, and report if
      samples get lost. If you observe no further output, everything is fine.

      Reading samples in async mode…
      Allocating 15 zero-copy buffers

  2. Hello Ronan,
    Thanks for the fast replay.
    I get the notification “lost xx samples”, as i run the rtlsdr in terminal 1 and the AIS decoder in terminal 2 then i get a few rows decoding.
    When i run rtlsdr in termional 1 and wait for instance 1 minute to run the AIS decoder in terminal 2, than i get al lot row decoding and then stops after a longer time.
    Can you tell me what is wrong, because in the older RPI 3B everything works fine.

    Someone say the problem is the librtlsdr https://github.com/steve-m/librtlsdr/commit/f68bb2fa772ad94f58c59babd78353667570630b

    Hope you can help me wherefore thanks.

    Ger

  3. after I run ./rtl_ais -p 35 -n -h 192.168.1.3
    Appears in the picture but there is no message like. ! AIVDM
    Whats wrong?

    1. Hi Faishal,

      It looks like you’re not receiving any AIS data. What is your hardware ? Are you close enough to boats ?

      Did you try to check with GQRX or SDR# on AIS frequencies to see if you receive data (161,975 MHz and 162,025 MHz).

      Ronan

      1. Thank you, AIS is running. but is this only able to receive other people’s AIS signals? can this tool emit an AIS signal so that other AIS users can recognize it?

  4. How can I receive and send AIS signals on raspberry pi3? Do I need hardware other than RTL-DR.COM?
    Please help me.

    1. Receiving is well described in this brilliant article.
      To transmit, you’ll need a class B transponder and also a station license. To obtain that, you first need a VHF certificate.

  5. Hello Ronan,

    I am running a Pi 3+ with an DVB-T Dongle based on an RTL receiver to send data to FlightRadar.
    There are two/three questions I have, but first let me say you have written a great ToDo! Thanks already.
    1) I assume I needs a second RTL Dongle to run FR24 feed and an AIS feed in parallel?
    2) Assuming the answer is yes, how do I tell AIS which dongle to use?
    3) You send the data to a second, local PC with Open CPN. How do I need to configure IP and port sending to Marinetraffic.com instead, specifically the port?

    Best Regards,
    Oliver

    1. Hi !

      Thanks.

      1) Yes you do.
      2) Check the documentation, you can specified which dongle to use by the parameter “rtl_ais [-d device_index (default: 0)]”
      3) When you register on MarineTraffic, they will give you an IP:PORT to send to data via UDP.

      Ronan

  6. If you get

    ./configure: line 5095: syntax error near unexpected token `FFTW3,’
    ./configure: line 5095: `PKG_CHECK_MODULES(FFTW3, fftw3 >= 3.0)’

    try installing pkg-config and re-running the bootstrap step

  7. wonderfull documents and software works 100% I have a Marine Traffic port and all works perfectly. Station 5305 Lunenburg NS.

    Now is it possible to send nmea data to 2 differant sites ?? I would like to feed APRS.fi data from my amateur radio station VE1FKB / VE1FM using the same system as rtl-ais on the Rasp-pi

  8. Hi all
    I have a nano 3 dongle on a raspberry pi 3b+.
    All is ok except I am a bid disappointed by the limited receiving range. I hardly got messages from boat more than 1nm away !
    What should be the reasonable range ?

  9. I built an old Pi2 with your software and a recycled VHF antenna, and it works fine – great thanks for your super-detailed description!
    The next step would be to send the AIS data via serial NMEA (0183) to a commercial plotter. Any idea how I might do that?
    I do not use a PC on board, but an old Garmin GPS620 (which works perfectly with free available German Rhine ENC charts). It’s currently linked to my VHF radio with integrated AIS decoder, so everything works fine, but the maker type of my personality would like to understand how it would work with the RasPi.

    1. Hi,

      NMEA0183 could use RS232 or RS422. The GPS620 looks to be using RS232 (one TX and one RX).

      RS232 is limited to 2 devices, so you can’t have the GPS, the VHF and the PI using this.

  10. Hi, thanks for the explanations.
    I’m searching for a solution to my problem :
    If there isn’t an AIS signal, after a few minutes, the program stops with the message “abandon”. How can I let the program run all the time ?
    My aim is to let the program run during all my navigation time. If it stops after 5 minutes because it doesn’t have a signal, I can’t use it to stay on watch.
    Thank you in advance,

    François

    0: Generic RTL2832U OEM
    Found Rafael Micro R820T tuner
    Log NMEA sentences to console ON
    AIS data will be sent to 192.168.43.52 port 10110
    Tuner gain set to automatic.
    Tuner error set to 2 ppm.
    Tuned to 162000000 Hz.
    Sampling at 1600000 S/s.
    Allocating 12 zero-copy buffers
    Abandon

  11. Hi Ronan,
    I am using Rpi4 with Nooelec NESDR XTR to track marine traffic around Lidingö, Stockholm. Your ais software works just perfect. With little antenna I am able to pick up all traffic around Värtan, Djurgården, Nacka and Strömmen (see Stockholm chart, if interested in the range).
    Many thanks, well done.

  12. Hi Ronan,
    I am using Rpi4 with Nooelec NESDR XTR to track a marine traffic around Lidingö, Stockholm. Your AIS software works just perfect. With a little antenna I am able to pick up all traffic around Värtan, Djurgården, Nacka and Strömmen (anyone interested in the range please have a look at the Stockholm chart, or just a city map).
    Many thanks, well done.
    Cheers Chris

  13. Ok until I typed kal -s 900 …..
    Bash: kal: command not found

    Not sure I did the make file with blacklist data in it right but it was working up until kal command

  14. im getting and error Kal: command not found with this line
    kal -s 900 -g 49.6 -e 23
    any ideas why i cant test this frequency

  15. Hi Ronan, can You tell me what I have to do if I have openplotter installed on Rpi3B+ and don’t use remote desktop. I see there’s rtl_sdr installed in /usr/bin and rtl_test looks OK. I don’t know what config I should add to see data in opencpn.
    Regards Przemek

  16. I was having the same problems as others here.
    “””
    collect2: error: ld returned 1 exit status
    make[2]: *** [Makefile:401: kal] Error 1
    make[2]: Leaving directory ‘/root/kalibrate-rtl/src’
    make[1]: *** [Makefile:376: all-recursive] Error 1
    make[1]: Leaving directory ‘/root/kalibrate-rtl’
    make: *** [Makefile:317: all] Error 2
    “””
    I found this advice on https://github.com/steve-m/kalibrate-rtl/issues/19

    undefined usrp_source was my issue.
    I modified /usr/local/lib/pkgconfig/librtlsdr.pc to the following to find the missing references:

    prefix=/usr
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib
    includedir=${prefix}/include

    I used “sudo nano /usr/local/lib/pkgconfig/librtlsdr.pc” to launch the editor and fix the missing variables. Then restarted from:
    cd kalibrate-rtl/
    ./bootstrap && CXXFLAGS=’-W -Wall -O3′
    ./configure
    make
    sudo make install

  17. kal does not build.

    ~/kalibrate-rtl $ sudo make install
    Making install in src
    make[1]: Entering directory ‘/home/pi/kalibrate-rtl/src’
    g++ -I/ -g -O2 -o kal kal-arfcn_freq.o kal-c0_detect.o kal-circular_buffer.o kal-fcch_detector.o kal-kal.o kal-offset.o kal-usrp_source.o kal-util.o -lfftw3 -L -lrtlsdr -lrt
    /usr/bin/ld: kal-usrp_source.o: in function `usrp_source::~usrp_source()’:
    /home/pi/kalibrate-rtl/src/usrp_source.cc:89: undefined reference to `rtlsdr_close’
    /usr/bin/ld: kal-usrp_source.o: in function `usrp_source::tune(double)’:
    /home/pi/kalibrate-rtl/src/usrp_source.cc:135: undefined reference to `rtlsdr_set_center_freq’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:140: undefined reference to `rtlsdr_get_center_freq’
    /usr/bin/ld: kal-usrp_source.o: in function `usrp_source::set_freq_correction(int)’:
    /home/pi/kalibrate-rtl/src/usrp_source.cc:150: undefined reference to `rtlsdr_set_freq_correction’
    /usr/bin/ld: kal-usrp_source.o: in function `usrp_source::set_gain(float)’:
    /home/pi/kalibrate-rtl/src/usrp_source.cc:170: undefined reference to `rtlsdr_set_tuner_gain_mode’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:175: undefined reference to `rtlsdr_set_tuner_gain’
    /usr/bin/ld: kal-usrp_source.o: in function `usrp_source::open(unsigned int)’:
    /home/pi/kalibrate-rtl/src/usrp_source.cc:191: undefined reference to `rtlsdr_get_device_count’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:199: undefined reference to `rtlsdr_get_device_name’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:202: undefined reference to `rtlsdr_get_device_name’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:206: undefined reference to `rtlsdr_open’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:213: undefined reference to `rtlsdr_set_sample_rate’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:218: undefined reference to `rtlsdr_reset_buffer’
    /usr/bin/ld: /home/pi/kalibrate-rtl/src/usrp_source.cc:218: undefined reference to `rtlsdr_reset_buffer’
    /usr/bin/ld: kal-usrp_source.o: in function `usrp_source::fill(unsigned int, unsigned int*)’:
    /home/pi/kalibrate-rtl/src/usrp_source.cc:245: undefined reference to `rtlsdr_read_sync’
    collect2: error: ld returned 1 exit status
    make[1]: *** [Makefile:403: kal] Error 1
    make[1]: Leaving directory ‘/home/pi/kalibrate-rtl/src’
    make: *** [Makefile:378: install-recursive] Error 1

    Later, there is no rtl_ais I cannot run anything.

    cd rtl-ais
    pi@raspberrypi:~/rtl-ais $ make
    cc -c main.c -o main.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c rtl_ais.c -o rtl_ais.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c convenience.c -o convenience.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    convenience.c: In function ‘atofs’:
    convenience.c:51:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
    suff *= 1e3;
    ~~~~~^~~~~~
    convenience.c:52:3: note: here
    case ‘m’:
    ^~~~
    convenience.c:54:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
    suff *= 1e3;
    ~~~~~^~~~~~
    convenience.c:55:3: note: here
    case ‘k’:
    ^~~~
    convenience.c: In function ‘atoft’:
    convenience.c:78:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
    suff *= 60;
    ~~~~~^~~~~
    convenience.c:79:3: note: here
    case ‘m’:
    ^~~~
    convenience.c:81:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
    suff *= 60;
    ~~~~~^~~~~
    convenience.c:82:3: note: here
    case ‘s’:
    ^~~~
    cc -c aisdecoder/aisdecoder.c -o aisdecoder/aisdecoder.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c aisdecoder/sounddecoder.c -o aisdecoder/sounddecoder.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c aisdecoder/lib/receiver.c -o aisdecoder/lib/receiver.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c aisdecoder/lib/protodec.c -o aisdecoder/lib/protodec.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c aisdecoder/lib/hmalloc.c -o aisdecoder/lib/hmalloc.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c aisdecoder/lib/filter.c -o aisdecoder/lib/filter.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc -c tcp_listener/tcp_listener.c -o tcp_listener/tcp_listener.o -O2 -g -Wall -W -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener -I/
    cc main.o rtl_ais.o convenience.o ./aisdecoder/aisdecoder.o ./aisdecoder/sounddecoder.o ./aisdecoder/lib/receiver.o ./aisdecoder/lib/protodec.o ./aisdecoder/lib/hmalloc.o ./aisdecoder/lib/filter.o ./tcp_listener/tcp_listener.o -o rtl_ais -lpthread -lm -L -lrtlsdr
    /usr/bin/ld: rtl_ais.o: in function `rtlsdr_thread_fn’:
    /home/pi/rtl-ais/rtl_ais.c:368: undefined reference to `rtlsdr_read_async’
    /usr/bin/ld: rtl_ais.o: in function `rtl_ais_start’:
    /home/pi/rtl-ais/rtl_ais.c:570: undefined reference to `rtlsdr_open’
    /usr/bin/ld: /home/pi/rtl-ais/rtl_ais.c:610: undefined reference to `rtlsdr_set_agc_mode’
    /usr/bin/ld: /home/pi/rtl-ais/rtl_ais.c:595: undefined reference to `rtlsdr_cancel_async’
    /usr/bin/ld: /home/pi/rtl-ais/rtl_ais.c:596: undefined reference to `rtlsdr_close’
    /usr/bin/ld: rtl_ais.o: in function `rtl_ais_cleanup’:
    /home/pi/rtl-ais/rtl_ais.c:657: undefined reference to `rtlsdr_cancel_async’
    /usr/bin/ld: /home/pi/rtl-ais/rtl_ais.c:668: undefined reference to `rtlsdr_cancel_async’
    /usr/bin/ld: /home/pi/rtl-ais/rtl_ais.c:673: undefined reference to `rtlsdr_close’
    /usr/bin/ld: convenience.o: in function `nearest_gain’:
    /home/pi/rtl-ais/convenience.c:116: undefined reference to `rtlsdr_set_tuner_gain_mode’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:121: undefined reference to `rtlsdr_get_tuner_gains’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:126: undefined reference to `rtlsdr_get_tuner_gains’
    /usr/bin/ld: convenience.o: in function `verbose_set_frequency’:
    /home/pi/rtl-ais/convenience.c:142: undefined reference to `rtlsdr_set_center_freq’
    /usr/bin/ld: convenience.o: in function `verbose_set_sample_rate’:
    /home/pi/rtl-ais/convenience.c:154: undefined reference to `rtlsdr_set_sample_rate’
    /usr/bin/ld: convenience.o: in function `verbose_direct_sampling’:
    /home/pi/rtl-ais/convenience.c:166: undefined reference to `rtlsdr_set_direct_sampling’
    /usr/bin/ld: convenience.o: in function `verbose_offset_tuning’:
    /home/pi/rtl-ais/convenience.c:183: undefined reference to `rtlsdr_set_offset_tuning’
    /usr/bin/ld: convenience.o: in function `verbose_auto_gain’:
    /home/pi/rtl-ais/convenience.c:195: undefined reference to `rtlsdr_set_tuner_gain_mode’
    /usr/bin/ld: convenience.o: in function `verbose_gain_set’:
    /home/pi/rtl-ais/convenience.c:207: undefined reference to `rtlsdr_set_tuner_gain_mode’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:212: undefined reference to `rtlsdr_set_tuner_gain’
    /usr/bin/ld: convenience.o: in function `verbose_ppm_set’:
    /home/pi/rtl-ais/convenience.c:226: undefined reference to `rtlsdr_set_freq_correction’
    /usr/bin/ld: convenience.o: in function `verbose_ppm_eeprom’:
    /home/pi/rtl-ais/convenience.c:241: undefined reference to `rtlsdr_get_usb_strings’
    /usr/bin/ld: convenience.o: in function `verbose_reset_buffer’:
    /home/pi/rtl-ais/convenience.c:266: undefined reference to `rtlsdr_reset_buffer’
    /usr/bin/ld: convenience.o: in function `verbose_device_search’:
    /home/pi/rtl-ais/convenience.c:277: undefined reference to `rtlsdr_get_device_count’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:284: undefined reference to `rtlsdr_get_device_usb_strings’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:297: undefined reference to `rtlsdr_get_device_usb_strings’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:301: undefined reference to `rtlsdr_get_device_name’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:307: undefined reference to `rtlsdr_get_device_usb_strings’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:317: undefined reference to `rtlsdr_get_device_usb_strings’
    /usr/bin/ld: /home/pi/rtl-ais/convenience.c:324: undefined reference to `rtlsdr_get_device_name’
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:59: rtl_ais] Error 1
    pi@raspberrypi:~/rtl-ais $ ./rtl_ais -p -6 -n -h 10.0.0.12
    bash: ./rtl_ais: No such file or directory
    pi@raspberrypi:~/rtl-ais $ .rtl_ais -p -6 -n -h 10.0.0.12
    bash: .rtl_ais: command not found
    pi@raspberrypi:~/rtl-ais $ ./rtl_ais -p -6 -n -h 10.0.0.12
    bash: ./rtl_ais: No such file or directory
    pi@raspberrypi:~/rtl-ais $ ls
    aisdecoder convenience.h heatmap main.o README rtl_ais.h tcp_listener
    convenience.c convenience.o main.c Makefile rtl_ais.c rtl_ais.o TODO

Leave a Reply to Faishal Cancel reply

Your email address will not be published. Required fields are marked *