-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add link flags from pkg-config for libusb-1.0 #97
base: master
Are you sure you want to change the base?
Conversation
Needed when using Mac OS X 10.11, with libusb installed through homebrew
On Linux I'm getting:
Is this not the case on OS X 10.11? |
I do have the lib, but I'm missing the path.
If we had -L/usr/local/lib, that would also be good enough, but this is not in the default search path for libs. |
On OS X 10.9 I get:
and a successful build. Are you sure this isn't a local issue? Does this repro on other 10.11 boxes? Also check:
|
I don't have any other machines to test on. Where does your OS X machine have libusb-1.0.*? I didn't have it in /usr/local/Cellar/librtlsdr/0.5.3/lib, but only in /usr/local/Cellar/libusb/1.0.20/lib. |
I have libusb in the same location (granted, version 1.0.18) |
Interesting. I'll poke around in the homebrew recipe a bit later to see if I can see what's going on. |
No clue. Doesn't seem like an earlier version of the recipe would have done this, nor does building from source. Maybe some version of the bottle included it; can I ask what you get if you remove and reinstall librtlsdr? (not sure how much time / effort you want to put into this...) |
FWIW, the root cause seems to be https://www.mail-archive.com/[email protected]/msg00955.html . I recently replaced homebrew's librtlsdr with https://github.com/keenerd/rtl-sdr, where it has this fix (see keenerd/rtl-sdr@bc872cb) , and now pkg-config --libs librtlsdr returns a -L for libusb-1.0 as well. |
@mikeage great news! Can we consider this issue closed? Or is there anything you think we should change (only if it won't break other environments, of course)? |
Given that the "official" homebrew version seems to be broken, out of the box, I'm not sure it's really closed. dump1090 does depend on both libusb-1.0 and librtlsdr, and even if one often includes the other, I think it's more proper to include an explicit dependency. I presume pkg-config --libs libusb-1.0 doesn't break anything on Linux, does it? OTOH, most packages that use librtlsdr don't include libusb-1.0, and I've had to patch all of them as well. I understand the forks of dump1090, but I've seen others as well, so maybe I'm missing something. Or maybe most users are on Linux :) |
This worked for me on OS X 14.0 ARM CC?=clang
CFLAGS?=-O2 -g -Wall -W $(shell pkg-config --cflags librtlsdr)
LDLIBS+= \
$(shell pkg-config --libs libusb-1.0) \
$(shell pkg-config --libs librtlsdr) \
-lpthread \
-lm
PROGNAME=dump1090
all: $(PROGNAME)
%.o: %.c
$(CC) $(CFLAGS) -c $<
dump1090: $(PROGNAME).o anet.o
$(CC) -g -o $(PROGNAME) $(PROGNAME).o anet.o $(LDFLAGS) $(LDLIBS)
clean:
rm -f *.o $(PROGNAME) |
Needed when using Mac OS X 10.11, with libusb installed through homebrew