Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

identifier "SIG_BLOCK" is undefined

davydden1
Beginner
1,892 Views

Dear all,

I have problems building Cmake 3.11.2 with Intel 17up5 compilers. The same build with GCC 4.8.5 works without any issues. So it looks like this is something specific to Intel compilers, as opposed to being a bug in CMake config/build.

Error I have are:

59 errors found in build log:
     1411        ^
     1412
     1413    /tmp/iwtm108/spack-stage/spack-stage-p0hLlQ/cmake-3.11.2/Source/kwsys/ProcessUNIX.c(1726): warning #266: function "sigprocmask" declared implicitly
     1414        if (sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0) {
     1415            ^
     1416
  >> 1417    /tmp/iwtm108/spack-stage/spack-stage-p0hLlQ/cmake-3.11.2/Source/kwsys/ProcessUNIX.c(1726): error: identifier "SIG_BLOCK" is undefined
     1418        if (sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0) {
     1419                        ^
     1420
     1421    /tmp/iwtm108/spack-stage/spack-stage-p0hLlQ/cmake-3.11.2/Source/kwsys/ProcessUNIX.c(1745): warning #266: function "sigprocmask" declared implicitly
     1422          sigprocmask(SIG_SETMASK, &old_mask, 0);
     1423          ^
     1424
  >> 1425    /tmp/iwtm108/spack-stage/spack-stage-p0hLlQ/cmake-3.11.2/Source/kwsys/ProcessUNIX.c(1745): error: identifier "SIG_SETMASK" is undefined
     1426          sigprocmask(SIG_SETMASK, &old_mask, 0);
     1427                      ^
     1428
     1429    /tmp/iwtm108/spack-stage/spack-stage-p0hLlQ/cmake-3.11.2/Source/kwsys/ProcessUNIX.c(1787): warning #266: function "sigprocmask" declared implicitly
     1430          sigprocmask(SIG_SETMASK, &old_mask, 0);
     1431          ^
     1432
  >> 1433    /tmp/iwtm108/spack-stage/spack-stage-p0hLlQ/cmake-3.11.2/Source/kwsys/ProcessUNIX.c(1787): error: identifier "SIG_SETMASK" is undefined
     1434          sigprocmask(SIG_SETMASK, &old_mask, 0);
     1435                      ^
     1436
     1437    /tmp/iwtm108/spack-stage/spack-stage-p0hLlQ/cmake-3.11.2/Source/kwsys/ProcessUNIX.c(1407): warning #266: function "kill" declared implicitly
     1438                kill(-cp->ForkPIDs, SIGINT);
     1439                ^

Regards, 

Denis.

0 Kudos
2 Replies
Viet_H_Intel
Moderator
1,892 Views

Hi,

Can you try to compile this small test case? I didn't see any problem on my machine.

$ cat t1.c

#include <stdio.h>
#include <signal.h>

int main()
  {
    sigset_t tmp, tmp1;
    sigprocmask( SIG_BLOCK, &tmp, &tmp1 );
    return 0;
  }
$ icc t1.c -V -O2
Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.5.239 Build 20170817
$

0 Kudos
Kosukhin__Sergey
Beginner
1,892 Views

I confirm the problem with building cmake. The reason for that is that some time ago cmake started adding flag -std=c11 instead of -std=gnu11. With -std=c11, the compiler (as it apparently should) defines __STRICT_ANSI__, which stops the preprocessor from defining the macro SIG_BLOCK when processing signal.h. The argument of the developers of cmake is the following: "Intel does not support a 'gnu11' standard flag, only 'c11'." I couldn't find anything regarding -std=gnu11 anywhere in the compiler's documentation but the flag with this value is actually accepted and obviously respected by the compiler. Thus, the question is whether -std=gnu11 is officially supported.

0 Kudos
Reply