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

No longer able to compile w/GNU python

rudi-gaelzer
New Contributor I
1,732 Views

I'm using:

OS:  Linux 4.16.14-300.fc28.x86_64 #1 SMP Tue Jun 5 16:23:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux (Fedora 28)

Python: Python 2.7.15 (default, May 16 2018, 17:50:09)
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)] on linux2

icc: Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.3.222 Build 20180410

Not so long ago, I was perfectly able to compile C functions which called python modules, using GNU python.  Here's an example:

#include <Python.h>
#include <complex.h>

double complex c2f1_mpmath_cp_ca(double complex a1, double complex a2, double complex b1, double complex z)
{
/* local variables declarations */
   int npars= 4;
   double complex result;
   PyObject *pName, *pModule, *pFunc, *pArgs, *pValue;
   PyObject *pa1, *pa2, *pb1, *pz;
   Py_complex res_pc;

   if(! Py_IsInitialized()) Py_Initialize();
   pa1= PyComplex_FromDoubles(creal(a1),cimag(a1)); 
   pa2= PyComplex_FromDoubles(creal(a2),cimag(a2));
   pb1= PyComplex_FromDoubles(creal(b1),cimag(b1));
   pz=  PyComplex_FromDoubles(creal(z),cimag(z));

   pName = PyString_FromString("mpmath");
   pModule = PyImport_Import(pName);
   pFunc = PyObject_GetAttrString(pModule, "hyp2f1");
   pArgs = PyTuple_Pack(npars, pa1, pa2, pb1, pz);
   pValue = PyObject_CallObject(pFunc, pArgs);
   res_pc= PyComplex_AsCComplex(pValue);
   result= res_pc.real + res_pc.imag*I;
   return result;
}

Now, all of a sudden, a lot of errors appear.  Any idea what could be causing the errors below?

