sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network
Other
107 stars 63 forks source link

Building from source on Android Studio for Linux fails on version 1.16.0 #169

Open mvidaldp opened 2 years ago

mvidaldp commented 2 years ago

Building from source on Android Studio for Linux fails on version 1.16.0 due to missing include for Linux on thirdparty/loguru.cpp

Error message: use of undeclared identifier 'pthread_getname_np'

It is fixed by using the missing include (it's there on version 1.15.2 sources).

So change this:

#if LOGURU_PTHREADS
    #include <pthread.h>
    #if defined(__FreeBSD__)
        #include <pthread_np.h>
        #include <sys/thr.h>
    #elif defined(__OpenBSD__)
        #include <pthread_np.h>
    #endif
#endif

To this:

#if LOGURU_PTHREADS
    #include <pthread.h>
    #if defined(__FreeBSD__)
        #include <pthread_np.h>
        #include <sys/thr.h>
    #elif defined(__OpenBSD__)
        #include <pthread_np.h>
    #endif
    #ifdef __linux__
        /* On Linux, the default thread name is the same as the name of the binary.
           Additionally, all new threads inherit the name of the thread it got forked from.
           For this reason, Loguru use the pthread Thread Local Storage
           for storing thread names on Linux. */
        #ifndef LOGURU_PTLS_NAMES
            #define LOGURU_PTLS_NAMES 1
        #endif
    #endif
#endif