Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kalibrate-rtl fails to link #35

Open
jcwren opened this issue Jan 10, 2021 · 2 comments
Open

kalibrate-rtl fails to link #35

jcwren opened this issue Jan 10, 2021 · 2 comments

Comments

@jcwren
Copy link

jcwren commented Jan 10, 2021

Installed all the perquisite packages, but it's unhappy trying to link against librtlsdr. Not sure why, it's there, ldconfig knows about it. This is on an RPi 4 with the latest Raspberry Pi OS. Any ideas?

:~/kalibrate-rtl $ uname -a
Linux raspberrypi 5.4.83-v7l+ #1379 SMP Mon Dec 14 13:11:54 GMT 2020 armv7l GNU/Linux
:~/kalibrate-rtl $
~/kalibrate-rtl $ sudo apt-get install librtlsdr-dev librtlsdr0
Reading package lists... Done
Building dependency tree
Reading state information... Done
librtlsdr-dev is already the newest version (0.6-1+rpt1).
librtlsdr0 is already the newest version (0.6-1+rpt1).
librtlsdr0 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
~/kalibrate-rtl $
~/kalibrate-rtl $ ldconfig -p | grep rtl
        librtlsdr.so.0 (libc6,hard-float) => /lib/arm-linux-gnueabihf/librtlsdr.so.0
        librtlsdr.so (libc6,hard-float) => /lib/arm-linux-gnueabihf/librtlsdr.so
~/kalibrate-rtl $

~/kalibrate-rtl $ ./bootstrap && CXXFLAGS='-W -Wall -O3' ./configure && make
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking whether ln -s works... yes
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for inline... inline
checking for working strtod... yes
checking for floor... no
checking for getpagesize... yes
checking for memset... yes
checking for sqrt... no
checking for strtoul... yes
checking for strtol... yes
checking for library containing basename... none required
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for FFTW3... yes
checking for LIBRTLSDR... yes
checking for rtlsdr_set_dithering in -lrtlsdr... no
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
make all-recursive
make[1]: Entering directory '/home/jcw/kalibrate-rtl'
Making all in src
make[2]: Entering directory '/home/jcw/kalibrate-rtl/src'
g++ -I/ -W -Wall -O3 -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()': usrp_source.cc:(.text+0x144): undefined reference to rtlsdr_close'
/usr/bin/ld: kal-usrp_source.o: in function usrp_source::tune(double)': usrp_source.cc:(.text+0x234): undefined reference to rtlsdr_set_center_freq'
/usr/bin/ld: usrp_source.cc:(.text+0x244): undefined reference to rtlsdr_get_center_freq' /usr/bin/ld: kal-usrp_source.o: in function usrp_source::set_freq_correction(int)':
usrp_source.cc:(.text+0x280): undefined reference to rtlsdr_set_freq_correction' /usr/bin/ld: kal-usrp_source.o: in function usrp_source::set_gain(float)':
usrp_source.cc:(.text+0x2b4): undefined reference to rtlsdr_set_tuner_gain_mode' /usr/bin/ld: usrp_source.cc:(.text+0x2ec): undefined reference to rtlsdr_set_tuner_gain'
/usr/bin/ld: kal-usrp_source.o: in function usrp_source::open(unsigned int)': usrp_source.cc:(.text+0x33c): undefined reference to rtlsdr_get_device_count'
/usr/bin/ld: usrp_source.cc:(.text+0x374): undefined reference to rtlsdr_get_device_name' /usr/bin/ld: usrp_source.cc:(.text+0x3ac): undefined reference to rtlsdr_get_device_name'
/usr/bin/ld: usrp_source.cc:(.text+0x3cc): undefined reference to rtlsdr_open' /usr/bin/ld: usrp_source.cc:(.text+0x3e0): undefined reference to rtlsdr_set_sample_rate'
/usr/bin/ld: usrp_source.cc:(.text+0x3f0): undefined reference to rtlsdr_reset_buffer' /usr/bin/ld: usrp_source.cc:(.text+0x41c): undefined reference to rtlsdr_reset_buffer'
/usr/bin/ld: kal-usrp_source.o: in function usrp_source::fill(unsigned int, unsigned int*)': usrp_source.cc:(.text+0x4fc): undefined reference to rtlsdr_read_sync'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:403: kal] Error 1
make[2]: Leaving directory '/home/jcw/kalibrate-rtl/src'
make[1]: *** [Makefile:378: all-recursive] Error 1
make[1]: Leaving directory '/home/jcw/kalibrate-rtl'
make: *** [Makefile:319: all] Error 2
~/kalibrate-rtl $

@marktimmerman-dev
Copy link

cd src

in
g++ -I/ -W -Wall -O3 -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

replace -L before -lrtlsdr with -L and then the path where your librtlsdr.so is located.

@m0yellow
Copy link

Thx, adding the path after -L in Makefile and src/Makefile did it for me.
I guess some automagic doesn't drop the path correctly in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants