Closed AnnoyingTechnology closed 8 months ago
I am also getting same problem
The issue is pkg-config
generates an empty -L
.
In my case, do the following:
pkg-config --libs librtlsdr libhackrf libairspy soxr
-L -lrtlsdr -lhackrf -lairspy -lsoxr
.LDLIBS
variable in the Makefile
. Substitute the pkg-config
expansion ($(shell pkg-config ...)
) with above output. Make sure you omit the initial -L
, so mine should be -lrtlsdr -lhackrf -lairspy -lsoxr
.make
If the build failure is happening on Debian-based system then it is likely bug #925916 (fixed in testing and unstable). The tl;dr is to have this at the top of /usr/lib/x86_64-linux-gnu/pkgconfig/librtlsdr.pc
instead of empty values:
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Building on what @filippog said above, on a raspi run pkg-config --libs librtlsdr --debug
, which, for me, outputs the location of librtlsdr.pc
as /usr/lib/arm-linux-gnueabihf/pkgconfig/librtlsdr.pc
- editing it then fixed the issue.
I went from this error https://github.com/antirez/dump1090/issues/108 to this error here. Even with doing pkg-config --libs librtlsdr --debug
I'm still getting the same error. What do I need to edit to make this work?
Per https://github.com/antirez/dump1090/issues/142#issuecomment-487139377 comment ... I should be replacing ...
LDLIBS+=$(shell pkg-config --libs librtlsdr) -lpthread -lm
with LDLIBS=pkg-config --libs librtlsdr libhackrf libairspy soxr
But I get ...
cc -g -o dump1090 dump1090.o anet.o pkg-config --libs librtlsdr libhackrf libairspy soxr
cc: error: pkg-config: No such file or directory
cc: error: librtlsdr: No such file or directory
cc: error: libhackrf: No such file or directory
cc: error: libairspy: No such file or directory
cc: error: soxr: No such file or directory
cc: error: unrecognized command line option ‘--libs’
make: *** [Makefile:12: dump1090] Error 1
This is a fresh install of the latest version of raspbian buster. I've issued the following commands in order to get the system into a useable state and I'm using the user pi built into it. But clearly, I'm missing some items.
sudo apt update
sudo apt upgrade
sudo raspi-config
sudo apt install git cmake libusb-1.0-0.dev
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build/
cmake ../
cd ~
git clone https://github.com/antirez/dump1090.git
cd dump1090/
make
sudo apt install librtlsdr-dev
make
pkg-config --libs librtlsdr libhackrf libairspy soxr # Dosen't work.
pkg-config --libs librtlsdr --debug
make
pkg-config --libs librtlsdr # Outputs -L -lrtlsdr
clear
nano Makefile
sudo apt install librtlsdr libhackrf libairspy soxr # Doesn't help at all.
make
ls
nano Makefile # Didn't help with the change to LDLIB
make
nano Makefile # Just the rtlsdr as that's what I had.
make
I did some googling and found this stack overflow item usr/bin/ld: cannot find -lld
directly to get information about why it can't find it ... So I did that.
ld -llibrlsdr --verbose
produces
[SNIP]
==================================================
attempt to open //usr/local/lib/arm-linux-gnueabihf/liblibrlsdr.so failed
attempt to open //usr/local/lib/arm-linux-gnueabihf/liblibrlsdr.a failed
attempt to open //lib/arm-linux-gnueabihf/liblibrlsdr.so failed
attempt to open //lib/arm-linux-gnueabihf/liblibrlsdr.a failed
attempt to open //usr/lib/arm-linux-gnueabihf/liblibrlsdr.so failed
attempt to open //usr/lib/arm-linux-gnueabihf/liblibrlsdr.a failed
attempt to open //usr/local/lib/liblibrlsdr.so failed
attempt to open //usr/local/lib/liblibrlsdr.a failed
attempt to open //lib/liblibrlsdr.so failed
attempt to open //lib/liblibrlsdr.a failed
attempt to open //usr/lib/liblibrlsdr.so failed
attempt to open //usr/lib/liblibrlsdr.a failed
attempt to open //usr/arm-linux-gnueabihf/lib/liblibrlsdr.so failed
attempt to open //usr/arm-linux-gnueabihf/lib/liblibrlsdr.a failed
ld: cannot find -llibrlsdr
Notice that it's looking for **liblibrlsdr.so**. That's not right.
If you run whereis librtlsdr
it shows ...
librtlsdr: /usr/lib/arm-linux-gnueabihf/librtlsdr.so /usr/lib/arm-linux-gnueabihf/librtlsdr.a
So the -l command adds lib for us. If we remove that and just do -lrtlsdr
it produces the correct results ... But now gives us a different error ....
cc -g -o dump1090 dump1090.o anet.o -lrtlsdr -L -lpthread -lm
/usr/bin/ld: dump1090.o: undefined reference to symbol 'pthread_create@@GLIBC_2.4'
/usr/bin/ld: //lib/arm-linux-gnueabihf/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:12: dump1090] Error 1
I fixed that last error by doing this to the Makefile ...
dump1090: dump1090.o anet.o
$(CC) -g -pthread -o dump1090 dump1090.o anet.o $(LDFLAGS) $(LDLIBS)
THIS is now my full make file ...
CFLAGS?=-O2 -g -Wall -W $(shell pkg-config --cflags librtlsdr)
LDLIBS+=-lrtlsdr -L -lpthread -lm
CC?=gcc
PROGNAME=dump1090
all: dump1090
%.o: %.c
$(CC) $(CFLAGS) -c $<
dump1090: dump1090.o anet.o
$(CC) -g -pthread -o dump1090 dump1090.o anet.o $(LDFLAGS) $(LDLIBS)
clean:
rm -f *.o dump1090
Was using the MalcolRobb/dump1090 version but got this error, finally found that using the version at https://github.com/joergsteinkamp/dump1090, compiles fine. And actually working better than ever! :o)
4CAA4F S 27825 7 10 3 50801D S 1160 32950 436 145 7 45 7
Had to build this again as I moved over to a new system with a new arch. Was surprised that this issue was still open and outstanding, and even more that I had ready commented and fixed the problem. Thanks past me.
In 2022 for rpi zero the issue was still present, the @hopkinskong response helped (for lrtlsdr only)
Try install pkg-config package with apt (debian bullseye).
Hello,
here it is :
Thanks for your help