Skip to content

Commit

Permalink
Makefile: use pkg-config to detect libusb on macOS
Browse files Browse the repository at this point in the history
Some versions of librtlsdr (including the version installed by Homebrew
bottle) wrongly declare -lusb-1.0 in its pkg-config file's Libs section.
On Apple Silicon Macs, Homebrew installs libusb dylibs in /opt/homebrew/lib,
which is not a known path for linkers and causes build failure. Some people
reported this linker problem in flightaware#166, flightaware#181. This should fix it.

For the redundant -lusb-1.0 problem, also see:
https://gitea.osmocom.org/sdr/rtl-sdr/commit/222517b506278178ab93182d79ccf7eb04d107ce
  • Loading branch information
sdlyyxy committed Aug 16, 2022
1 parent 9aee367 commit 02d60c1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ ifeq ($(UNAME), Darwin)
endif
DUMP1090_CPPFLAGS += -DMISSING_NANOSLEEP
COMPAT += compat/clock_nanosleep/clock_nanosleep.o
ifeq ($(PKGCONFIG), yes)
LIBS_SDR += $(shell pkg-config --libs-only-L libusb-1.0)
endif
LIBS_USB += -lusb-1.0
LIBS_CURSES := -lncurses
# cpufeatures reportedly does not work (yet) on darwin arm64
Expand Down

0 comments on commit 02d60c1

Please sign in to comment.