Project

General

Profile

Actions

Bug #3130

closed

rtl-sdr: compilation error on macOS in rtl_test.c member reference type 'struct timespec' is not a pointer

Added by mot about 6 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
04/02/2018
Due date:
% Done:

0%

Spec Reference:

Description

The master branch of rtlsdr (HEAD at 4520f00) currently does not compile on macOS and fails with following compiler error:

/tmp/librtlsdr-20180331-8326-8tlv3/src/rtl_test.c:165:4: error: member reference type 'struct timespec' is not a pointer; did you mean to use '.'?
        ts->tv_sec = tv.tv_sec;
        ~~^~
          .
/tmp/librtlsdr-20180331-8326-8tlv3/src/rtl_test.c:165:13: error: expression is not assignable
        ts->tv_sec = tv.tv_sec;
        ~~~~~~~~~~ ^
/tmp/librtlsdr-20180331-8326-8tlv3/src/rtl_test.c:166:4: error: member reference type 'struct timespec' is not a pointer; did you mean to use '.'?
        ts->tv_nsec = tv.tv_usec * 1000;
        ~~^~
          .
/tmp/librtlsdr-20180331-8326-8tlv3/src/rtl_test.c:166:14: error: expression is not assignable
        ts->tv_nsec = tv.tv_usec * 1000;
        ~~~~~~~~~~~ ^
4 errors generated.
make[2]: *** [src/CMakeFiles/rtl_test.dir/rtl_test.c.o] Error 1
make[1]: *** [src/CMakeFiles/rtl_test.dir/all] Error 2

See the attached log file homebrew-librtlsdr-macos-error.log for the full compiler output.

The issue seems to have been caused by a fairly recent commit (a03198c). The alleged commit introduced a generic time struct and as far as I can judge the author forgot to update the time structure for Apple platforms, i.e. macOS.

I tried to fix the issue with the attached patch homebrew-librtlsdr-macos.patch but I'm not familiar with the rtlsdr code base and no C expert, so please verify it as I only tested whether it compiles (which "works for me"™). Please let me know if you want me to test the code.

OS macOS Sierra (10.12.6)
CC LLVM/Clang
Package Manager Homebrew

Files

Actions #1

Updated by steve-m almost 6 years ago

  • Status changed from New to Resolved

Thank you for reporting, should be fix in current master.

Actions #2

Updated by laforge almost 6 years ago

  • Project changed from SDR (Software Defined Radio) to rtl-sdr
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)