Page 1 of 1

Errors compiling on OSX (compiler macros?)

Posted: Mon Feb 13, 2017 1:19 am
by mdmayfield
I'm trying to compile the latest source from Git on Mac OS X 10.11.6. So far I've closely followed the instructions here.

Something seems to be wrong with the makefile or some other mechanism by which information is passed to the compiler, and I could use some help diagnosing. Sequence:

1) Clone the source into a local directory
2) cd there
3) /opt/local/libexec/qt4/bin/qmake -spec macx-g++ (this dir is not in my $PATH... though the result is the same whether I call it by absolute path or by putting that dir in $PATH)
4) Makefile is created, apparently correctly
5) make
6) Error in compiling mastertimer-unix.cpp:

Code: Select all

mastertimer-unix.cpp:116:25: error: use of undeclared identifier
      'CLOCK_MONOTONIC'
    ret = clock_gettime(CLOCK_MONOTONIC, finish);
I'm inferring from this page that there is no such function as CLOCK_MONOTONIC on OSX. In mastertimer-unix.o there are a bunch of compiler directives like

Code: Select all

#if defined(Q_OS_OSX) || defined(Q_OS_IOS)
    ret = clock_get_time(cclock, finish);
#else
    ret = clock_gettime(CLOCK_MONOTONIC, finish);
#endif
So apparently for some reason "Q_OS_OSX" is not being recognized as defined. My next step was to add #define Q_OS_OSX to the start of mastertimer-unix.o, and while that gets past the CLOCK_MONOTONIC error, I now see a variety of other errors such as mastertimer-unix.cpp:46:61: error: use of undeclared identifier 'cclock'; did you mean 'clock'?.

I'm guessing from this that there's someplace else with an #if defined(Q_OS_OSX) that's not registering the right OS.

Can anyone suggest a path forward to troubleshooting and resolving this properly? I suspect I'm missing something in the makefile, but am not quite sure where to go from here.

Thanks,

Matt

Re: Errors compiling on OSX (compiler macros?)

Posted: Mon Feb 13, 2017 4:11 am
by mdmayfield
I got past the original error by grepping -r the source tree and manually adding #define Q_OS_OSX to any file that did an #if defined test, but now I'm getting PortAudio related errors. "_Pa_CloseStream", "_Pa_GetDefaultInputDevice", "_Pa_GetDefaultOutputDevice", and several other _Pa* symbols are "not found for architecture x86_64" and causing the linker to fail.

PortAudio is definitely installed:

Code: Select all

Matt-Mayfields-MacBook-Pro:qlcplus mattmayfield$ sudo port install portaudio
Password:
--->  Cleaning portaudio
--->  Scanning binaries for linking errors
--->  No broken files found.
I can't help but feel like I'm missing something obvious and that the #define kludge outlined above shouldn't be necessary. Does anyone have any ideas on how to proceed?

Thanks,

Matt

Re: Errors compiling on OSX (compiler macros?)

Posted: Mon Feb 13, 2017 6:35 am
by mlohrey
This probably doesn't help one little bit ;) , but I have been using Mac OS to compile without issue but am using Mac OS 10.12.6 and Qt 5.7.1.

Re: Errors compiling on OSX (compiler macros?)

Posted: Mon Feb 13, 2017 1:27 pm
by mcallegari
macOS builds on Qt4 are marked as outdated (see Wiki)
Use the Qt5 instructions: https://github.com/mcallegari/qlcplus/wiki

Re: Errors compiling on OSX (compiler macros?)

Posted: Tue Feb 14, 2017 4:50 am
by mdmayfield
Oops. Thank you, I will try that.