mutability / dump1090

Dump1090 is a simple Mode S decoder for RTLSDR devices
529 stars 137 forks source link

Add back Darwin/Mach/Apple portability #67

Closed dstipp closed 9 years ago

dstipp commented 9 years ago
Add back Darwin/Mach/Apple portability

Quite a few of the changes against the MalcolmRobb/dump1090 fork are
incompatible with OSX.  This patch adds back that cross platform support
back.

Was: First pass at Darwin/Mach/Apple portability

Quite a few of the changes against the MalcolmRobb/dump1090 fork are
incompatible with OSX.  This is a first pass at attempting to add cross
platform compatibility back.

All targets except dump1090 build with this patch.

Additional problems to be resolved:
error: redefinition of typedef 'rtlsdr_dev_t' is a C11 feature
 - introduced at 2784481

error: implicit declaration of function 'clock_nanosleep' is invalid in C99
error: use of undeclared identifier 'TIMER_ABSTIME'
 - introduced at 15ea5ba
mutability commented 9 years ago

Hey, thanks for looking at this. I'll need some way to build for OSX for testing (at least to check that it compiles after I make changes). It looks like travis-ci will support OSX, do you have any experience with that?

mutability commented 9 years ago

For the rtlsdr_dev_t thing, we can either compile with whatever flag enables C11 support, or make it a void* in the struct and cast where needed.

mutability commented 9 years ago

For the missing clock_nanosleep, you could build something equivalent from gettimeofday() or clock_gettime() and nanosleep()

dstipp commented 9 years ago

Appreciate the comments. I wanted to get this over despite not being finished before I spent too much time on it.

I've not yet looked at travis-ci, but it should be straightforward. It may get a little mouse-trappy for the first build of this. I'll probably have to do a separate CR to add in OS X CI support.

As for the rest, I'll take a look later tonight. I'm not too familiar with CLANG other than "It's very strict." Honestly surprised it let me get away with the stub shenanigans looking back at them this in the morning. :-)

dstipp commented 9 years ago

Ok, looks like I now have a working build on OS X 10.10, Debian Jessie, and Ubuntu (through travis.) I have to enable c11 in llvm/clang, but doing the same on gcc causes an implosion...

Would be interested in further feedback on how to clean up the compat inclusions.

I'll start looking at travisci builds for OS X in another PR. It's probably going to be annoying since I may very well have to build librtlsdr & libusb before attempting a build of dump1090.

dstipp commented 9 years ago

Well, that was easy. Included a patch to update travis to do multi-platform builds. Valid on both Linux & OS X.

mutability commented 9 years ago

I did a few rearrangements and merged this. The travis build seems happy, can you check it works OK for you?

dstipp commented 9 years ago

Looking good here, thanks.