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));