ofxHapPlayer icon indicating copy to clipboard operation
ofxHapPlayer copied to clipboard

Libdispatch errors with GCC on some Linuxes

Open brinoausrino opened this issue 4 years ago • 4 comments

I'm trying to compile ofxHapPlayer in Arch Linux and get this preprocessing error

In File, included by /usr/include/dispatch/dispatch.h:32,
                 by /home/brian/Dev/openframeworks/addons/ofxHapPlayer/src/ofxHapPlayer.cpp:49:
/usr/include/os/generic_unix_base.h:97:54: Error: missing binary operator before token "("
   97 | #if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
      |    

Maybe some has any idea.

brinoausrino avatar Feb 03 '21 15:02 brinoausrino

Are you using GCC? Are you able to try building with clang?

bangnoise avatar Feb 03 '21 23:02 bangnoise

I built it with GCC. Right now I tried clang and it worked. Is there some workaround for GCC?

brinoausrino avatar Feb 04 '21 08:02 brinoausrino

I think this should eventually be supported by newer versions of GCC, but in the meantime this hack will lose multi-threaded decoding of chunked Hap movies, which will be bad for performance if you are using them.

Using line numbers in current master, in ofxHapPlayer.cpp:

delete line 48 #include <dispatch/dispatch.h>

replaces lines 110-111 with

    for (int i = 0; i < count; i++)
    {
        function(p, i);
    }

bangnoise avatar May 06 '21 08:05 bangnoise

Leaving this open as we could remove the dependency on libdispatch on Linux.

Once OpenFrameworks supports C++17 we could use std::for_each with parallel_unsequenced_policy.

bangnoise avatar May 06 '21 08:05 bangnoise