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

Makefile doesn't work correctly on macOS 14 with Homebrew #6

Open
kd8drx opened this issue Jul 5, 2024 · 0 comments
Open

Makefile doesn't work correctly on macOS 14 with Homebrew #6

kd8drx opened this issue Jul 5, 2024 · 0 comments

Comments

@kd8drx
Copy link

kd8drx commented Jul 5, 2024

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:

  1. Test if a system is running a Darwin-based OS using uname
  2. Test if homebrew is installed by running brew --env
  3. 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:

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

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

1 participant