dgiardini / rtl-ais

A simple AIS tuner and generic dual-frequency FM demodulator
Other
266 stars 89 forks source link

This is not a PR !! #15

Closed MatsA closed 4 years ago

MatsA commented 5 years ago

Sorry but couldn't create an "Issue", so trying this way instead.

I really like this software and have written a blogpost about it for some time ago https://pysselilivet.blogspot.com/2018/06/ais-reciever-for-raspberry.html

but now there are two issues on RPi 4 and buster

1/ A bug which soon will be fixed https://github.com/raspberrypi/linux/issues/3060 2/ I'm a C newbie and can't compile the code, but it works nice on RPi 3 and Stretch. Please check log below. Any ideas ?

i@raspberrypi:~/rtl-ais $ make 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 tortlsdr_read_async' /usr/bin/ld: rtl_ais.o: in function rtl_ais_start': /home/pi/rtl-ais/rtl_ais.c:570: undefined reference tortlsdr_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 tortlsdr_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 functionrtl_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 tortlsdr_cancel_async' /usr/bin/ld: /home/pi/rtl-ais/rtl_ais.c:673: undefined reference to rtlsdr_close' /usr/bin/ld: convenience.o: in functionnearest_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 tortlsdr_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 functionverbose_set_frequency': /home/pi/rtl-ais/convenience.c:142: undefined reference to rtlsdr_set_center_freq' /usr/bin/ld: convenience.o: in functionverbose_set_sample_rate': /home/pi/rtl-ais/convenience.c:154: undefined reference to rtlsdr_set_sample_rate' /usr/bin/ld: convenience.o: in functionverbose_direct_sampling': /home/pi/rtl-ais/convenience.c:166: undefined reference to rtlsdr_set_direct_sampling' /usr/bin/ld: convenience.o: in functionverbose_offset_tuning': /home/pi/rtl-ais/convenience.c:183: undefined reference to rtlsdr_set_offset_tuning' /usr/bin/ld: convenience.o: in functionverbose_auto_gain': /home/pi/rtl-ais/convenience.c:195: undefined reference to rtlsdr_set_tuner_gain_mode' /usr/bin/ld: convenience.o: in functionverbose_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 tortlsdr_set_tuner_gain' /usr/bin/ld: convenience.o: in function verbose_ppm_set': /home/pi/rtl-ais/convenience.c:226: undefined reference tortlsdr_set_freq_correction' /usr/bin/ld: convenience.o: in function verbose_ppm_eeprom': /home/pi/rtl-ais/convenience.c:241: undefined reference tortlsdr_get_usb_strings' /usr/bin/ld: convenience.o: in function verbose_reset_buffer': /home/pi/rtl-ais/convenience.c:266: undefined reference tortlsdr_reset_buffer' /usr/bin/ld: convenience.o: in function verbose_device_search': /home/pi/rtl-ais/convenience.c:277: undefined reference tortlsdr_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 tortlsdr_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 tortlsdr_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 tortlsdr_get_device_name' collect2: error: ld returned 1 exit status make: *** [Makefile:56: rtl_ais] Error 1

dgiardini commented 5 years ago

Hi !

Seems that you don't have installed the librtlsdr, or the compiler can't link to that lib. Please check if the librtlsd is already installed. Also try running "make clean" inside the rtl-ais dir before "make" so all the objects files will be recompiled.

David

On Sun, Jul 14, 2019 at 12:28 PM MatsA notifications@github.com wrote:

Sorry but couldn't create an "Issue", so trying this way instead.

I really like this software and have written a blogpost about it for some time ago https://pysselilivet.blogspot.com/2018/06/ais-reciever-for-raspberry.html

but now there are two issues on RPi 4 and buster

1/ A bug which soon will be fixed raspberrypi/linux#3060 https://github.com/raspberrypi/linux/issues/3060 2/ I'm a C newbie and can't compile the code, but it works nice on RPi 3 and Stretch. Please check log below. Any ideas ?

i@raspberrypi:~/rtl-ais $ make 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:56: rtl_ais] Error 1

You can view, comment on, or merge this pull request online at:

https://github.com/dgiardini/rtl-ais/pull/15 Commit Summary

  • This is not a PR !!

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dgiardini/rtl-ais/pull/15?email_source=notifications&email_token=ADBJPTZLNDQUTO3TIXDPG3TP7NA2ZA5CNFSM4IDQU5SKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7C3VLA, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBJPT3JGKZDGXSSHA4ZT5LP7NA2ZANCNFSM4IDQU5SA .

MatsA commented 5 years ago

