simutrans icon indicating copy to clipboard operation
simutrans copied to clipboard

compile error on alpine linux

Open rofl0r opened this issue 7 years ago • 1 comments

musl libc doesn't support PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP. the _NP at the end means "non portable". that means it shouldn't be used.

instead the portable way is

pthread_mutex_t Mutex;
pthread_mutexattr_t Attr;

pthread_mutexattr_init(&Attr);
pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&Mutex, &Attr);

according to https://stackoverflow.com/questions/7037481/c-how-do-you-declare-a-recursive-mutex-with-posix-threads

i'm usign a bogus PR to report this issue, since "issues" are not available in this repo.

rofl0r avatar Sep 09 '18 20:09 rofl0r

forgot the error msg

boden/wege/../../utils/simthread.h:27:48: error: 'PTHREAD_RECURSIVE_MUTEX_INITI$
 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIAL$
                                                ^
boden/wege/../../utils/simthread.h:27:48: note: in definition of macro 'PTHREAD$
 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIAL$

rofl0r avatar Sep 09 '18 20:09 rofl0r