OpenSatelliteProject icon indicating copy to clipboard operation
OpenSatelliteProject copied to clipboard

Linking error during compilation of demodulator

Open 5l1v3r1 opened this issue 5 years ago • 7 comments

[ 90%] Building CXX object CMakeFiles/xritDemodulator.dir/src/demodulator.cpp.o [100%] Linking CXX executable xritDemodulator /usr/bin/ld: CMakeFiles/xritDemodulator.dir/src/RtlFrontend.cpp.o: in function RtlFrontend::Start()': RtlFrontend.cpp:(.text+0x528): undefined reference to rtlsdr_set_tuner_gain_ext' /usr/bin/ld: CMakeFiles/xritDemodulator.dir/src/RtlFrontend.cpp.o: in function RtlFrontend::SetLNAGain(unsigned char)': RtlFrontend.cpp:(.text+0x1ce): undefined reference to rtlsdr_set_tuner_gain_ext' /usr/bin/ld: CMakeFiles/xritDemodulator.dir/src/RtlFrontend.cpp.o: in function RtlFrontend::SetVGAGain(unsigned char)': RtlFrontend.cpp:(.text+0x1fe): undefined reference to rtlsdr_set_tuner_gain_ext' /usr/bin/ld: CMakeFiles/xritDemodulator.dir/src/RtlFrontend.cpp.o: in function RtlFrontend::SetMixerGain(unsigned char)': RtlFrontend.cpp:(.text+0x22e): undefined reference to rtlsdr_set_tuner_gain_ext' /usr/bin/ld: CMakeFiles/xritDemodulator.dir/src/RtlFrontend.cpp.o: in function RtlFrontend::refreshGains()': RtlFrontend.cpp:(.text+0xb3a): undefined reference to rtlsdr_set_tuner_gain_ext' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/xritDemodulator.dir/build.make:219: xritDemodulator] Error 1 make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/xritDemodulator.dir/all] Error 2 make: *** [Makefile:152: all] Error 2

librtlsdr is installed from your branch.

5l1v3r1 avatar May 25 '20 22:05 5l1v3r1

well i fixed it by forcing deb packages install provided at the branch librtlsdr librtlsdr-dev and rtl-sdr upgraded to 0.7.0 from 0.6.0 i think i installed everything now trying to figure how to use it :)

5l1v3r1 avatar May 26 '20 01:05 5l1v3r1

I have the same problem on Debian buster. To begin it wont accept the myriadrf repositories PGP. But GNU radio and working RTL divers are in the the distro install. Most likely a different version.

Add upstream drivers and gnuradio modules from myriadrf

sudo add-apt-repository ppa:myriadrf/drivers -y sudo add-apt-repository ppa:myriadrf/gnuradio -y

All builds good till almost the same point linking.

make[3]: Entering directory '/home/hca/OSP/xritdemod/demodulator/build' [ 9%] Linking CXX executable xritDemodulator /usr/bin/ld: CMakeFiles/xritDemodulator.dir/src/RtlFrontend.cpp.o: in function RtlFrontend::Start()': RtlFrontend.cpp:(.text+0x528): undefined reference to rtlsdr_set_tuner_gain_ext'

Can you tell me where you got and how to force the debs you mentioned?

vk-hca avatar Jun 06 '20 10:06 vk-hca

@vk3-hca I usually use this for compiling: https://github.com/librtlsdr/librtlsdr

I'm not sure the myriadrf ppa are up to date.

The CI itself builds LimeSuite and librtlsdr from scratch: https://github.com/opensatelliteproject/SatHelperApp/blob/master/.travis.yml#L15-L39

racerxdl avatar Jun 06 '20 18:06 racerxdl

Btw I would suggest using SatHelperApp instead of xritdecoder / demod and goesdump. Its a all in one application with better features: https://github.com/opensatelliteproject/SatHelperApp

Its available on snap, so no need to compile anything or install deb packages. Everything is packed inside :D

racerxdl avatar Jun 06 '20 18:06 racerxdl

Thanks for the reply, I have had a few more tries at it since your response and messed about with it a lot in that time. Yes its using the same librtlsdr as you.

I suspect its the GCC in this Debian stable is a bit strict. It compiles your code without warning but with librtlsdr it compiles but it throws up a lot of warnings. like these: warning: this statement may fall through [-Wimplicit-fallthrough=] warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation] warning: comparison of integer expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] warning: macro expands to multiple statements [-Wmultistatement-macros]

I tried with another librtlsdr source more with updates this year. https://github.com/steve-m/librtlsdr This compiles without any warning at all in the make and install librtlsdr passes so I thought It was all ok but it still failed on the final make as before. I am guessing the compiler warnings are due to Debian stable being newer and stricter. I don't understand it not coming through in the version you are using with warnings but no fail.

Either way the end result is the same building xritDemodulator [ 9%] Linking CXX executable xritDemodulator /usr/bin/ld: CMakeFiles/xritDemodulator.dir/src/RtlFrontend.cpp.o: in function RtlFrontend::Start()': RtlFrontend.cpp:(.text+0x528): undefined reference to rtlsdr_set_tuner_gain_ext'

So for now I am working at getting the library you use to build in Debian using the other one as a guide. It will me take a little while learning as I go.

vk-hca avatar Jun 09 '20 13:06 vk-hca

Also I also took your advice and tried SatHelperApp.

As before it would not accept the Golang repository ppa but the distro has golangv1.11which should suffice. BTW Its Debian buster 64bit stable should any one read this with the same issue.

So all is good building installing libSatHelper and libAirspy but the go command fails at : go get github.com/OpenSatelliteProject/SatHelperApp comand fails as below. The archive has the same 0.5.2 version number, I cant really figure what module go looking for. I have not used go before but looked in go.mod for a clue with no success, I assume it found github.com/prometheus/client_golang v0.9.1 ok before failing on your archive.

After that it just downloads from github and ends, no attempt to build. Removing and reinstalling golang, its .cache directrory, the download, and its still the same.

I tried to figure out the fail in downloading and how it worked but when it also would not build a second time I decided to wait on it. I have never used golang before so I decided I should work the compiler issue above first.

vk-hca avatar Jun 09 '20 14:06 vk-hca

I forgot to add above the https://github.com/steve-m/librtlsdr repository that compiles with out errors does not seem to have the "rtlsdr_set_tuner_gain_ext" function. Hence using it as a guide to try and track down the compiler errors I get with https://github.com/librtlsdr/librtlsdr

vk-hca avatar Jun 09 '20 14:06 vk-hca