miweber67 / spyserver_client

CLI spyserver client to provide basic rtl_sdr and rtl_power-like outputs from an Airspy spyserver.
GNU General Public License v3.0
25 stars 2 forks source link

Compiling on OSX Sonoma: atomic not found #9

Closed mkierczak closed 9 months ago

mkierczak commented 1 year ago

There is no library atomic on OSX. Proposed solution (worked for me):

CXX=g++
CXXFLAGS=-I. -O3 -Wall -std=c++11
#CXXFLAGS=-I. -g -Wall
DEPS = tcp_client.h spyserver_protocol.h ss_client_if.h
OBJ = ss_client.o tcp_client.o ss_client_if.o

# Detect OS (based on https://stackoverflow.com/questions/714100/os-detecting-makefile)
ifeq ($(OS),Windows_NT)     # is Windows_NT on XP, 2000, 7, Vista, 10...
    detected_OS := Windows
else
    detected_OS := $(shell uname)  # same as "uname -s"
endif

%.o: %.c $(DEPS)
    $(CXX) -c -o $@ $< $(CXXFLAGS)

ifeq ($(detected_OS),Darwin)        # Mac OS X
    ss_client: $(OBJ)
        $(CXX) -o $@ $^ $(CXXFLAGS) -lpthread -lsamplerate -lc #-latomic
else                    # not Mac OS X
       ss_client: $(OBJ)
                $(CXX) -o $@ $^ $(CXXFLAGS) -lpthread -lsamplerate -latomic
endif

clean:
    rm -f *.o
    rm -f ss_client
miweber67 commented 1 year ago

Wonderful, thanks for the fix! I can’t test the MacOS side but I’ll try to get this merged in the next few days.

miweber67 commented 9 months ago

I can't get this to work under Linux with gnu Make 4. May need to just have a separate makefile for MacOS unless someone who is a makefile expert and who can test on both MacOS and Linux can generate a working makefile.