Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

intelpython3-2018.1-023.x86_64: preprocessing error when compiling python module using regex.h

rouberol
Beginner
701 Views

Hi

I bump into an error when trying to build an additional python module using intelpython3-2018.1-023.x86_64

OS: CentOs 6.9 x86_64
Compiler: icc 18.0.1.163, gcc, presumed all
Intel python: 3-2018.1-023

# test:
cat <<EOF > regex_test.c
#include <regex.h>
EOF

$ icc -E -I /softs/intel/python/2018_u1/intelpython3/include regex_test.c >/dev/null
In file included from /softs/intel/python/2018_u1/intelpython3/include/tclPort.h(23),
                 from /softs/intel/python/2018_u1/intelpython3/include/tclInt.h(36),
                 from /softs/intel/python/2018_u1/intelpython3/include/regex.h(4),
                 from regex_test.c(1):
/softs/intel/python/2018_u1/intelpython3/include/tclUnixPort.h(158): error #2379: cannot open source file "../compat/unistd.h"
  #   include "../compat/unistd.h"
                                  ^
The "/softs/intel/python/2018_u1/intelpython3/include" include path is *required* for additional python modules compilation.
Obviously the *tcl header overrides the glibc one*.

No such problem occurs with a system python installation (CentOS 6.9), since glibc include "regex.h" is used.

Regards

sr

0 Kudos
3 Replies
Rohit_J_Intel
Employee
701 Views

Hi,

Thanks for bringing this issue to our attention, we would address this. In the meantime, you can employ the following workaround to build your Python extension:

  • In file <IDP_installation>/include/tclUnixPort.h

   Replace : (from line 155)

   #ifdef HAVE_UNISTD_H
   #   include <unistd.h>
   #else
   #   include "../compat/unistd.h"
   #endif

   With:

   #ifdef HAVE_UNISTD_H
   #   include <unistd.h>
   #else
   #   include "compat/unistd.h"
   #endif
  • In file <IDP_installation>/include/tclInt.h

   Replace: (from line 51)

  #ifdef STDC_HEADERS
  #include <stddef.h>
  #else
  typedef int ptrdiff_t;
  #endif

   With:

  #ifdef STDC_HEADERS
  #include <stddef.h>
  #else
  #ifndef _PTRDIFF_T
  #define _PTRDIFF_T
  typedef int ptrdiff_t;
  #endif
  #endif

With this workaround, you should be able to build regex_test.c with : icc -I<IDP_installation>/include regex_test.c

Thanks,
Rohit

0 Kudos
rouberol
Beginner
701 Views
Hi Rohit the above workaround worked like a charm, thanks. Fix in next release? sr
0 Kudos
Rohit_J_Intel
Employee
701 Views
Yes, this would be fixed in the next release. Glad to be of help.
 
Thanks,
Rohit
0 Kudos
Reply