c - 在 MinGW/MSYS2 上编译 XZ Utils 时的未知类型

标签 c signals mingw mingw-w64 xz

我一直在尝试使用 MinGW-w64 编译 XZ Utils,并在尝试运行 make 时之后./configure ing,我收到错误 sigset_t未知。

XZ Utils 版本是 5.2.3,我的 MinGW-w64 是 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

我检查了signal.h对于 sigset_t使用gcc -E - <<< "#include <signal.h>" | grep sigset_t但什么也没找到。现在我一直想知道这是否是 MinGW 的限制,如果是,是否有办法解决它。

最佳答案

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

#ifdef _POSIX
typedef _sigset_t   sigset_t;
#endif

看来只有在定义了 _POSIX 时才定义它。它也在 sys/types.h 与 signal.h 中...

关于c - 在 MinGW/MSYS2 上编译 XZ Utils 时的未知类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48015645/

相关文章:

mingw - 如何卸载msys2?

c++ - 关于未声明 TITLEBARINFO 的 MinGW 错误

c - 从函数返回后如何实现堆栈框架不被销毁?

Python,sigaction(2) 可用吗?

class - pyqt-如何为 QLabel 类创建点击信号?

c++ - 使用 boost 信号编译 VS8 C++ 程序时出现问题

c++ - 如何用mingw在windows上编译rtaudio?

c - 以编程方式解决魔方

c - 使用 2 个线程 ID 的合并排序

c - connect() 怎么会失败并将 errno 设置为 EADDRINUSE