-
Notifications
You must be signed in to change notification settings - Fork 235
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
Added macOS build capability #34
Conversation
Tested on Mojave 10.14.2. For anyone that comes across this PR - it doesn't totally solve the build problem, at least not on the above OS version. For some reason there are some missing type definitions, the one the compiler always crashed on for me was make DARWIN=yes
cc -DMODES_DUMP1090_VERSION=\"\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\" -DENABLE_RTLSDR -DENABLE_BLADERF -std=c11 -O2 -g -Wall -Werror -W -D_DEFAULT_SOURCE -I/usr/local/Cellar/librtlsdr/0.6.0/include/ -I/usr/local/Cellar/libusb/1.0.22/include/libusb-1.0 -I/usr/local/Cellar/libbladerf/2018.08/include/ -DPOSIX_MACH_TIMING -c sdr_bladerf.c -o sdr_bladerf.o
sdr_bladerf.c:358:39: error: implicit declaration of function 'le64toh' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
uint64_t metadata_timestamp = le64toh(*(uint64_t*)(header + 4));
^
1 error generated.
make: *** [sdr_bladerf.o] Error 1 I resolved it by re-defining the type at the top of #ifdef __APPLE__
#include <machine/endian.h>
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
#define __BIG_ENDIAN BIG_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#define __BYTE_ORDER BYTE_ORDER
#endif Myles |
Thanks, got this to work thanks to the branch+tips but ran into a little more trouble. Had to follow instructions here: Added the directory Added the snippet of @mylesagray But still ran into trouble
Then I ran into an issue when trying to run the dump1090 binary with the blade lib not being available, had to:
After that running dump1090 works for me! |
Running without bladerf ( |
I think this is not a very good way of doing it. Dump1090 does not need MacOS support "added" per se - it already has it. But it's apparently been neglected and fallen into disrepair. Having a compile-time parameter And Dump1090 already has code in the I tried building the last commit prior to the Makefile being clobbered but my MacOS is too new. It barfs about |
Fyi I opened pull request #38 which fixes Mac compatibility by using the already-existing compatibility code. |
No description provided.