When attempting to build on macOS 14 (Sonoma), the process kept failing because the compiler and linker couldn't find the Liquid-DSP headers or libraries. This was despite having the necessary packages installed (brew install liquid-dsp soapysdr).
The issue appears to be that the Makefile assumes that the paths returned by pkg-config for SoapySDR will also include the Liquid-DSP headers/libraries - but on macOS when using Homebrew, this isn't the case. Instead, the path returned is the specific folder in Homebrew's "Cellar" for SoapySDR (e.g. /opt/homebrew/Cellar/soapysdr/0.8.1_1/lib), which doesn't have anything related to Liquid-DSP for obvious reasons.
To work around this, I manually ran the compilation command (thankfully, there's only one) with the 'generic' Homebrew includes/lib paths (/opt/homebrew/include and /opt/homebrew/lib), which let everything compile happily. Said generic paths are just trees of symlinks to solve for this issue while allowing for multiple versions of a given app/library to be installed, to avoid Dependency Hell and the like.
As to a fix for the Makefile, I'm unsure of the best way, but an easy way would be to:
Test if a system is running a Darwin-based OS using uname
Test if homebrew is installed by running brew --env
If true, set SOAPY_CFLAGS to $HOMEBREW_PREFIX/include and SOAPY_LDFLAGS $HOMEBREW_PREFIX/lib in the Makefile.
In my case - and if anyone having similar issues on macOS runs into this issue - the working build command ended up being:
When attempting to build on macOS 14 (Sonoma), the process kept failing because the compiler and linker couldn't find the Liquid-DSP headers or libraries. This was despite having the necessary packages installed (
brew install liquid-dsp soapysdr
).The issue appears to be that the Makefile assumes that the paths returned by
pkg-config
for SoapySDR will also include the Liquid-DSP headers/libraries - but on macOS when using Homebrew, this isn't the case. Instead, the path returned is the specific folder in Homebrew's "Cellar" for SoapySDR (e.g. /opt/homebrew/Cellar/soapysdr/0.8.1_1/lib), which doesn't have anything related to Liquid-DSP for obvious reasons.To work around this, I manually ran the compilation command (thankfully, there's only one) with the 'generic' Homebrew includes/lib paths (
/opt/homebrew/include
and/opt/homebrew/lib
), which let everything compile happily. Said generic paths are just trees of symlinks to solve for this issue while allowing for multiple versions of a given app/library to be installed, to avoid Dependency Hell and the like.As to a fix for the Makefile, I'm unsure of the best way, but an easy way would be to:
uname
brew --env
$HOMEBREW_PREFIX/include
and SOAPY_LDFLAGS$HOMEBREW_PREFIX/lib
in the Makefile.In my case - and if anyone having similar issues on macOS runs into this issue - the working build command ended up being:
cc fm_tune.c -std=c99 -O3 -Wall -Wextra -march=native -I/opt/homebrew/include -lliquid -lm -L/opt/homebrew/lib -lSoapySDR -o fm_tune