Hi and thanks for Your quick answer and time. Started all over with a fresh Buster Lite install on a RPi 4 which ended up with the same fault. Please find enclosed the installation log and hope that it will give a hint. Did a sudo find -name "librtlsdr*" at the end. Thanks Mats rtl-ais_install_2019-07-15.txt

dgiardini commented 5 years ago

The librtlsdr is located in a unusual place: /usr/lib/arm-linux-gnueabihf/ That should be handled by the Makefile. The line "LDFLAGS+=$(shell pkg-config --libs librtlsdr)" should return that path. You can test this from a command line running

pkg-config --libs librtlsdr

; that should show you the path.

If the path is empty or is pointing to other place, there is some issue with the rtlsdr package.

Anyway you sholud be able to compile editing the Makefile, look at the 3rd line and change it to: LDFLAGS+=-lpthread -lm -L /usr/lib/arm-linux-gnueabihf/

-D

On Mon, Jul 15, 2019 at 4:00 AM MatsA notifications@github.com wrote:

Hi and thanks for Your quick answer and time. Started all over with a fresh Buster Lite install on a RPi 4 which ended up with the same fault. Please find enclosed the installation log and hope that it will give a hint. Did a sudo find -name "librtlsdr*" at the end. Thanks Mats rtl-ais_install_2019-07-15.txt https://github.com/dgiardini/rtl-ais/files/3391117/rtl-ais_install_2019-07-15.txt

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dgiardini/rtl-ais/pull/15?email_source=notifications&email_token=ADBJPT7BNU5TE7E47NSH3H3P7QOBNA5CNFSM4IDQU5SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ43OBQ#issuecomment-511293190, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBJPT54H667LOM4AU6ZBXDP7QOBNANCNFSM4IDQU5SA .

--

This message represents the official view of the voices in my head

MatsA commented 5 years ago

.... getting closer $ pkg-config --libs librtlsdr just returned -L -lrtlsdr which seems to be wrong, so edited the Makefile and changed to LDFLAGS+=-lpthread -lm /usr/lib/arm-linux-gnueabihf/, without the "-L" it worked better. and the compile vent much further but still some error. Please check enclosed log file. rtl-ais_install_2019-07-15_II.txt

dgiardini commented 5 years ago

Ok, try this (Makefile, line 3)

LDFLAGS+=-lpthread -lm -lrtlsdr -L /usr/lib/arm-linux-gnueabihf/

You're are telling the compiler to use lib rtlsdr and add /usr/lib/arm-linux-gnueabihf/ to the lib search path. Hope this helps -D

On Mon, Jul 15, 2019 at 12:58 PM MatsA notifications@github.com wrote:

.... getting closer $ pkg-config --libs librtlsdr just returned -L -lrtlsdr which seems to be wrong, so edited the Makefile and changed to LDFLAGS+=-lpthread -lm /usr/lib/arm-linux-gnueabihf/, without the "-L" it worked better. and the compile vent much further but still some error. Please check enclosed log file. rtl-ais_install_2019-07-15_II.txt https://github.com/dgiardini/rtl-ais/files/3393141/rtl-ais_install_2019-07-15_II.txt

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dgiardini/rtl-ais/pull/15?email_source=notifications&email_token=ADBJPTYSGWZH2PI2OAYROLDP7SNC7A5CNFSM4IDQU5SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ6EVXQ#issuecomment-511462110, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBJPT2VQOCYX5BGMSQZQMLP7SNC7ANCNFSM4IDQU5SA .

--

This message represents the official view of the voices in my head

MatsA commented 5 years ago

Nice ! Worked ! Thanks for the help, really appreciated.

pi@raspberrypi:~/rtl-ais $ file rtl_ais rtl_ais: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=b2dd7b7de7da563e0836a174e9f4e63d9826600f, with debug_info, not stripped

Is there someone who should be notified about the pkg "thing" ? /Mats

dgiardini commented 5 years ago

Is there someone who schould be notified about the pkg "thing" ?

I don't know who is it, would be nice to locate the mantainer of the rtlsdr package and telling about this. I think the problem is the weird path where the lib was copied; it should be tipically in /usr/lib

David

MatsA commented 5 years ago

Hi ! Seems that this is already reported https://bugs.launchpad.net/ubuntu/+source/rtl-sdr/+bug/1831387

FredericGuilbault commented 4 years ago

FTR, I just test it with my setup and it. Also append on minimal Debian buster, armbian(Pine64so), qemu-armhf and qemu-arm64.

So pretty much anywhere I could test it.

FredericGuilbault commented 4 years ago

Maybe it's time to close this tread