2

I've been trying to compile XZ Utils using MinGW-w64 and when trying to run make after ./configureing, I get the error that sigset_t is unknown.

The XZ Utils version is 5.2.3, and my MinGW-w64 is x86_64-7.2.0-posix-seh-rt_v5-rv1.

In file included from common/common.h:17:0,
                 from common/common.c:13:
../../src/common/mythread.h:138:33: error: unknown type name 'sigset_t'
 mythread_sigmask(int how, const sigset_t *restrict set,
                                 ^~~~~~~~
../../src/common/mythread.h:139:3: error: unknown type name 'sigset_t'; did you mean '_sigset_t'?
   sigset_t *restrict oset)
   ^~~~~~~~
   _sigset_t
../../src/common/mythread.h: In function 'mythread_create':
../../src/common/mythread.h:158:2: error: unknown type name 'sigset_t'; did you mean '_sigset_t'?
  sigset_t old;
  ^~~~~~~~
  _sigset_t
../../src/common/mythread.h:159:2: error: unknown type name 'sigset_t'; did you mean '_sigset_t'?
  sigset_t all;
  ^~~~~~~~
  _sigset_t
../../src/common/mythread.h:160:2: warning: implicit declaration of function 'sigfillset' [-Wimplicit-function-declaration]
  sigfillset(&all);
  ^~~~~~~~~~
../../src/common/mythread.h:162:2: warning: implicit declaration of function 'mythread_sigmask'; did you mean 'pthread_sigmask'? [-Wimplicit-function-declaration]
  mythread_sigmask(SIG_SETMASK, &all, &old);
  ^~~~~~~~~~~~~~~~
  pthread_sigmask

I checked signal.h for sigset_t using gcc -E - <<< "#include <signal.h>" | grep sigset_t and found nothing. Now I've been wondering if this is a MinGW limitation and, if yes, if there is a way around it.

FallenWarrior
  • 656
  • 3
  • 16

1 Answers1

2

https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/crt/sys/types.h#L110

#ifdef _POSIX
typedef _sigset_t   sigset_t;
#endif

It appears this only gets defined if _POSIX is defined. It also is in sys/types.h vs. signal.h...

Joe
  • 41,484
  • 20
  • 104
  • 125
  • Still, is there any way to build this on MinGW? Because just adding `-D_POSIX` obviously yields a linker error. I mean, I've seen references to MinGW in the `configure.ac`, so there should be _some_ way at least – FallenWarrior Dec 29 '17 at 22:20
  • I found the issue to be related to my installation. Apparently, XZ Utils assumes that having `pthreads`, which I have in my MinGW installation, implies having `sigset_t` as well, without checking whether or not a #define for POSIX exists. – FallenWarrior Dec 29 '17 at 22:36
  • 2
    FIX: I had to undefine `MYTHREAD_POSIX`, as well as `HAVE_CLOCK_GETTIME`and `HAVE_DECL_CLOCK_MONOTIC` – FallenWarrior Dec 29 '17 at 22:54