~>icc -c -I/usr/include/python2.7 c2f1_mpmath_cp_ca.c 
In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(140): error: identifier "_Float32" is undefined
  extern _Float32 strtof32 (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(146): error: identifier "_Float64" is undefined
  extern _Float64 strtof64 (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(158): error: identifier "_Float32x" is undefined
  extern _Float32x strtof32x (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(164): error: identifier "_Float64x" is undefined
  extern _Float64x strtof64x (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(233): error: identifier "_Float32" is undefined
                       _Float32 __f)
                       ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(239): error: identifier "_Float64" is undefined
                       _Float64 __f)
                       ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(251): error: identifier "_Float32x" is undefined
                        _Float32x __f)
                        ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(257): error: identifier "_Float64x" is undefined
                        _Float64x __f)
                        ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(316): error: identifier "_Float32" is undefined
  extern _Float32 strtof32_l (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(323): error: identifier "_Float64" is undefined
  extern _Float64 strtof64_l (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(337): error: identifier "_Float32x" is undefined
  extern _Float32x strtof32x_l (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(344): error: identifier "_Float64x" is undefined
  extern _Float64x strtof64x_l (const char *__restrict __nptr,
         ^

In file included from /usr/include/math.h(389),
                 from /usr/local/intel/compilers_and_libraries_2018.3.222/linux/compiler/include/math.h(173),
                 from /usr/include/python2.7/pyport.h(325),
                 from /usr/include/python2.7/Python.h(61),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/bits/mathcalls.h(53): error: identifier "_Float32" is undefined
  __MATHCALL (acos,, (_Mdouble_ __x));

 

 

 

0 Kudos
5 Replies
Viet_H_Intel
Moderator
1,736 Views

 

The error seems to be coming from stdlib.h. Were you able to compile with an older version of Intel compiler before? or you were only able to compile with GNU? and version of GCC you used is 8.1? were you able to compile with older versions of GCC (i.e. 4.8,*, 5.1* or 7.3*?

Thanks,

Viet

 

0 Kudos
rudi-gaelzer
New Contributor I
1,736 Views

Viet Hoang (Intel) wrote:

The error seems to be coming from stdlib.h. Were you able to compile with an older version of Intel compiler before? or you were only able to compile with GNU? and version of GCC you used is 8.1? were you able to compile with older versions of GCC (i.e. 4.8,*, 5.1* or 7.3*?

As I wrote, I was able to compile the sample I sent and lots more using both icc 2018 and gcc.  But I suspect that the problem started with the newest version of gcc.

Soon after I sent the first message I found an earlier thread reporting the same problem here.

However, the solution offered did not work for me, because some new error messages came up:

~>icc -c -I/usr/include/python2.7 -D_Float32=float -D_Float64='float double' -D_Float32x=double -D_Float64x='long double' c2f1_mpmath_cp_ca.c     
In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(146): error: invalid combination of type specifiers
  extern _Float64 strtof64 (const char *__restrict __nptr,
         ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(239): error: invalid combination of type specifiers
                       _Float64 __f)
                       ^

In file included from /usr/include/python2.7/Python.h(42),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/stdlib.h(323): error: invalid combination of type specifiers
  extern _Float64 strtof64_l (const char *__restrict __nptr,
         ^

In file included from /usr/include/math.h(406),
                 from /usr/local/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h(173),
                 from /usr/include/python2.7/pyport.h(325),
                 from /usr/include/python2.7/Python.h(61),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/bits/mathcalls.h(53): error: invalid combination of type specifiers
  __MATHCALL (acos,, (_Mdouble_ __x));
  ^

In file included from /usr/include/math.h(406),
                 from /usr/local/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h(173),
                 from /usr/include/python2.7/pyport.h(325),
                 from /usr/include/python2.7/Python.h(61),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/bits/mathcalls.h(53): error: invalid combination of type specifiers
  __MATHCALL (acos,, (_Mdouble_ __x));
  ^

In file included from /usr/include/math.h(406),
                 from /usr/local/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h(173),
                 from /usr/include/python2.7/pyport.h(325),
                 from /usr/include/python2.7/Python.h(61),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/include/bits/mathcalls.h(53): error: invalid combination of type specifiers
  __MATHCALL (acos,, (_Mdouble_ __x));

The "unidentified identifier" messages were replaced by the "invalid combination of specifiers" related to _Float64...

0 Kudos
rudi-gaelzer
New Contributor I
1,736 Views

UPDATE: Found an even earlier thread reporting the same kind of problem here.

I modified the compilation line to mimic the suggestion there and the error message was substantially reduced:

~>icc -c -I/usr/include/python2.7 -D_Float32=float -D_Float64=double -D_Float32x=_Float64 -D_Float64x='long double' c2f1_mpmath_cp_ca.c 
In file included from /usr/include/python2.7/pyport.h(325),
                 from /usr/include/python2.7/Python.h(61),
                 from c2f1_mpmath_cp_ca.c(1):
/usr/local/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h(1230): error: identifier "_LIB_VERSION_TYPE" is undefined
  _LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;
                   ^

compilation aborted for c2f1_mpmath_cp_ca.c (code 2)

I'd say that's progress, right?

Any suggestions about what I should do now about the complaint that the 'identifier "_LIB_VERSION_TYPE" is undefined'?

 

0 Kudos
rudi-gaelzer
New Contributor I
1,736 Views

UPDATE 2: Found yet another thread here.

The whole shebang:

~>icc -c -I/usr/include/python2.7 -D_Float32=float -D_Float64=double -D_Float32x=_Float64 -D_Float64x='long double' -D__PURE_INTEL_C99_HEADERS__ c2f1_mpmath_cp_ca.c

seems to work.  icc was able to create the object.

I was also able to compile and link another test program that not only employs the C/Python API but gnu's quadmath library as well.

Do you think it's all right if I keep using this workaround until you guys fix this bug?

 

0 Kudos
nystrom__William
Beginner
1,736 Views

I'm having the same problem while trying to build Open MPI but am having trouble getting the above solution to work with the Open MPI configure script.  Any chance this will get fixed soon?

Thanks,

Dave

 

0 Kudos
Reply